On Tue, May 18, 2010 at 8:37 PM, Uwe Bonnes
> libftdi stores the result of usb_detach_kernel_driver_np and checks and
> reports EPERM with usb_set_configuration() and usb_claim_interface(). The
> messages seem quite hintfull for plain users.
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.
BTW, as one of the new admin of libusb-win32, I think we have
already made the usb_set_configuration() not necessary
in the SVN version of libusb-win32. And I believe the
NULL pointer issue has also been solved.
// 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;
// set configuration (needed especially for windows)
// tolerate EBUSY: one device with one configuration, but two interfaces
// and libftdi sessions to both interfaces (e.g. FT2232)
if (dev->descriptor.bNumConfigurations > 0)
// libusb-win32 on Windows 64 can return a null pointer for a
config_val = dev->config.bConfigurationValue;
if (usb_set_configuration(ftdi->usb_dev, config_val) &&
errno != EBUSY)
if (detach_errno == EPERM)
ftdi_error_return(-8, "inappropriate permissions on device!");
ftdi_error_return(-3, "unable to set usb
configuration. Make sure ftdi_sio is unloaded!");
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx