This is an automated email from the ASF dual-hosted git repository.
xiaoxiang 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 8cb1fd713e9 drivers/usbhost_hub: Add support to Multiple TT HS HUB
8cb1fd713e9 is described below
commit 8cb1fd713e9c851b705c44b6ae174af80b1f46c9
Author: Alan Carvalho de Assis <[email protected]>
AuthorDate: Sun Oct 26 09:08:27 2025 -0300
drivers/usbhost_hub: Add support to Multiple TT HS HUB
This is the case for USB2517 USB HUB. Also improved the driver to
avoid mistakes: initially I changed g_id[3], but the in register
there is another field where we need to pass this size again. So
it is better to use ARRAY_SIZE() macro to avoid mistakes.
Signed-off-by: Alan C. Assis <[email protected]>
---
drivers/usbhost/usbhost_hub.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/usbhost/usbhost_hub.c b/drivers/usbhost/usbhost_hub.c
index b87f15be602..c90890597ba 100644
--- a/drivers/usbhost/usbhost_hub.c
+++ b/drivers/usbhost/usbhost_hub.c
@@ -32,6 +32,7 @@
#include <assert.h>
#include <errno.h>
#include <debug.h>
+#include <sys/param.h>
#include <nuttx/irq.h>
#include <nuttx/kmalloc.h>
@@ -184,7 +185,7 @@ static int usbhost_disconnected(FAR struct usbhost_class_s
*hubclass);
* used to associate the USB host hub class to a connected USB hub.
*/
-static const struct usbhost_id_s g_id[2] =
+static const struct usbhost_id_s g_id[] =
{
{
USB_CLASS_HUB, /* base */
@@ -196,7 +197,14 @@ static const struct usbhost_id_s g_id[2] =
{
USB_CLASS_HUB, /* base */
0, /* subclass */
- 1, /* proto HS hub */
+ 1, /* proto Single TT HS hub */
+ 0, /* vid */
+ 0 /* pid */
+ },
+ {
+ USB_CLASS_HUB, /* base */
+ 0, /* subclass */
+ 2, /* proto Multiple TT HS hub */
0, /* vid */
0 /* pid */
}
@@ -208,7 +216,7 @@ static struct usbhost_registry_s g_hub =
{
NULL, /* flink */
usbhost_create, /* create */
- 2, /* nids */
+ nitems(g_id), /* nids */
g_id /* id[] */
};