That's strange. Then how is the ioctl(fd, FIONREAD, &bytes); implemented in the kernel driver? That seems to be working fine, and it reads the number of bytes available...
Regards, Ákos Vandra On 14 November 2011 11:00, Uwe Bonnes <[email protected]> wrote: >>>>>> "Akos" == Akos Vandra <[email protected]> writes: > > Akos> Hi! I am tryingo to use an FT2232 chip in UART mode. I would like > Akos> to write a function that reads the queued buffer from the chip, if > Akos> there are bytes available, and return with no data if there are no > Akos> bytes to be read. (Non-blocking). To do this I guess I would need > Akos> some mechanism to test how many bytes are available. Is there such > Akos> a funciton in libftdi? > > The Chip itself has no such function. > > To do what you want, you have to run like libftd2xx: > - Start one thread to continously read the device with a given timeout and > write to a buffer > - Now your main program can read non-blocking from the buffer in the other > thread. > > Bye > -- > Uwe Bonnes [email protected] > > Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt > --------- Tel. 06151 162516 -------- Fax. 06151 164321 ---------- > > -- > libftdi - see http://www.intra2net.com/en/developer/libftdi for details. > To unsubscribe send a mail to [email protected] > > -- libftdi - see http://www.intra2net.com/en/developer/libftdi for details. To unsubscribe send a mail to [email protected]
