Hi,
I'm trying to reuse 'short' sample driver found in ldd2 that handles read/write on parallel port for my small app.
I've connected opto encoder to two status pins (select and paperOUT) on lpt port. With small & dumb userland app I'm able to select() and read() value from status port by opening /dev/short1 and reading one byte. What happens is that select() returns immediately giving me status register contents as fast as it can, producing big overhead. What I would like to see is that select() returns _only_ upon register content change (impacted by turning encoder knob).
Doing this kind of checking in userland hogs my cpu on 100%, so I guess solution lies in my drivers read() function.
Is this doable by simply checking new read value against one just read, and ignoring it if its the same, or is there some other mechanism/procedure that can be used?
thanx, h
-- hinko <dot> kocevar <at> iskramedical <dot> si Hinko Kocevar, developer Iskra Medical d.o.o., Stegne 23, 1k LJ, SLO-EU
"AÃ rÃn" | [Analects XII:22]
-- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/