diff options
| author | Arslaan Pathan <[email protected]> | 2026-10-05 23:21:05 +1300 |
|---|---|---|
| committer | Arslaan Pathan <[email protected]> | 2026-10-05 23:21:05 +1300 |
| commit | b74d3e265067019537124b9f39a16295cf514d13 (patch) | |
| tree | 49dfea2311df59de29642500566f80bc59192755 /main.py | |
| parent | 4683da385843dd2f2a397555370445217871e513 (diff) | |
| download | remote-automation-b74d3e265067019537124b9f39a16295cf514d13.tar.xz remote-automation-b74d3e265067019537124b9f39a16295cf514d13.zip | |
repeat detection
Diffstat (limited to 'main.py')
| -rw-r--r-- | main.py | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -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 |
