aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArslaan Pathan <[email protected]>2026-10-05 23:16:42 +1300
committerArslaan Pathan <[email protected]>2026-10-05 23:16:42 +1300
commit4683da385843dd2f2a397555370445217871e513 (patch)
treefeba73a9125e34e8801abca67ce8dc87973088c5
parent91e944bc70736ec10816f401ab4a2172624f2aff (diff)
downloadremote-automation-4683da385843dd2f2a397555370445217871e513.tar.xz
remote-automation-4683da385843dd2f2a397555370445217871e513.zip
autodetect
-rw-r--r--main.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/main.py b/main.py
index e085ec9..c2d114f 100644
--- a/main.py
+++ b/main.py
@@ -1,9 +1,18 @@
-from evdev import InputDevice, ecodes
+from evdev import InputDevice, list_devices
-device = InputDevice("/dev/input/event0")
+device = None
+
+for path in list_devices():
+ candidate = InputDevice(path)
+
+ if candidate.name == "meson-ir":
+ device = candidate
+ break
+
+if device is None:
+ raise RuntimeError("meson-ir input device not found")
print(f"Listening on {device.path}: {device.name}")
for event in device.read_loop():
- if event.type == ecodes.EV_MSC and event.code == ecodes.MSC_SCAN:
- print(f"Scancode: {event.value:#x}")
+ print(event)