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
|
|
|
|
|
2016-10-19 13:52:36 -04:00
|
|
|
devices = map(evdev.InputDevice, (evdev.list_devices()))
|
2016-10-19 10:55:38 -04:00
|
|
|
devices = {dev.fd: dev for dev in devices}
|
|
|
|
|
2016-10-22 14:27:58 -04:00
|
|
|
for fd in devices:
|
|
|
|
for i in devices[fd].capabilities(True):
|
|
|
|
print(devices[fd].fn,devices[fd].name,i)
|
2016-10-19 10:55:38 -04:00
|
|
|
while True:
|
|
|
|
r, w, x = select(devices, [], [])
|
|
|
|
if r != []:
|
|
|
|
for fd in r:
|
|
|
|
for event in devices[fd].read():
|
2016-12-17 18:10:08 -05:00
|
|
|
print('Devicename:'+ devices[fd].name + ' Devicepath:' + devices[fd].fn + ' EventType: ' + str(event.type) + ' Events:' + str(devices[fd].active_keys(verbose=True)) + ' Value:' + str(event.value))
|
2016-08-09 17:32:15 -04:00
|
|
|
|
|
|
|
|