On 11/24/2016 08:11 AM, jry wrote:
> I would like to ask if there is anyone who knows libftdi or libusb and would
> be able to help me identify one problem in libftdi library. In asix-sigma
> driver
> I'm reading large data blocks from FT245RL with asynchronous transfer,
> using ftdi_read_data_submit() and ftdi_transfer_data_done().
> 
> Unfortunately libftdi doesn't return with timeout when it receives smaller
> than
> required data frame. It simply hangs in ftdi_transfer_data_done():
> http://developer.intra2net.com/mailarchive/html/libftdi/2016/msg00118.html
> 
> ftdi_transfer_data_done() implementation:
> http://developer.intra2net.com/git/?p=libftdi;a=blob;f=src/ftdi.c;h=0b26a7a8b698ce201f7a11797700376db3525820;hb=HEAD#l1736

It looks like libftdi, while it does set a timeout on the async
transfer, never actually checks whether the condition occurred in the
transfer's callback.

The timeout itself is a default value, hardcoded, which cannot be
changed or configured by client code.

> I'm not familiar with libftdi and libusb libraries and any any advice would
> be most welcome.

Clearly, libftdi will not handle this situation you need to deal with.
Since libftdi is a thin and unnecessary abstraction layer on top of
libusb which provides no values other than configuring the FTDI chip
(which is trivial), I recommend getting rid of it altogether.

Simply convert the driver to libusb calls instead. You can use the
current calls to libftdi and its libusb actions as a guide, or check the
code in many other libsigrok drivers.


-- 
Bert Vermeulen
b...@biot.com

------------------------------------------------------------------------------
_______________________________________________
sigrok-devel mailing list
sigrok-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to