I have an interesting challenge.
I have been given a device (a piece of hardware) to write a Linux driver for (for kernel 2.6.17). It is a custom device for an embedded computer.
The device has a few intended functions, all using the parallel port:
1) Monitor Special Bits
a) Signal to the application (in user space) that a hardware interrupt has occurred,
by the nAck bit interrupt
b) Allow the application to read the 'nError' and 'Paper Out' bits, by polling them, at the applications leisure
2) Communicate on a two wire interface (TWI, or I2C) bus via two parallel port data pins
3) Communicate / Operate a watchdog chip using some of the remaining parallel port data bits
I think I could signal to the user space application that an interrupt has occurred by having the application do a blocking read call on the device driver. When the interrupt happens, then the read call can return.
The rest of the data being read / written could be done using ioctl calls.
Am I wrong? Do you have any suggestions?
Sounds good
Your kernel-to-userspace communication of Interrupts using a blocking read, and polling ioctl calls is exactly how we are doing things for the driver we are currently writing. I have asked many people and this seems to be the most appropriate method :)