From 4683da385843dd2f2a397555370445217871e513 Mon Sep 17 00:00:00 2001 From: Arslaan Pathan Date: Mon, 5 Oct 2026 23:16:42 +1300 Subject: autodetect --- main.py | 17 +++++++++++++---- 1 file 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) -- cgit v1.2.3