From f83ea851525c9d2f8d1e05a1ce28e0502b1e876c Mon Sep 17 00:00:00 2001 From: chrys Date: Sun, 1 Oct 2017 11:30:35 +0200 Subject: [PATCH] add better debug tool for input devices --- play zone/listDevices.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/play zone/listDevices.py b/play zone/listDevices.py index 18f7bcd9..b24a366d 100755 --- a/play zone/listDevices.py +++ b/play zone/listDevices.py @@ -8,6 +8,15 @@ iDevices = map(evdev.InputDevice, (evdev.list_devices())) iDevices = {dev.fd: dev for dev in iDevices} for fd in iDevices: + print('----------------------') dev = iDevices[fd] 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('----------------------') +