Skip to content

Instantly share code, notes, and snippets.

@CRImier
Created November 16, 2021 04:59
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 CRImier/27b7b61abe468f20b422a9c359361ebe to your computer and use it in GitHub Desktop.
Save CRImier/27b7b61abe468f20b422a9c359361ebe to your computer and use it in GitHub Desktop.
Software that shows you all input events. apt install python3-evdev .
#!/usr/bin/sudo /usr/bin/python3
from evdev import InputDevice, list_devices, categorize, ecodes
from time import sleep
import threading
def listen_for_events(dev):
for event in dev.read_loop():
#if event.type == ecodes.EV_KEY:
print (dev.name, ": ", str(categorize(event)))
devices = [InputDevice(fn) for fn in list_devices()]
print(devices)
for dev in devices:
print(dev.name, " - ", dev.fn)
thread = threading.Thread(target=listen_for_events, args=(dev,))
thread.daemon = True
thread.start()
while True:
sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment