Skip to content

Instantly share code, notes, and snippets.

@isidentical
Created July 20, 2019 12:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isidentical/400a362138f5839f906cdef9d72fdc8f to your computer and use it in GitHub Desktop.
Save isidentical/400a362138f5839f906cdef9d72fdc8f to your computer and use it in GitHub Desktop.
import evdev
from evdev import InputDevice, categorize, ecodes
devices = [evdev.InputDevice(path) for path in evdev.list_devices()]
for device in devices:
print(device.path, device.name, device.phys)
device = devices[int(input(">> "))]
for event in dev.read_loop():
if event.type == ecodes.EV_KEY:
print(categorize(event))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment