You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# TODO: Use const from evdev instead of manually checking for cleaner code and no magic numbers
self.last_hotkey=Nonedefapply_mappings(self, maps):
""" Applies custom mappings. Takes in key/value of key to code and adds to map array. NB: The map array hold the mapping of all key codes to the strings used to denoted them in configs. """forkey, codeinmaps.items():
logger.debug("Mapped "+key+" as ("+key+") to code "+str(code))
self.map[code] ="("+key+")"defwatch_keyboard(self):
""" Keyboard watcher - watches keyboard for events and triggers hotkeys by sending events to server according to config # TODO: Use const from evdev instead of manually checking for cleaner code and no magic numbers """logger.info("Watching for key presses on "+self.name+"...")
foreventinself.keyboard_device.read_loop():
# print(categorize(event))type=event.type# Event type - only interested in key event (EV_KEY)code=event.code# KDB Scan Codevalue=event.value# Value - up, down, hold.# We only want event type 1, as that is a key press# If key is already pressed, ignore event provided value not 0 (key unpressed)iftype==evdev.ecodes.EV_KEY:
ddf16bf3c7cfe75abdae271bd57a0adde6695b58
The text was updated successfully, but these errors were encountered:
Use const from evdev instead of manually checking for cleaner code and no magic numbers
2Keys/detectors/detector-pi/detector/twokeys/watcher/watch_keyboard.py
Line 88 in e8da1fa
ddf16bf3c7cfe75abdae271bd57a0adde6695b58
The text was updated successfully, but these errors were encountered: