On Tue, Feb 04, 2020 at 03:15:56PM +0200, Lauri Jakku wrote: > There is multiple reports of random behaviour of USB HID devices. > > I have mouse that acts sometimes quite randomly, I debugged with > logs others have published: that there is HW timeouts that leave > device in state that it is errorneus. > > To fix this, I introduce retry mechanism in root of USB HID drivers. > > Fix does not slow down operations at all if there is no -ETIMEDOUT > got from control message sending. > > If there is one, then sleep 20ms and try again. Retry count is 20 > witch translates maximium of 400ms before giving up. If the 400ms > boundary is reached the HW is really bad. > > JUST to be clear: > This does not make USB HID devices to sleep anymore than > before, if all is golden and no timeouts are got. > > Why modify usb-hid-core: No need to modify driver by driver. > At this time i do not know all the USB HID devices that timeouts, > but what i've researched, there are issues. > > Timeout given is divided by 100, but taken care that it is always > at least 10ms. > > so total time in common worst-case-scenario is: > > sleep of 20ms + common timeout divided by 100 (50ms) makes > 70ms per loop, 20 loops => 1.4sec . > > Signed-off-by: Lauri Jakku <lja@xxxxxx> > --- > drivers/usb/core/message.c | 55 ++++++++++++++++++++++++++++++++++---- > 1 file changed, 50 insertions(+), 5 deletions(-) What changed from v1 and v2? That always has to be described below the --- line, as documented, to give us a chance to understand what is happening here and why this is a new version. Please fix up and send a v4. thanks, greg k-h