Skip to content

Commit

Permalink
use hub_addr=0, hub_port=0 for removing root hub port
Browse files Browse the repository at this point in the history
  • Loading branch information
hathach committed Mar 28, 2024
1 parent d50003e commit ddb1034
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/host/usbh.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,17 +412,10 @@ bool tuh_deinit(uint8_t rhport) {
// deinit host controller
hcd_int_disable(rhport);
hcd_deinit(rhport);

_usbh_controller = TUSB_INDEX_INVALID_8;

// "unplug" all devices on this rhport
for (uint8_t idx = 0; idx < CFG_TUH_DEVICE_MAX + CFG_TUH_HUB; idx++) {
usbh_device_t *dev = &_usbh_devices[idx];
if (!dev->connected || dev->rhport != rhport) {
continue;
}
process_removing_device(rhport, dev->hub_addr, dev->hub_port);
}
// "unplug" all devices on this rhport (hub_addr = 0, hub_port = 0)
process_removing_device(rhport, 0, 0);

// deinit host stack if no controller is active
if (!tuh_inited()) {
Expand Down

0 comments on commit ddb1034

Please sign in to comment.