aboutsummaryrefslogtreecommitdiffstats
path: root/libusb/libusb.h
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2013-06-13 21:21:14 +0200
committerHans de Goede <hdegoede@redhat.com>2013-06-19 11:04:14 +0200
commitfc51f19341af70508b94c06ff763842b396ea72e (patch)
tree0cb2d75131893603a3e4c0c456f4cefe060599ca /libusb/libusb.h
parent6b3931526db981e3a298a226e5d0b4e20c04913d (diff)
downloadandroid_external_libusbx-fc51f19341af70508b94c06ff763842b396ea72e.tar.gz
android_external_libusbx-fc51f19341af70508b94c06ff763842b396ea72e.tar.bz2
android_external_libusbx-fc51f19341af70508b94c06ff763842b396ea72e.zip
libusb: Add auto-detach-kernel-driver functionality
Add auto-detach-kernel-driver functionality, and a libusb_set_auto_detach_kernel_driver() function. Note that I went with a libusb_set_auto_detach_kernel_driver() function, rather then with a libusb_enable_auto_detach_kernel_driver(), so that apps can also disable it again. This is necessary to handle 2 corner cases: 1) When an app wants to do a libusb_set_configuration after claiming 1 or more interfaces, it needs to first release the interface(s), and in this case libusb_release_interface() should *not* (re-)attach the kernel driver 2) Some usb classes use multiple interfaces for one function, ie usb-audio devices do this. In this case attaching the driver will fail until all interfaces are released, so the app should first release all interfaces, and only then (re-)attach the kernel driver. auto-detach-kernel-driver functionality is still useful for these apps, since doing libusb_detach_kernel_driver() followed by libusb_claim_interface() in 2 separate calls is inherently racy, but they need to be able to disable the auto-detach functionality before releasing interfaces to be able to properly handle the 2 described corner cases. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'libusb/libusb.h')
-rw-r--r--libusb/libusb.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/libusb/libusb.h b/libusb/libusb.h
index a56a687..d7cc40f 100644
--- a/libusb/libusb.h
+++ b/libusb/libusb.h
@@ -1390,6 +1390,8 @@ int LIBUSB_CALL libusb_detach_kernel_driver(libusb_device_handle *dev,
int interface_number);
int LIBUSB_CALL libusb_attach_kernel_driver(libusb_device_handle *dev,
int interface_number);
+int LIBUSB_CALL libusb_set_auto_detach_kernel_driver(
+ libusb_device_handle *dev, int enable);
/* async I/O */