From 44406cef0601eeab187d1012f2e482d95a3817f3 Mon Sep 17 00:00:00 2001 From: chrys Date: Wed, 19 Oct 2016 16:55:38 +0200 Subject: [PATCH] change debugging again --- tools/traceEvdev.py | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/tools/traceEvdev.py b/tools/traceEvdev.py index 911960c3..80a35a1b 100755 --- a/tools/traceEvdev.py +++ b/tools/traceEvdev.py @@ -5,23 +5,14 @@ from select import select import time #devices = map(evdev.InputDevice, (evdev.list_devices())) -devices = map(evdev.InputDevice, (['/dev/input/event0','/dev/input/event1','/dev/input/event10','/dev/input/event11','/dev/input/event12','/dev/input/event14','/dev/input/event15','/dev/input/event2','/dev/input/event3','/dev/input/event4','/dev/input/event5','/dev/input/event7','/dev/input/event8','/dev/input/event9'])) -devicesNew = {} -for dev in devices: - try: - devicesNew[dev.fd] = dev - print('DONE: Devicename:'+ devicesNew[dev.fd].name + ' Devicepath:' + devicesNew[dev.fd].fn ) - except Exception as e: - print('ERROR:'+ ' ' + str(e) ) - -for fd in devicesNew: - print('Devicename:'+ devicesNew[fd].name + ' Devicepath:' + devicesNew[fd].fn ) +devices = map(evdev.InputDevice, (['/dev/input/event10'])) +devices = {dev.fd: dev for dev in devices} + +while True: + r, w, x = select(devices, [], []) + if r != []: + for fd in r: + for event in devices[fd].read(): + print('Devicename:'+ devices[fd].name + ' Devicepath:' + devices[fd].fn + ' Events:' + str(devices[fd].active_keys(verbose=True)) + ' Value:' + str(event.value)) -#--- log events--- -#while True: -# r, w, x = select(devices, [], []) -# if r != []: -# for fd in r: -# for event in devices[fd].read(): -# print('Devicename:'+ devices[fd].name + ' Devicepath:' + devices[fd].fn + ' Events:' + str(devices[fd].active_keys(verbose=True)) + ' Value:' + str(event.value))