linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* select() on /dev/input/eventX not level-triggered?
@ 2011-05-19 23:50 Pavel Machek
  2011-05-23 18:13 ` Dmitry Torokhov
  0 siblings, 1 reply; 5+ messages in thread
From: Pavel Machek @ 2011-05-19 23:50 UTC (permalink / raw)
  To: kernel list, linux-input

Hi!

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
an idea?

								Pavel

#!/usr/bin/python
# Thanks to mechomaniac.com
# GPLv2
# Copyright 2011 Pavel Machek

import struct
import time
import select
import os
import random

#
# format of the event structure (int, int, short, short, int)
inputEventFormat = 'iihhi'
inputEventSize = 16
file = open("/dev/input/event5", "rb") # standard binary file input
while 1:
  ( i, o, e ) = select.select( [file], [], [], 0.5 )
  if i == []:
    print "timeout event"
    continue
  event = file.read(inputEventSize)
  time.sleep(1)
  (time1, time2, type, code, value) = struct.unpack(inputEventFormat, event)
  print "type ", type, " code ", code, " value ", value

file.close()


-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-05-23 21:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-19 23:50 select() on /dev/input/eventX not level-triggered? Pavel Machek
2011-05-23 18:13 ` Dmitry Torokhov
2011-05-23 20:06   ` Pavel Machek
2011-05-23 20:49     ` Dmitry Torokhov
2011-05-23 21:20       ` Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).