libftdi Archives

Subject: Re: Claiming devices has no effect under Linux

From: Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Tue, 5 Oct 2010 18:14:58 +0200
>>>>> "Uwe" == Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> writes:

>>>>> "Thomas" == Thomas Klose <thomas.klose@xxxxxxxxxxxxx> writes:

    Uwe> In your situation, however it is wrong. Ideas how to handle that
    Uwe> situation are welcome.

To clarify the situation.
Device gets plugged, ftdi_sio gets loaded.
First libftdi open calls libusb_detach_kernel_driver() and gets access.
Second libftdi open calls calls again libusb_detach_kernel_driver() and gets
access too.

First try: Make the call to libusb_detach_kernel_driver() 
dependant if a kernel driver is loaded:
+ if (libusb_kernel_driver_active(ftdi->usb_dev, ftdi->interface) == 1)
    if (libusb_detach_kernel_driver(ftdi->usb_dev, ftdi->interface) !=0)
        detach_errno = errno;

This doesn't help, as the second open sees "usbfs" as a valid kernel driver
loaded.

I just sent a patch to libusb-devel, that checks in
libusb_kernel_driver_active() for itself ("usbfs") and returns another
value, so that above libftdi patch works as expected.

Bye 
-- 
Uwe Bonnes                bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread