diff options
| author | Ryzee119 <[email protected]> | 2022-05-29 14:00:36 +0930 |
|---|---|---|
| committer | Ryzee119 <[email protected]> | 2022-05-29 14:15:57 +0930 |
| commit | b7c8cb3c41ba0fc7f9c0db9379d5c65871f6374d (patch) | |
| tree | f67d0fa69462e33784cc27daa16b5b4ab0bb080e /src/host | |
| parent | 9e30ec4f160e4816e3c43a0590e6c58832a66cac (diff) | |
Hub: Unplug downstream devices on non-root hub disconnect
Diffstat (limited to 'src/host')
| -rw-r--r-- | src/host/usbh.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/host/usbh.c b/src/host/usbh.c index e0e41a8d1..af2ad0575 100644 --- a/src/host/usbh.c +++ b/src/host/usbh.c @@ -1107,6 +1107,12 @@ static void process_device_unplugged(uint8_t rhport, uint8_t hub_addr, uint8_t h { TU_LOG2(" Address = %u\r\n", dev_addr); + // If the device itself is a usb hub, unplug downstream devices. + if (dev_addr > CFG_TUH_DEVICE_MAX) + { + process_device_unplugged(rhport, dev_addr, 0); + } + // Invoke callback before close driver if (tuh_umount_cb) tuh_umount_cb(dev_addr); |
