uinput-mapper/py/read.py
Merlijn Wajer 98fdbecccf Basic cloning & config.
Also fixed a few bugs and added a few features.
2013-04-21 01:46:44 +02:00

25 lines
583 B
Python

from cinput import *
import ctypes
import sys
#f = open(sys.argv[1] if len(sys.argv) == 2 else "/dev/input/event3")
f = InputDevice(sys.argv[1] if len(sys.argv) == 2 else "/dev/input/event3")
print 'Version:', f.get_version()
print f.get_name()
d = f.get_exposed_events()
for k, v in d.iteritems():
print k + ':', ', '.join(v)
while True:
ev = f.next_event()
try:
print ev.time.tv_sec, ev.time.tv_usec
s = '%s %s %d' % (rev_events[ev.type], rev_event_keys[ev.type][ev.code], ev.value)
print 'Event type:', s
except KeyError:
pass