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 21:00:53 +0800
On Tue, May 18, 2010 at 8:46 PM, Xiaofan Chen <xiaofanc@xxxxxxxxx> wrote:

> I was also thinking the codes in libftdi is better. But then I am not
> sure why the they are enclosed by the __WIN32__ ifdef. In
> this case, the code does not really help. On the other hand,
> Windows user will probably puzzled by the error message
> about permission and ftdi_sio. ;-)
>
> So I think the codes in libftdi also needs to be changed.
>
> #ifdef LIBUSB_HAS_GET_DRIVER_NP
>    // Try to detach ftdi_sio kernel module.
>    // Returns ENODATA if driver is not loaded.
>    //
>    // The return code is kept in a separate variable and only parsed
>    // if usb_set_configuration() or usb_claim_interface() fails as the
>    // detach operation might be denied and everything still works fine.
>    // Likely scenario is a static ftdi_sio kernel module.
>    if (usb_detach_kernel_driver_np(ftdi->usb_dev, ftdi->interface) !=
> 0 && errno != ENODATA)
>        detach_errno = errno;
> #endif
>

BTW, libusb-compat-0.1 wrongly returned ENOENT
in this case and not ENODATA. So libftdi may not
work well with libusb-compat-0.1 under Linux.
http://old.nabble.com/libusb-compat-0.1-error-return-code-td28595290.html

I remember there were reports that libftid did not
work with libusb-compat-0.1 but I am not sure if
things have changed on this topic. I forgot the
exact reason. Many distros are starting to drop
libusb-0.1 and use libusb-1.0/libusb-compat-0.1.
Ububtu/Debian are still providing libusb-0.1 though.


-- 
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