libftdi Archives

Subject: Re: patch to libftdi-1.0 git head, fix opening of multiple devices

From: derRolf@xxxxxxxxxxxxxx
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Tue, 05 Feb 2013 18:42:47 +0100
Am 05.02.13 15:28, schrieb Thomas Jarosch:
Hi Rolf,

On Thursday, 17. January 2013 22:49:53 derRolf@xxxxxxxxxxxxxx wrote:
thanks for your thoughts. Yes, we have our own VID/PID. However, our
software needs to operate multiple devices with the same VID/PID
(multi-threaded). The only difference between the devices is the serial
number, which is unique for each device. We have settings and
configuration data for the devices, which applies to the specific device
(i.e. serial number). Depending on the serial number (i.e. device type)
we boot different FPGA bitstreams.

Actually I don't think any application could be broken by the patch. If
the device is not found, the code still returns the error. It's just
that right now the search for the device ends if another device that
comes first in the list has already been opened. From my point of view
this is a bug (but one that only happens if you play with multiple
devices from the same process).

I understand that you don't want to apply any changes before the 1.0
release. That's fine, I don't use the release code but the git head. But
it would be good if the patch could be applied after the release is out.
Right now we have patched our git clone and are merging on each pull
from upstream.
I've taken a close look at the code in ftdi_usb_open_desc_index().
If I apply your patch in the current form, the -8 and -9 error code
will stop to work.

This can be a problem if there's a permission issue reading
the string descriptors, the function will always return
-3: "device not found" instead of -8 or -9.

How about using ftdi_usb_find_all() to get a list of all your devices.
Then you can try to get the strings via ftdi_usb_get_strings()
and if you f.e. get a serial the device is not in use.

Would that work?

Otherwise we need to come up with a different solution.

Thomas
Thanks for this proposal, I will try that. It may take some day but I will post my findings.

Rolf

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