I think you could use python bindings for evdev: http://packages.python.org/evdev/index.html . In the tutorial, they give an example for the keyboard, but it should look like mouse events:
>>> from evdev import InputDevice, categorize, ecodes >>> from select import select >>> dev = InputDevice('/dev/input/event1') >>> print(dev) device /dev/input/event1, name "Dell Dell USB Keyboard", phys "usb-0000:00:12.1-2/input0" >>> while True: ... r,w,x = select([dev], [], []) ... for event in dev.read(): ... if event.type == ecodes.EV_KEY: ... print(categorize(event)) ...
Boris burkov
source share