libftdi Archives

Subject: Non-blocking read

From: "Anton A. Litvinov" <mirteney@xxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Thu, 9 Sep 2010 10:29:42 +0600
Hello
I want to write a program in a non-blocking manner with
polling of several descriptors, namely usb-device and stdin.

The following code taken from  it is libusb-1.0 documentation,
"polling and timing".
Is it possible to apply this scheme to libftdi ?
What difficulties might arise?

// initialise libusb
libusb_get_pollfds(ctx)
while (user has not requested application exit) {
    poll(on libusb file descriptors plus any other event sources of interest,
        using any timeout that you like)
    if (poll() indicated activity on libusb file descriptors)
        libusb_handle_events_timeout(ctx, 0);
    // handle events from other sources here
}
// clean up and exit



-- 
With best regards.
Anton
E-mail: mirteney@xxxxxxxxx
Jabber: solmir@xxxxxxxxx

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

Current Thread