diff options
| author | HiFiPhile <[email protected]> | 2025-04-18 17:41:41 +0200 |
|---|---|---|
| committer | hathach <[email protected]> | 2025-04-22 16:58:12 +0700 |
| commit | 3c4e6a779d65ad2d28e0eef0284df88e39bec6bc (patch) | |
| tree | 65da6281edc3c9d9b0a16b0fae7e12f06c0873ba /src | |
| parent | 9f096ac56b637423ba7c4a4004f6f95006c12e95 (diff) | |
Move decouncing delay before USB reset.
Signed-off-by: HiFiPhile <[email protected]>
Diffstat (limited to 'src')
| -rw-r--r-- | src/host/usbh.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/host/usbh.c b/src/host/usbh.c index 69784ed47..c38afa3be 100644 --- a/src/host/usbh.c +++ b/src/host/usbh.c @@ -1692,6 +1692,15 @@ static bool enum_new_device(hcd_event_t* event) { _dev0.hub_port = event->connection.hub_port; if (_dev0.hub_addr == 0) { + // wait until device connection is stable TODO non blocking + tusb_time_delay_ms_api(ENUM_DEBOUNCING_DELAY_MS); + + // device unplugged while delaying + if (!hcd_port_connect_status(_dev0.rhport)) { + enum_full_complete(); + return true; + } + // connected directly to roothub hcd_port_reset(_dev0.rhport); @@ -1701,9 +1710,6 @@ static bool enum_new_device(hcd_event_t* event) { hcd_port_reset_end(_dev0.rhport); - // wait until device connection is stable TODO non blocking - tusb_time_delay_ms_api(ENUM_DEBOUNCING_DELAY_MS); - // device unplugged while delaying if (!hcd_port_connect_status(_dev0.rhport)) { enum_full_complete(); |
