diff options
author | Hans de Goede <hdegoede@redhat.com> | 2013-06-13 21:21:14 +0200 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2013-06-19 11:04:14 +0200 |
commit | fc51f19341af70508b94c06ff763842b396ea72e (patch) | |
tree | 0cb2d75131893603a3e4c0c456f4cefe060599ca /examples | |
parent | 6b3931526db981e3a298a226e5d0b4e20c04913d (diff) | |
download | libusb-fc51f19341af70508b94c06ff763842b396ea72e.tar.gz |
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 'examples')
0 files changed, 0 insertions, 0 deletions