Hi Marc-André Lureau > Subject: Re: [PATCH v2 4/8] hw/usb/redirect-server: Announce the exported > device > > > Send device_connect when a device is attached and the host has greeted > > us, device_disconnect when it goes away, and handle the bus reset the > > host sends before enumerating. > > > > Wait a short time before sending device_connect. Firmware often > > toggles the USB pull-up a few times while it starts its controller. If > > the host starts to enumerate while the device is off, we cannot answer > > its first request, and it only retries after a control timeout of several > > seconds. > > sigh, this is going to hit us as machine may behave differently. I think we > should > make the redirect-server machine-agnostic then. >
Thanks for the review and suggestion. I added the 10 ms timer to avoid announcing the device before the firmware had finished its USB initialization. I went back and measured it. On both gadgets I tested, the port attaches only once and does not detach during initialization: Zephyr on AST1030, "usb enable": 1 attach, 0 detach Linux on AST2600, gadget bind: 1 attach, 0 detach So the delay is not needed for these cases. I will drop the announce timer. When the device is attached, the redirect server will send device_connect immediately. This keeps the redirect server independent of machine-specific timing. Thanks, Jamin > -- > Marc-André Lureau <[email protected]>
