aboutsummaryrefslogtreecommitdiff
path: root/main.py
diff options
context:
space:
mode:
authorArslaan Pathan <[email protected]>2026-10-05 23:26:33 +1300
committerArslaan Pathan <[email protected]>2026-10-05 23:26:33 +1300
commit71694f30d418d4f42bd24ae59e5c898412621d07 (patch)
tree11e4651a85552069f85e38efdb855cd0daa3120c /main.py
parentb74d3e265067019537124b9f39a16295cf514d13 (diff)
downloadremote-automation-71694f30d418d4f42bd24ae59e5c898412621d07.tar.xz
remote-automation-71694f30d418d4f42bd24ae59e5c898412621d07.zip
fix stuff idk
Diffstat (limited to 'main.py')
-rw-r--r--main.py23
1 files changed, 14 insertions, 9 deletions
diff --git a/main.py b/main.py
index 462ad48..27066e2 100644
--- a/main.py
+++ b/main.py
@@ -15,12 +15,17 @@ if device is None:
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:
- 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
+try:
+ for event in device.read_loop():
+ 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
+except KeyboardInterrupt:
+ print("\nExiting...")
+finally:
+ device.close()