select() on /dev/input/eventX not level-triggered?
From: Pavel Machek
Date: Thu May 19 2011 - 19:50:59 EST
I'm debugging strange behaviour on /dev/input/eventX ... it seems that
select is not behaving level-triggered as it apparently should. I can
reproduce it when hitting windows & alt keys.
Now, I really should rewrite it into C, first, but perhaps someone has
# Thanks to mechomaniac.com
# Copyright 2011 Pavel Machek
# format of the event structure (int, int, short, short, int)
inputEventFormat = 'iihhi'
inputEventSize = 16
file = open("/dev/input/event5", "rb") # standard binary file input
( i, o, e ) = select.select( [file], , , 0.5 )
if i == :
print "timeout event"
event = file.read(inputEventSize)
(time1, time2, type, code, value) = struct.unpack(inputEventFormat, event)
print "type ", type, " code ", code, " value ", value
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/