nusb/usbd: use longer reset delay for rootports

Make reset delays more conservative:

The usb spec says root ports need 50ms reset minimum, use 100ms.
The usb spec says hub ports need 20ms minimum, use 50ms.
This commit is contained in:
cinap_lenrek 2024-12-15 21:19:57 +00:00
parent 2f685dd96b
commit d38dbf6415
2 changed files with 4 additions and 3 deletions

View file

@ -56,8 +56,9 @@ enum
Pconfigured, Pconfigured,
/* Delays, timeouts (ms) */ /* Delays, timeouts (ms) */
Resetdelay = 20, /* how much to wait after a reset */ Rootresetdelay = 100, /* how much to wait after a root port reset (50ms by standard) */
Resumedelay = 20, /* how much to wait after a resume */ Portresetdelay = 50, /* how much to wait after a hub port reset (20ms by standard) */
Resumedelay = 50, /* how much to wait after a resume (20ms by standard) */
Powerdelay = 100, /* after powering up ports */ Powerdelay = 100, /* after powering up ports */
Pollms = 250, /* port poll interval */ Pollms = 250, /* port poll interval */

View file

@ -452,7 +452,7 @@ portattach(Hub *h, int p)
dprint(2, "%s: %s: port %d: set reset: %r\n", argv0, d->dir, p); dprint(2, "%s: %s: port %d: set reset: %r\n", argv0, d->dir, p);
return -1; return -1;
} }
sleep(Resetdelay); sleep(d->depth<0? Rootresetdelay: Portresetdelay);
if((sts = portstatus(h, p)) == -1) if((sts = portstatus(h, p)) == -1)
return -1; return -1;
sp = "full"; sp = "full";