libftdi Archives

Subject: libftdi 0.x thread recommendations

From: "Spindler, Tyler L" <TLSpindler@xxxxxxxxxxxxxxxxx>
To: "libftdi@xxxxxxxxxxxxxxxxxxxxxxx" <libftdi@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 19 Apr 2012 15:47:59 +0000
I have written a program using bit bang mode for the libftdi library. It has 2 
threads. One runs all the time and reads data using ftdi_read_data function 
call. The second thread, based on program logic, will occasionally call 
ftdi_write_data.

This has worked reasonable well. However, after many, many months of run time, 
I have experienced the communication to the chipset fail on a ftdi_write_data 
call. When it does occur, all interaction with the libftdi library to fails. 
dmesg reports this each time the application tries to interact with the library:

usb 1-1: usbfs: USBDEVFS_CONTROL failed cmd cProtocolGatewa rqt 64 rq 0 len 0 
ret -145

The only resolve has been to unplug the USB device and bounce the kernel 
modules or reboot the system. This is not desirable.

Is there a way to prevent this error? Am I violating the rules since I have 
read that libusb 0.1 / libftdi 0.x are not thread safe? Any recommendations on 
different techniques / function calls to use inside the 2 threads? I'd prefer 
to continue to use the 0.x version of the library.

Let me know if you need any additional information. Any help would be 
appreciated. Thanks!

Tyler

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

Current Thread