libftdi Archives

Subject: [Patch][RFC]read with timeout

From: Thomas Heller <theller@xxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Mon, 21 May 2012 20:27:01 +0200
The behaviour of the ftdi_read_data function is not so well defined
(IMO, no offense intended).  It loops calling usb_bulk_read(), collects
all the data, until the requested number of bytes have been transfered;
but it also returns when the usb_bulk_read() call didn't return any
data.

For my application, I would prefer the behaviour of the original FTDI
d2xx dll: the read() call returns when either the requested number of
bytes have been transferred or when the read-timeout has expired.

Here is a patch which implements a ftdi_read_data_timeout() function
that also has this behaviour.  The patch only works on Windows since
it GetTickCount() api call.

Is it worth to consider this extension for the official repository?

Thanks,
Thomas



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

Attachment: libftdi.patch
Description: Text document

Current Thread