drivers/usbhost: recognize sim usb cdcacm composite device

In the USB interface descriptor of the cdcacm device, class:2 (CDC)
subclass:2 (ACM) protocol:0 (NONE) may appear. At this time, the
usb host does not match the correct protocol byte, which will cause
the device identification to fail.

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
This commit is contained in:
yangsong8
2025-01-20 22:00:43 +08:00
committed by Alin Jerpelea
parent 66f464936a
commit 7bad94a964
2 changed files with 14 additions and 5 deletions
+9 -2
View File
@@ -376,7 +376,7 @@ static bool usbhost_txempty(FAR struct uart_dev_s *uartdev);
* device.
*/
static const struct usbhost_id_s g_id[4] =
static const struct usbhost_id_s g_id[5] =
{
{
USB_CLASS_CDC, /* base */
@@ -385,6 +385,13 @@ static const struct usbhost_id_s g_id[4] =
0, /* vid */
0 /* pid */
},
{
USB_CLASS_CDC, /* base */
CDC_SUBCLASS_ACM, /* subclass */
CDC_PROTO_NONE, /* proto */
0, /* vid */
0 /* pid */
},
{
USB_CLASS_CDC, /* base */
CDC_SUBCLASS_ACM, /* subclass */
@@ -414,7 +421,7 @@ static struct usbhost_registry_s g_cdcacm =
{
NULL, /* flink */
usbhost_create, /* create */
4, /* nids */
5, /* nids */
&g_id[0] /* id[] */
};
+5 -3
View File
@@ -590,15 +590,17 @@ int usbhost_composite(FAR struct usbhost_hubport_s *hport,
if (desc->type == USB_DESC_TYPE_INTERFACE)
{
#ifdef CONFIG_DEBUG_ASSERTIONS
FAR struct usb_ifdesc_s *ifdesc =
(FAR struct usb_ifdesc_s *)desc;
DEBUGASSERT(ifdesc->ifno < 32);
#endif
/* Increment the count of interfaces */
nintfs++;
if (ifdesc->alt == 0)
{
nintfs++;
}
}
/* Check for IAD descriptors that will be used when it is