Skip to content

Commit

Permalink
usbhost: recognize sim usb cdcacm composite device
Browse files Browse the repository at this point in the history
Signed-off-by: yangsong8 <[email protected]>
  • Loading branch information
yangsong8-a1 authored and xiaoxiang781216 committed Mar 3, 2025
1 parent 107d8be commit 552bbc3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
11 changes: 9 additions & 2 deletions drivers/usbhost/usbhost_cdcacm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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 */
Expand Down Expand Up @@ -414,7 +421,7 @@ static struct usbhost_registry_s g_cdcacm =
{
NULL, /* flink */
usbhost_create, /* create */
4, /* nids */
5, /* nids */
&g_id[0] /* id[] */
};

Expand Down
8 changes: 5 additions & 3 deletions drivers/usbhost/usbhost_composite.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 552bbc3

Please sign in to comment.