libftdi Archives

Subject: Re: Question about ftdi_read_data().

From: Jie Zhang <jzhang918@xxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Wed, 20 Jan 2010 23:22:18 +0800
On Wed, Jan 20, 2010 at 9:03 PM, Teunis van Beelen <teuniz@xxxxxxxxx> wrote:
> I started to implement libftdi on Linux. Everything seems to work
> sofar except for one thing.
>
I think you meant "implement (your application using) libftdi". ;-)

> It seems that the function ftdi_read_data() blocks till it has
> received the requested amount of bytes.
> I don't like this behaviour, I would like it to return immediately. Is
> it possible to change this behaviour?
>
> Is it possible to get the number of bytes in the receivebuffer so that
> I can use this number in the call
> to ftdi_read_data()?
>
> In my program, ftdi_read_data() is called from a timer so a
> non-blocking read-function is what I need.
> Using threads is not an option.
>
I would suggest to take a look at functions surrounded by
LIBFTDI_LINUX_ASYNC_MODE in libftdi. Of if you are brave enough, you
can try out

http://developer.intra2net.com/git/?p=libftdi-1.0

which also supports async read using libusb-1.0 API. But it in early stage now.


Jie

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

Current Thread