FTDI user space on Windows

Bill Perry bill at billandterrie.com
Thu Sep 13 11:44:14 PDT 2018


Just a reminder that last summer I saw that the code in serial_ftdi_read() doesn't guarantee that a timeout occurs
in the desired timeout period.
Due to the way it is written, you can get MUCH longer delays when the bytes don't stream in right away or
This was an issue I was fighting last year when I was trying to get retries to work on the Pelagic data cable with Android.
It actually affects any ftdi device.
This is likely an issue on Windows as well.

ftdi_read_data() took a few milliseconds of time before returning and that time is not accounted for.
And on android the the LIBUSB_ERROR_INTERRUPTED was also happening.
This caused the while loop to loop for several minutes before timing out.
My solution (which I posted a patch for to the list back in Nov 2017) was to get rid of slept and to always sleep for 1ms.
Then rather than comparing slept >= timeout - which doesn't work, was to use gettimofday()
to check for the elapsed time to check for the desired timeout period.

--- bill



-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3996 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20180913/bd16bfe7/attachment.bin>


More information about the subsurface mailing list