libftdi Archives

Subject: Re: Claiming devices has no effect under Linux

From: Thomas Klose <thomas.klose@xxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Wed, 06 Oct 2010 10:15:41 +0200
Am Dienstag, den 05.10.2010, 18:14 +0200 schrieb Uwe Bonnes: 
> 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.

If this works as expected, it would solve my problem since no driver is
loaded for our device to begin with.

However, if this must be the default way to open a ftdi device which is
already attached to a driver, would you consider to re-attach the driver
if the device is closed? I think libusb_attach_kernel_driver() can do
that. This would leave the system in the original state at least.

Regards, Thomas

libftdi - see for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread