Skip to content

Commit b7c8cb3

Browse files
committed
Hub: Unplug downstream devices on non-root hub disconnect
1 parent 9e30ec4 commit b7c8cb3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/host/usbh.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,6 +1107,12 @@ static void process_device_unplugged(uint8_t rhport, uint8_t hub_addr, uint8_t h
11071107
{
11081108
TU_LOG2(" Address = %u\r\n", dev_addr);
11091109

1110+
// If the device itself is a usb hub, unplug downstream devices.
1111+
if (dev_addr > CFG_TUH_DEVICE_MAX)
1112+
{
1113+
process_device_unplugged(rhport, dev_addr, 0);
1114+
}
1115+
11101116
// Invoke callback before close driver
11111117
if (tuh_umount_cb) tuh_umount_cb(dev_addr);
11121118

0 commit comments

Comments
 (0)