Dear all, this weekend I encountered a problem with libftdi when opening multiple devices in a multithreaded application.
The programme has one thread that periodically checks if new devices have been connected. It does this by iterating over the list returned by ftdi_usb_find_all with proper VID and PID. When the first device is found, a new thread (thread A) is created and the device is opened with ftdi_usb_open_desc(handle, VID, PID, NULL, serial). Each of the devices has a unique serial number. When the second device if found, a new thread is created (thread B) and ftdi_usb_open_desc fails with error code -9 (get serial number failed). I suspect this is a permission issue since the device that comes first in the list has already been opened by thread A - multiple open of the same device is a problem). The device now owned by thread A is opened again by thread B - this fails and the error code is generated. I have changed the ftdi_usb_open_desc code to continue processing the list of devices in this case to iterate to the device with the serial number that I actually wanted to open. With this patch applied I can use multiple devices in my application. Patch against git head attached. Kind regards, Rolf -- libftdi - see http://www.intra2net.com/en/developer/libftdi for details. To unsubscribe send a mail to [email protected]
libftdi-0.2-multi-open-desc.patch
Description: Binary data
