[PATCH] usb: common: Detect USB storage media with "miscellaneous" USB devices
Christian Kohlschütter
christian at kohlschutter.com
Sat Oct 1 00:58:17 CEST 2022
On 1. Oct 2022, at 00:21, Christian Kohlschütter <christian at kohlschutter.com> wrote:
>
>>> See https://github.com/hathach/tinyusb/blob/master/examples/device/cdc_msc/src/usb_descriptors.c for an example of such a device. It has one mass storage device and one CDC.
>>> Changing the device class to 0x00 breaks support on Linux and macOS (I didn't try Windows).
>>
>> The question is -- does the aforementioned device conform to the USB-IF specification ? I think it does not, but luckily it could be fixed in software on the tinyusb side.
>
> I'm not familiar enough with the available USB specs to say what is "right" but I think the problem is that "fixing" it by changing the device class breaks support on major operating systems.
OK, looking through the tinyUSB example source code [1] and USB docs [2], it looks like the reason why changing the device class from 0xEF (misc) to 0x00 is that the combination deviceClass:0xEF + deviceSubClass:0x02 + deviceProtocol:0x01 indicates the presence of an "Interface Association Descriptor":
// Use Interface Association Descriptor (IAD) for CDC
// As required by USB Specs IAD's subclass must be common class (2) and protocol must be IAD (1)
.bDeviceClass = TUSB_CLASS_MISC,
.bDeviceSubClass = MISC_SUBCLASS_COMMON,
.bDeviceProtocol = MISC_PROTOCOL_IAD,
So yeah, it looks like it has to be like that.
[1] https://github.com/hathach/tinyusb/blob/master/examples/device/cdc_msc/src/usb_descriptors.c
[2] https://www.usb.org/defined-class-codes
More information about the U-Boot
mailing list