diff options
| -rw-r--r-- | main.py | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -1,8 +1,14 @@ from evdev import InputDevice, list_devices, ecodes +SCANCODES = {0x11A: "up", 0x148: "down", 0x147: "left", 0x107: "right", 0x106: "ok"} + device = None last = 0x00 +def do_action(action: str): + if action == "ok": + print("ok") + for path in list_devices(): candidate = InputDevice(path) @@ -21,7 +27,9 @@ try: if (event.value != last): print(f"scancode {event.value:#x}") last = event.value - # Do logic here + action = SCANCODES.get(event.value) + if action: + do_action(action) else: print(f"repeat scancode {event.value:#x}") last = 0x00 |
