Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
def get_device_handle(keyboard_name: str) -> libevdev.Device:
""" Safely get an evdev device handle. """

# check if the device exists by checking if the device path exists
if not os.path.exists(abs_keyboard_path(keyboard_name)):
logging.critical(f"Keyboard device {keyboard_name} not connected.")
sys.exit(0)

fd = open(abs_keyboard_path(keyboard_name), 'rb')
evdev = libevdev.Device(fd)
try:
Expand Down