Linux: Return ERROR_NOT_FOUND in detach-kernel-driver if usbfs is already bound
authorHans de Goede <hdegoede@redhat.com>
Wed, 22 Aug 2012 10:47:00 +0000 (11:47 +0100)
committerPete Batard <pete@akeo.ie>
Thu, 23 Aug 2012 19:24:14 +0000 (20:24 +0100)
commit34807a115263ff4fe94b1dc894f93f076e759d5f
treed4f9a5f15788658f94cb4e5beca998451df6420d
parentede02ba91920f9be787a7f3cd006c5a4b92b5eab
Linux: Return ERROR_NOT_FOUND in detach-kernel-driver if usbfs is already bound

* Currently applications for devices which only are accessed from userspace
  can use claim / release interface to make sure they don't get in each others
  way.
* The same however does not work for applications which first need to detach
  a "native" / in kernel driver, as this detach will not only detach native
  drivers but also the usbfs driver, thus stealing the device from another
  userspace / libusbx app.
* This patch fixes libusb_detach_kernel_driver to only detach "real" kernel
  drivers and not the special usbfs driver used for userspace access to
  USB devices. If the usbfs driver is found LIBUSB_ERROR_NOT_FOUND will be
  returned to indicate no driver was detached.
libusb/core.c
libusb/os/linux_usbfs.c
libusb/version_nano.h