aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArslaan Pathan <[email protected]>2026-10-05 23:29:55 +1300
committerArslaan Pathan <[email protected]>2026-10-05 23:29:55 +1300
commit5734ff601eadae2d2d995244696191fc044b55f6 (patch)
treed5f7216dd7a60225e5d3423f96a5e3cf37ffef6a
parent71694f30d418d4f42bd24ae59e5c898412621d07 (diff)
downloadremote-automation-5734ff601eadae2d2d995244696191fc044b55f6.tar.xz
remote-automation-5734ff601eadae2d2d995244696191fc044b55f6.zip
basic action mapping
-rw-r--r--main.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/main.py b/main.py
index 27066e2..b0de076 100644
--- a/main.py
+++ b/main.py
@@ -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