From b74d3e265067019537124b9f39a16295cf514d13 Mon Sep 17 00:00:00 2001 From: Arslaan Pathan Date: Mon, 5 Oct 2026 23:21:05 +1300 Subject: repeat detection --- main.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index c2d114f..462ad48 100644 --- a/main.py +++ b/main.py @@ -1,6 +1,7 @@ -from evdev import InputDevice, list_devices +from evdev import InputDevice, list_devices, ecodes device = None +last = 0x00 for path in list_devices(): candidate = InputDevice(path) @@ -15,4 +16,11 @@ if device is None: print(f"Listening on {device.path}: {device.name}") for event in device.read_loop(): - print(event) + if event.type == ecodes.EV_MSC and event.code == ecodes.MSC_SCAN: + if (event.value != last): + print(f"scancode {event.value:#x}") + last = event.value + # Do logic here + else: + print(f"repeat scancode {event.value:#x}") + last = 0x00 -- cgit v1.2.3