diff options
| author | Arslaan Pathan <[email protected]> | 2026-10-05 23:26:33 +1300 |
|---|---|---|
| committer | Arslaan Pathan <[email protected]> | 2026-10-05 23:26:33 +1300 |
| commit | 71694f30d418d4f42bd24ae59e5c898412621d07 (patch) | |
| tree | 11e4651a85552069f85e38efdb855cd0daa3120c /main.py | |
| parent | b74d3e265067019537124b9f39a16295cf514d13 (diff) | |
| download | remote-automation-71694f30d418d4f42bd24ae59e5c898412621d07.tar.xz remote-automation-71694f30d418d4f42bd24ae59e5c898412621d07.zip | |
fix stuff idk
Diffstat (limited to 'main.py')
| -rw-r--r-- | main.py | 23 |
1 files changed, 14 insertions, 9 deletions
@@ -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() |
