On Fri, Aug 28, 2020 at 04:10:47PM +0300, Mathias Nyman wrote: > >> Thanks, that seems to work! (Judging by the absence of my original > >> issue with the xum1541 adapter; I haven't checked what's actually > >> happening on the bus). > >> > >> Martin > >> > > > > Great, thanks. > > > > Now this test code needs to be cleaned up a turned into a real patch > > Can you test one more round? > The code below is cleaned up but it also has a functional change. > This version issues separate commands for dropping and adding endpoints. > Previous code both did all on one command. > > If it works I'll send it forward. > > Thanks > -Mathias > > --- > From: Mathias Nyman <mathias.nyman@xxxxxxxxxxxxxxx> > Subject: [PATCH] usb: Fix out of sync data toggle if a configured device is > reconfigured > > Userspace drivers that use a SetConfiguration() request to "lightweight" > reset a already configured usb device might cause data toggles to get out > of sync between the device and host, and the device becomes unusable. > > The xHCI host requires endpoints to be dropped and added back to reset the > toggle. USB core avoids these otherwise extra steps if the current active > configuration is the same as the new requested configuration. > > A SetConfiguration() request will reset the device side data toggles. > Make sure usb core drops and adds back the endpoints in this case. > > To avoid code duplication split the current usb_disable_device() function > and reuse the endpoint specific part. > > Signed-off-by: Mathias Nyman <mathias.nyman@xxxxxxxxxxxxxxx> This seems reasonable. But can you add something to the kerneldoc for usb_reset_configuration() explaining that if the routine fails, the device will probablly be in an unusable state (endpoints disabled, interfaces only partially enabled)? Alan Stern