|
From: Uwe B. <bo...@el...> - 2010-10-06 17:08:20
|
>>>>> "Alan" == Alan Stern <st...@ro...> writes:
Alan> On Wed, 6 Oct 2010, Xiaofan Chen wrote:
...
>> If there is a kernel driver attached to the USB device (an
>> interface), then libusb_claim_interface() should fail. And this is
>> consistent with my view that "usbfs" is not a kernel driver in the
>> context of libusb.
Alan> If another program has claimed an interface, then
Alan> libusb_claim_interface() _will_ fail.
But
libusb_detach_kernel_driver()
libusb_claim_interface()
will succeed.
It would be a good thing, if we could distinguish if the kernel driver is
usbfs or something else. For libftdi, we could unload ftdi_sio, that was
nearly always loaded when the device was plugged in, but stop the
application when some other libusb application already claimed the device.
Libusb-0 usb_get_driver_np() exposed the kernel driver name to the
user, libusb-1 doesn't. My proposed patch wouldn't reimplement
usb_get_driver_np but changed the return value of
libusb_kernel_driver_active(). But it was only a proposal,
libusb_kernel_driver_active() could perhaps also return the name.
This procedure has known races, but probably thats the price to pay for
user space versus a kernel driver.
Please let me know if I should work out the problem deeper.
Bye
--
Uwe Bonnes bo...@el...
Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
|