Skip to content

Commit

Permalink
Merge pull request #2546 from tannewt/unplug_on_deinit
Browse files Browse the repository at this point in the history
Fake unplug devices when a root hub is deinit
  • Loading branch information
hathach authored Mar 28, 2024
2 parents a5a9093 + ddb1034 commit 5ff6e0f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/host/usbh.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,9 +412,11 @@ 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 (hub_addr = 0, hub_port = 0)
process_removing_device(rhport, 0, 0);

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

0 comments on commit 5ff6e0f

Please sign in to comment.