aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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