[Linux-parport] getting read(2) to timeout

Theodore A. Roth troth at openavr.org
Fri Aug 13 13:08:39 EDT 2004


I'm writing a user-space application for communicating with a home made
device via ppdev using EPP mode. If my device is present and powered up,
read(2) works fine, otherwise read(2) blocks.

Is there any way to have read(2) timeout so I can have the application
either give up or try something else? I have tried using the PPSETTIME
ioctl command, but obviously that is not doing what I want.

The only thing I can think of doing is to open(2) the device with
O_NONBLOCK, then catch the read(2) failure and retry a few times before
giving up.

I'm developing this on a debian system with a 2.6.6-1-686 kernel.


Ted Roth
PGP Key ID: 0x18F846E9
Jabber ID: troth at jabber.org

More information about the Linux-parport mailing list