aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArslaan Pathan <[email protected]>2026-10-05 23:21:05 +1300
committerArslaan Pathan <[email protected]>2026-10-05 23:21:05 +1300
commitb74d3e265067019537124b9f39a16295cf514d13 (patch)
tree49dfea2311df59de29642500566f80bc59192755
parent4683da385843dd2f2a397555370445217871e513 (diff)
downloadremote-automation-b74d3e265067019537124b9f39a16295cf514d13.tar.xz
remote-automation-b74d3e265067019537124b9f39a16295cf514d13.zip
repeat detection
-rw-r--r--main.py12
1 files 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