From: Xiaofan C. <xia...@gm...> - 2011-02-10 08:54:59
|
On Thu, Feb 10, 2011 at 3:41 PM, Hans de Goede <hde...@re...> wrote: >> I think this does not affect Windows. For one thing, the >> current WinUSB and HID backends do not support >> libusb_reset_device. And even for libusb0.sys which >> might support that function, there is no problem, the driver >> will be the same after reset. >> >> I am not so sure if this patch is really needed, even for >> Linux. Typically after device reset, the handle may not be >> valid and you need to redo the initial steps like to detach >> the kernel driver again. > > That is not true, the handle only becomes invalid if the devices > "morphs" into another device such as from cdrom -> modem with > certain adsl modem. If the device does not morph the handle > stays perfectly valid. Currently one does indeed need to re-detach > the in kernel driver and reclaim. This is very bad for the following > reason (example assumes a single interface device): > > -app does reset to get device into clean state > -kernel driver binds talks to device -> > device state no longer clean > -app unbinds kernel driver > -app claims > -app still does not have a clean device state > > With my solution this becomes: > -app does reset to get device into clean state > -app has device in clean state and can continue > > Note that this is not some hypothetical case, I've observed the > old unwanted scenario happening, and I've also tested my code > and it works (leads to the 2nd scenario). > What if the use case is indeed that device "morphs" into another device -- like firmware updating? -- Xiaofan |