fenrir/tools/traceEvdev.py
2016-10-19 13:06:57 +02:00

20 lines
637 B
Python
Executable File

#!/bin/python
import evdev
from evdev import InputDevice
from select import select
import time
devices = map(evdev.InputDevice, (evdev.list_devices()))
devices = {dev.fd: dev for dev in devices}
for fd in devices:
print('Devicename:'+ devices[fd].name + ' Devicepath:' + devices[fd].fn )
#--- 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))