On 9/26/22 23:55, Christian Kohlschütter wrote:
On 26. Sep 2022, at 01:45, Marek Vasut <ma...@denx.de> wrote:
On 9/25/22 16:46, Christian Kohlschütter wrote:
When detecting USB storage devices, we currently skip everything that is
not marked as "undefined device class".
Composite devices such as tinyusb's CDC+MSC identify as "miscellaneous"
(class 0xEF).
Introduce a new constant, USB_CLASS_MISC (0xEF), and allow the detection
process to proceed for USB devices with this device class.
What does Linux do with such a device , is there a specific quirk or does it
simply not check the bDeviceClass at all ?
I didn't see any relevant checks in drivers/usb/storage, however changing the bDeviceClass from
"MISC" (0xEF) to "UNSPECIFIED"/"PER_INTERFACE" (0x00) causes the device to be
no longer detected by either Linux or macOS, but it would work with U-Boot (i.e., without the change).
macOS' USB prober would report the USB device as "unconfigured". On Linux,
using usbutils but not busybox, lsusb would actually hang.
I think it's a good idea to keep the set of permitted device classes to a
minimum (0x00 / 0xEF) and abort early in all other cases. This way, we can skip
the more elaborate checks in usb_storage_probe for devices that are definitely
not supported.
I think the check in the usb_storage.c is actually correct as-is and the
device you have might be odd.
https://www.usb.org/sites/default/files/usbmassbulk_10.pdf
"
4.1 Device Descriptor
Each USB device has one device descriptor (per USB Specification). The
device shall specify the device class and subclass codes in the
interface descriptor, and not in the device descriptor.
...
4 | bDeviceClass | Byte | 00h | Class is specified in the interface
descriptor.
...
NOTE: Information in this table is from the USB Specification version
1.1 table 9-7. Bold text has been added for clarifications when using
these descriptors with this specification.
"
And then
"
4.3 Interface Descriptors
The device shall support at least one interface, known herein as the
Bulk-Only Data Interface. The Bulk-Only Data Interface uses three endpoints.
Composite mass storage devices may support additional interfaces, to
provide other features such as audio or video capabilities. This
specification does not define such interfaces.
The interface may have multiple alternate settings. The host shall
examine each of the alternate settings to look for the
bInterfaceProtocol and bInterfaceSubClass it supports optimally.
"
If I read this right, then such a composite device like you have should
have bDeviceClass=0x00 and two Interface descriptors, one for the mass
storage device and one for CDC ?