libftdi Archives

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

From: derRolf@xxxxxxxxxxxxxx
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Thu, 17 Jan 2013 22:49:53 +0100
Am 17.01.13 14:32, schrieb Thomas Jarosch:
Hello Rolf,

On Thursday, 17. January 2013 08:06:15 derRolf@xxxxxxxxxxxxxx wrote:
I had sent this patch again at the end of last year. It is needed to open
multiple devices from a single process. The problem is that when in the
list of devices a device at the start of the list has already been
opened, the reading of device parameters for the already opened device
fails. Currently the list is then not traversed any further and open
returns with an error. The patch changes that so the list of devices is
searched for the device to open until the list end.

Please apply or comment.
Thanks for the patch. I see what you are trying to do :)

The problem is that the patch heavily modifies the current behavior.
So this is not something to rush in before the final 1.0 release,
at least in the current form.

If some existing code expects the function to fail,
it will no longer work correctly.

Do you have an own PID/VID for your USB device?
Then you don't need to pass the "description"
and "serial" buffer in there and it would
work with the current code of libftdi.

Other ideas?

Thomas
Hello Thomas,

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.

Rolf


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