This is an automated email from the ASF dual-hosted git repository. jerpelea pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push: new 7bad94a964 drivers/usbhost: recognize sim usb cdcacm composite device 7bad94a964 is described below commit 7bad94a964400aae6f158e120575ee2cb8893731 Author: yangsong8 <yangso...@xiaomi.com> AuthorDate: Mon Jan 20 22:00:43 2025 +0800 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 <yangso...@xiaomi.com> --- drivers/usbhost/usbhost_cdcacm.c | 11 +++++++++-- drivers/usbhost/usbhost_composite.c | 8 +++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/usbhost/usbhost_cdcacm.c b/drivers/usbhost/usbhost_cdcacm.c index 3648e70b5d..590659e1fa 100644 --- a/drivers/usbhost/usbhost_cdcacm.c +++ b/drivers/usbhost/usbhost_cdcacm.c @@ -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[] */ }; diff --git a/drivers/usbhost/usbhost_composite.c b/drivers/usbhost/usbhost_composite.c index 602b844756..933bc97e7f 100644 --- a/drivers/usbhost/usbhost_composite.c +++ b/drivers/usbhost/usbhost_composite.c @@ -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