add better debug tool for input devices

This commit is contained in:
chrys 2017-10-01 11:30:35 +02:00
parent 24c355be43
commit f83ea85152

View File

@ -8,6 +8,15 @@ iDevices = map(evdev.InputDevice, (evdev.list_devices()))
iDevices = {dev.fd: dev for dev in iDevices} iDevices = {dev.fd: dev for dev in iDevices}
for fd in iDevices: for fd in iDevices:
print('----------------------')
dev = iDevices[fd] dev = iDevices[fd]
cap = dev.capabilities() cap = dev.capabilities()
print(dev.name,dev.leds(),'has keys:'+str(evdev.events.EV_KEY in cap),'is mouse:'+str(((evdev.events.EV_REL in cap) or (evdev.events.EV_ABS in cap)))) print('Name: ' + str(dev.name))
print('LEDs: ' + str(dev.leds()))
print('Has Keys: '+ str(evdev.events.EV_KEY in cap))
if evdev.events.EV_KEY in cap:
print('No. of keys: ' + str(len(cap[evdev.events.EV_KEY])))
print('has Key 116: ' + str(116 in cap[evdev.events.EV_KEY]))
print('Is Mouse: ' + str(((evdev.events.EV_REL in cap) or (evdev.events.EV_ABS in cap))))
print('----------------------')