libftdi Archives

Subject: Re: Any reason to call usb_set_configuration()

From: Xiaofan Chen <xiaofanc@xxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Thu, 23 Jul 2009 22:51:52 +0800
On Thu, Jul 23, 2009 at 10:25 PM, Uwe
Bonnes<bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

> working with interface 0 of the FT2232(H) on Linux, I get zillions of
> kernel-log messages like:
>
> kernel: usb 6-3: usbfs: interface 1 claimed by ftdi_sio while 'a.out' sets 
> config #1
>
> I understand as follows:
> ftdi_usb_open_dev()
> first detaches the driver for interface 0
> Now  usb_set_configuration() is called, but interface 1 is still attached to
> the kernel driver. This results in above kernel log.

Just wondering why not detach both interfaces? Or better give the user
an option to detach the interfaces he wants to detach (so that
he can use the other interface as UART).

> Do we really need to set the configuration? Does any device have a
> alternative configuration at all?

There are device with more than one configuration. But I do not
know of any FTDI device with more than one configuration.

Under Windows, the default libusb-win32 device driver does not
set configuration, therefore, usb_set_configuration() is necessary.

Under Linux, this is normally not necessary since the kernel usb
layer will do this for you. Unless you manually unconfig the
device (echo 0>/sys/bus/usb/devices/.../bConfigurationValue).

> I propose appended patch, tested on Linux with and without ftdi_sio.ko
> loaded. No other change seen, beside no more kernel log messages like above.
>

I believe the patch should work for Linux. Maybe also BSDs. I have
no experiences with Mac OS X.

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