diff options
| author | Arslaan Pathan <[email protected]> | 2026-10-05 23:29:55 +1300 |
|---|---|---|
| committer | Arslaan Pathan <[email protected]> | 2026-10-05 23:29:55 +1300 |
| commit | 5734ff601eadae2d2d995244696191fc044b55f6 (patch) | |
| tree | d5f7216dd7a60225e5d3423f96a5e3cf37ffef6a /main.py | |
| parent | 71694f30d418d4f42bd24ae59e5c898412621d07 (diff) | |
| download | remote-automation-5734ff601eadae2d2d995244696191fc044b55f6.tar.xz remote-automation-5734ff601eadae2d2d995244696191fc044b55f6.zip | |
basic action mapping
Diffstat (limited to 'main.py')
| -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 |
