libftdi Archives

Subject: Re: (Corrected)In linusb-1.0, libusb_detach_kernel_driver is available unconditional

From: Xiaofan Chen <xiaofanc@xxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Tue, 18 May 2010 19:43:53 +0800
On Tue, May 18, 2010 at 7:40 PM, Thomas Jarosch
<thomas.jarosch@xxxxxxxxxxxxx> wrote:
> On Tuesday, 18. May 2010 13:32:39 Uwe Bonnes wrote:
>> Sorry, next time I will compiled before sending the patch...
>>
>> The variable "ret" in the #ifdef'ed code was missing. Appended code now
>> defines this variable.
>> -
>
> Hmm. I guess we should also ignore the "LIBUSB_ERROR_NOT_SUPPORTED"
> error code to make this work. Otherwise ftdi_usb_open_dev() will abort...
>
> Thomas
>

That is exactly right. And I think failure to detach the kernel driver is
quite normal (eg: you already run libftdi once and the kernel driver
is already detached) and should not return error. A warning is enough.

    ret = libusb_detach_kernel_driver(ftdi->usb_dev, ftdi->interface);
    if (ret < 0 && ret != LIBUSB_ERROR_NOT_FOUND)
        ftdi_error_return(-11, "libusb_detach_kernel_driver () failed");



-- 
Xiaofan http://mcuee.blogspot.com

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

Current Thread