Maybe you can do that through evdev?