fenrir/tools/traceEvdev.py

27 lines
855 B
Python
Raw Normal View History

2016-08-09 20:09:49 -04:00
#!/bin/python
2016-08-09 17:32:15 -04:00
import evdev
from evdev import InputDevice
from select import select
import time
devices = map(evdev.InputDevice, (evdev.list_devices()))
2016-10-19 10:15:37 -04:00
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 )
2016-08-09 17:32:15 -04:00
2016-10-19 07:06:57 -04:00
#--- 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))
2016-08-09 17:32:15 -04:00