On Wed, Feb 15, 2023 at 07:29:52PM +0200, Roger Quadros wrote: > I was more interested in this case where USB is suspended and then system suspends. > Waking up the system on USB activity (while suspended) is taken care of by hardware. > But I'm not sure if gadget driver will be up in time to respond to the request > reasonably quickly. It would take a couple of seconds and is not hard time bound. > Is this time mandated by the USB Spec or is it host implementation specific? The USB spec doesn't say very much about it. One part of the USB 2.0 spec seems relevant; it says: 9.2.6.2 Reset/Resume Recovery Time After a port is reset or resumed, the USB System Software is expected to provide a “recovery” interval of 10 ms before the device attached to the port is expected to respond to data transfers. The device may ignore any data transfers during the recovery interval. After the end of the recovery interval (measured from the end of the reset or the end of the EOP at the end of the resume signaling), the device must accept data transfers at any time. Accepting a data transfer doesn't necessarily mean completing it, though. The Linux USB core does send a request to a device 10 ms after resuming it, but the timeout period on this request is 5 seconds. This gives you some leeway. Alan Stern