Linux: Stop kernel from re-attaching in-kernel driver after reset
authorHans de Goede <hdegoede@redhat.com>
Tue, 8 Feb 2011 15:37:18 +0000 (16:37 +0100)
committerPeter Stuge <peter@stuge.se>
Sun, 24 Jul 2011 21:34:58 +0000 (23:34 +0200)
commit20e26dda0f86dafa3436b152e090b5f3410c8ce4
tree0535df06fa6a46615ea2afb50843181498e2033d
parent4e294dc9848aab86b31d2fff228cf97e7eadf913
Linux: Stop kernel from re-attaching in-kernel driver after reset

When an interface is bound to the usbfs driver (iow claimed), the
kernel will unbind it, and then after the reset do a device_attach
on the interface, which will bind the default in kernel driver to
the interface.

So if an app has detached the in kernel driver, and claimed the
interface and then does a libusb_reset_device. Things end up with
the interface no longer being bound to the usbfs driver (so no longer
claimed) and instead it is bound to the in kernel driver (iow the in
kernel driver is re-attached).

We can stop this from happening by releasing all claimed interfaces
before the reset, as the kernel will not do the device attach after
reset, if no driver was bound to the interface before the reset.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
libusb/os/linux_usbfs.c