uinput-mapper/py/create.py

40 lines
854 B
Python
Raw Normal View History

import linux_uinput, ctypes, fcntl, os
2013-04-19 18:08:58 -04:00
2013-04-18 19:11:56 -04:00
2013-04-19 19:10:16 -04:00
from cinput import *
2013-04-18 19:11:56 -04:00
def handle_specs(f, s):
print 'ioctl:', fcntl.ioctl(f, UI_SET_EVBIT, EV_KEY)
print 'ioctl:', fcntl.ioctl(f, UI_SET_KEYBIT, KEY_UP)
2013-04-18 19:11:56 -04:00
d = UInputDevice('Example input device', None)
2013-04-18 19:11:56 -04:00
import time
time.sleep(5)
2013-04-19 18:51:46 -04:00
2013-04-19 19:10:16 -04:00
# Config
dev = {
"input_devices" : [
("/dev/input/event3", "keyboard1"),
],
"type" : "mouse", # "mixed" "mouse" "keyboard" "joystick" "clone"?
"keymap" : {
"any" : { # From
EV_KEY : {
KEY_UP : {
"type" : EV_REL,
"key" : REL_X,
"value" : lambda x: -x*10
},
KEY_DOWN : {
"type": EV_REL,
"key": REL_X,
"value" : lambda x: x*10
}
}
},
}
}