Skip to content

Instantly share code, notes, and snippets.

Last active Jan 17, 2018
What would you like to do?
example of evdev/uinput based remapping, probably not the best one
import os
import atexit
import uinput
import evdev
#os.system('sudo modprobe uinput')
evdev.ecodes.KEY_A: uinput.KEY_ESC,
evdev.ecodes.KEY_B: uinput.KEY_END,
evdev.ecodes.KEY_C: uinput.KEY_ENTER,
device = uinput.Device(MAPPING.values(), name='Pedal keys')
PATH = '/dev/input/by-id/usb-PCsensor_FootSwitch3-F1.8-event-mouse'
in_dev = evdev.InputDevice(PATH)
for event in in_dev.read_loop():
if event.type == evdev.ecodes.EV_KEY:
device.emit(MAPPING[event.code], event.value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment