libftdi Archives

Subject: Re: Multiple interface issues

From: Xiaofan Chen <xiaofanc@xxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Sun, 1 Jun 2014 09:06:52 +0800
On Thu, May 29, 2014 at 7:18 AM, Steve Soloski <ssoloski@xxxxxxxxxxxxxx> wrote:
> Hi,
>
> I've got a device that uses a FT2232H chip; and our application uses both
> interfaces - INTF1 to control the device (I2C and GPIO), and INTF0 to send
> image data to the host. I'm doing some unit testing under Win8.1 x64, and am
> using the WinUSB driver with an INF file generated from libusbK-inf-wizard.
>
> My test is fairly simple - open and close the device 50 times. The logic is
> very straightforward (error checking removed for clarity):
>
>     for (i=0; i<50; i++) {
>         struct ftdi_context *dev = ftdi_new();
>         ftdi_set_interface(dev, INTERFACE_B);
>
>         ftdi_usb_open(dev, PICAM_USB_VID, PICAM_USB_PID);
>         ftdi_usb_close(dev);
>         ftdi_free(dev);
>     }
>
> Depending on how my WinUSB driver is configured, different things happen:
>
> - with WinUSB configured to point to my composite device (ie DeviceID =
> "VID_0403&PID_7C38"), this fails after 32 iterations (way down in the guts
> of libusb - basically after 32 iterations it runs out of valid interfaces).
>
> - with WinUSB configured with two interfaces (ie DeviceID_0 =
> "VID_0403&PID_7C38&MI_00" and DeviceID_1 = "VID_0403&PID_7C38&MI_01"), this
> run without any issues.
>
> The problem I'm having is that if the WinUSB driver is configured with two
> interfaces, then I can't access both interfaces simultaneously - the only
> way I've been able to do that is to have the driver configured for the
> composite device.
>
> Is this a bug, or am I missing something in how to configure and talk to two
> interface?
>
> Any help or ideas would be appreciated!
>

BTW, I can not reproduce your issue under Windows 8 with libusb-1.0.18
and libusbK 3.0.7.0 (both latest relese version) with your minimum
program under Windows 8.1 x64 using MinGW-w64 compiler.

The minimum program does not have USB I/O communication
so that you do not need even need to install a supported driver in order
for it to work under Windows (even using the Vendor driver will work).
And no matter how I install the driver (libusbk.sys or winusb,
composite device parent or individual interface), it will work.

Are you sure you are seeing the issue with the above minimum
code snippets?


$ cd /c/work/libftdi/test/

$ ls
maketest.sh  testlibftdi  testlibftdi.c  testlibftdi.exe

$ cat testlibftdi.c

#include <stdio.h>
#include <stdlib.h>
#include <ftdi.h>

int main(void)
{
        int i;
        for (i=0; i<50; i++) {
        struct ftdi_context *dev = ftdi_new();
        ftdi_set_interface(dev, 1);
                fprintf(stderr, "opening device %d of 50...\n", i);
        ftdi_usb_open(dev, 0x0403, 0xcff8);
        ftdi_usb_close(dev);
        ftdi_free(dev);
    }
}


$ cat maketest.sh
gcc $(pkg-config --cflags libftdi1) $(pkg-config --libs libftdi1)  -o
testlibftdi testlibftdi.c


$ ./testlibftdi.exe
opening device 0 of 50...
opening device 1 of 50...
opening device 2 of 50...
opening device 3 of 50...
opening device 4 of 50...
opening device 5 of 50...
opening device 6 of 50...
opening device 7 of 50...
opening device 8 of 50...
opening device 9 of 50...
opening device 10 of 50...
opening device 11 of 50...
opening device 12 of 50...
opening device 13 of 50...
opening device 14 of 50...
opening device 15 of 50...
opening device 16 of 50...
opening device 17 of 50...
opening device 18 of 50...
opening device 19 of 50...
opening device 20 of 50...
opening device 21 of 50...
opening device 22 of 50...
opening device 23 of 50...
opening device 24 of 50...
opening device 25 of 50...
opening device 26 of 50...
opening device 27 of 50...
opening device 28 of 50...
opening device 29 of 50...
opening device 30 of 50...
opening device 31 of 50...
opening device 32 of 50...
opening device 33 of 50...
opening device 34 of 50...
opening device 35 of 50...
opening device 36 of 50...
opening device 37 of 50...
opening device 38 of 50...
opening device 39 of 50...
opening device 40 of 50...
opening device 41 of 50...
opening device 42 of 50...
opening device 43 of 50...
opening device 44 of 50...
opening device 45 of 50...
opening device 46 of 50...
opening device 47 of 50...
opening device 48 of 50...
opening device 49 of 50...

$ uname
MINGW32_NT-6.2

-- 
Xiaofan

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

Current Thread