summaryrefslogtreecommitdiff
path: root/src/host
diff options
context:
space:
mode:
authorhathach <[email protected]>2026-01-03 23:54:05 +0700
committerhathach <[email protected]>2026-01-03 23:54:05 +0700
commitb93d463afa11a7a24bc43dc7969a287c1d056b27 (patch)
treec0438e48bc377f589048196265077cbd4a7cb7d0 /src/host
parentd457ea3d3ca6727099211528bc0c415ed12eadff (diff)
fix rusb2 hcd_port_connect_status() using line state, add post root reset delay for stable speed detection
Diffstat (limited to 'src/host')
-rw-r--r--src/host/usbh.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/host/usbh.c b/src/host/usbh.c
index e99d9e977..a725b7c8b 100644
--- a/src/host/usbh.c
+++ b/src/host/usbh.c
@@ -1405,12 +1405,13 @@ static void remove_device_tree(uint8_t rhport, uint8_t hub_addr, uint8_t hub_por
// NOTE: due to the shared control buffer, we must complete enumerating
// one device before enumerating another one.
//--------------------------------------------------------------------+
-enum { // USB 2.0 specs 7.1.7 for timing
- ENUM_DEBOUNCING_DELAY_MS = 150, // T(ATTDB) minimum 100 ms for stable connection
- ENUM_RESET_ROOT_DELAY_MS = 50, // T(DRSTr) minimum 50 ms for reset from root port
- ENUM_RESET_HUB_DELAY_MS = 20, // T(DRST) 10-20 ms for hub reset
- ENUM_RESET_RECOVERY_DELAY_MS = 10, // T(RSTRCY) minimum 10 ms for reset recovery
- ENUM_SET_ADDRESS_RECOVERY_DELAY_MS = 2, // USB 2.0 Spec 9.2.6.3 min is 2 ms
+enum { // USB 2.0 specs 7.1.7 for timing
+ ENUM_DEBOUNCING_DELAY_MS = 150, // T(ATTDB) minimum 100 ms for stable connection
+ ENUM_RESET_ROOT_DELAY_MS = 50, // T(DRSTr) minimum 50 ms for reset from root port
+ ENUM_RESET_ROOT_POST_DELAY_MS = 2, // 2 ms delay after root port reset before getting speed/status
+ ENUM_RESET_HUB_DELAY_MS = 20, // T(DRST) 10-20 ms for hub reset
+ ENUM_RESET_RECOVERY_DELAY_MS = 10, // T(RSTRCY) minimum 10 ms for reset recovery
+ ENUM_SET_ADDRESS_RECOVERY_DELAY_MS = 2, // USB 2.0 Spec 9.2.6.3 min is 2 ms
};
enum {
@@ -1469,6 +1470,7 @@ static bool enum_new_device(hcd_event_t* event) {
hcd_port_reset(dev0_bus->rhport);
tusb_time_delay_ms_api(ENUM_RESET_ROOT_DELAY_MS);
hcd_port_reset_end(dev0_bus->rhport);
+ tusb_time_delay_ms_api(ENUM_RESET_ROOT_POST_DELAY_MS);
if (!hcd_port_connect_status(dev0_bus->rhport)) {
// device unplugged while delaying