Skip to content

Commit 7df7590

Browse files
committed
Hub: Remove multi-level hub bypass
1 parent b7c8cb3 commit 7df7590

File tree

1 file changed

+18
-27
lines changed

1 file changed

+18
-27
lines changed

src/host/usbh.c

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1513,40 +1513,31 @@ static bool _parse_configuration_descriptor(uint8_t dev_addr, tusb_desc_configur
15131513
uint16_t const drv_len = tu_desc_get_interface_total_len(desc_itf, assoc_itf_count, desc_end-p_desc);
15141514
TU_ASSERT(drv_len >= sizeof(tusb_desc_interface_t));
15151515

1516-
if (desc_itf->bInterfaceClass == TUSB_CLASS_HUB && dev->hub_addr != 0)
1516+
// Find driver for this interface
1517+
uint8_t drv_id;
1518+
for (drv_id = 0; drv_id < USBH_CLASS_DRIVER_COUNT; drv_id++)
15171519
{
1518-
// TODO Attach hub to Hub is not currently supported
1519-
// skip this interface
1520-
TU_LOG(USBH_DBG_LVL, "Only 1 level of HUB is supported\r\n");
1521-
}
1522-
else
1523-
{
1524-
// Find driver for this interface
1525-
uint8_t drv_id;
1526-
for (drv_id = 0; drv_id < USBH_CLASS_DRIVER_COUNT; drv_id++)
1520+
usbh_class_driver_t const * driver = &usbh_class_drivers[drv_id];
1521+
1522+
if ( driver->open(dev->rhport, dev_addr, desc_itf, drv_len) )
15271523
{
1528-
usbh_class_driver_t const * driver = &usbh_class_drivers[drv_id];
1524+
// open successfully
1525+
TU_LOG2(" %s opened\r\n", driver->name);
15291526

1530-
if ( driver->open(dev->rhport, dev_addr, desc_itf, drv_len) )
1527+
// bind (associated) interfaces to found driver
1528+
for(uint8_t i=0; i<assoc_itf_count; i++)
15311529
{
1532-
// open successfully
1533-
TU_LOG2(" %s opened\r\n", driver->name);
1530+
uint8_t const itf_num = desc_itf->bInterfaceNumber+i;
15341531

1535-
// bind (associated) interfaces to found driver
1536-
for(uint8_t i=0; i<assoc_itf_count; i++)
1537-
{
1538-
uint8_t const itf_num = desc_itf->bInterfaceNumber+i;
1539-
1540-
// Interface number must not be used already
1541-
TU_ASSERT( DRVID_INVALID == dev->itf2drv[itf_num] );
1542-
dev->itf2drv[itf_num] = drv_id;
1543-
}
1532+
// Interface number must not be used already
1533+
TU_ASSERT( DRVID_INVALID == dev->itf2drv[itf_num] );
1534+
dev->itf2drv[itf_num] = drv_id;
1535+
}
15441536

1545-
// bind all endpoints to found driver
1546-
tu_edpt_bind_driver(dev->ep2drv, desc_itf, drv_len, drv_id);
1537+
// bind all endpoints to found driver
1538+
tu_edpt_bind_driver(dev->ep2drv, desc_itf, drv_len, drv_id);
15471539

1548-
break; // exit driver find loop
1549-
}
1540+
break; // exit driver find loop
15501541
}
15511542

15521543
if( drv_id >= USBH_CLASS_DRIVER_COUNT )

0 commit comments

Comments
 (0)