[U-Boot] [PATCH] usb:composite:fix Provide function data when addressing device with only one interface

Tormod Volden
2013-06-27T21:36:09Z

Lukasz Majewski writes:
>
> This commit fixes problems with some non-standard requests send with
> device address instead of interface address (bmRequestType.Receipent field).
>
> This happens with dfu-util (debian version: 0.5), which address non standard
> requests (like w_value=0x21 and bRequest=GET_DESCRIPTOR) to device.

Dear u-boot developers,

The above comment seems to imply that dfu-util is sending non-standard
requests. For the record, that would be wrong. dfu-util is sending a
standard "get descriptor" request. These always go to the device, not to an
interface. The descriptor it is asking for is, although not mandatory per
the core USB standard, a class-specific descriptor which is part of the DFU
1.0 standard. So this is all standard.

While on this topic, I would recommend that you include this descriptor in
the configuration descriptor set, that is, in the complete configuration
descriptor that the host OS usually requests during enumeration. Also this
class-specific descriptor belongs here. In that case, the OS and libusb will
keep a copy of this descriptor, and dfu-util will not have to send an
explicit request (through libusb_get_descriptor()) to retrieve it.

> Without this fix, the above request is STALLED, and hence causes dfu-util
> to assume some standard configuration (packet size = 1024B instead of 4096B)

Note that this number is the "Maximum number of bytes that the device can
accept per control-write transaction."

The DFU transactions should work fine if a smaller packet size is used - as
long as it is larger or equal to the bMaxPacketSize0. Of course, smaller
packets will cause more overhead and be less efficient, but you must make
sure that your device can handle this. I am not sure from these comments
whether the smaller packet size caused errors in your implementation, or if
the problem was just reduced performance.

Best regards,
Tormod Volden