libftdi Archives

Subject: Re: Multiple interface issues

From: Steve Soloski <ssoloski@xxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Sat, 31 May 2014 15:52:59 -0400
On 05/30/2014 09:32 PM, Xiaofan Chen wrote:
On Fri, May 30, 2014 at 10:17 PM, Steve Soloski <ssoloski@xxxxxxxxxxxxxx> wrote:
Well, after banging my head against the wall all day yesterday, I've figured
out what's happening...

In all of my installing/uninstalling of the USB driver - trying both
libusbK-inf-wizard and zadig - I eneded up with both libusb0.dll and
libusbK.dll on my system, in addition to the WinUSB that I wanted. Not quite
sure how they all got installed, but when I deleted both of them (and only
used the WinUSB driver) then this issue went away. Not sure what was causing
the issue, but at least it's resolved!

Hmm, that is strange. libusbk-inf-wizard and Zadig both install libusb0.dll
and libusbK.dll to be compatible with libusb-win32 and libusbK.

As for libusb Winodws backend, it will work either with libusbK.dll (to
support libusb0.sys, libusbK.sys and WinUSB) or without libusbK.dll
(only works with WinUSB). The code path will be a bit different.

Are you using the latest release version of libusb (1.0.18)?




Just rebuilt libusb (1.0.18) and libFTDI (1.1) from the tarballs; cross compiling on Linux using x86_64-w64-mingw32.

Same result when running under Win8 x64 - if libusbK.dll is in my path then I get the following error when trying to open the device more than 32 times:

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...
ftdi_usb_open failed: -5 (unable to claim usb device. Make sure the default FTDI driver is not in use)

However, I noticed something interesting...

When I try to connect to my device I always use Interface B first (it's my control channel and needed to init my device); Interface A is only used (in a separate thread) when trying to capture images. So, trying to open my device like this:

    for (i=0; i<50; i++) {
      struct ftdi_context *ftdi = ftdi_new();
      ftdi_set_interface(ftdi, INTERFACE_B);

      fprintf(stderr, "opening device %d of 50...\n", i);
      ret = ftdi_usb_open(ftdi, 0x0403, 0x7C38);
        ...
      ret = ftdi_usb_close(ftdi);
      ftdi_free(ftdi);
    }


will fail after 32 open/closes with the error above.

However, I just tried not setting the interface to B and it works fine and doesn't fail - even with libusbK.dll! Seems like there's something about not having Interface A claimed that is causing issues... of course, since I always open with B that doesn't do me much good! ;)


Steve


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