Python-uinput
Uinput allows attaching user-space device drivers into the Linux kernel. Python-uinput provides a simple and easy to use API to the Linux uinput-system.
Contents
Usage example
Create and use a new uinput device with key-capabilities:
import uinput capabilities = { uinput.EV_KEY: (uinput.KEY_E, uinput.KEY_H, uinput.KEY_L, uinput.KEY_O), } device = uinput.Device(name="python-uinput-keyboard", capabilities=capabilities) device.emit(uinput.EV_KEY, uinput.KEY_H, 1) # Press. device.emit(uinput.EV_KEY, uinput.KEY_H, 0) # Release. device.emit(uinput.EV_KEY, uinput.KEY_E, 1) device.emit(uinput.EV_KEY, uinput.KEY_E, 0) device.emit(uinput.EV_KEY, uinput.KEY_L, 1) device.emit(uinput.EV_KEY, uinput.KEY_L, 0) device.emit(uinput.EV_KEY, uinput.KEY_L, 1) device.emit(uinput.EV_KEY, uinput.KEY_L, 0) device.emit(uinput.EV_KEY, uinput.KEY_O, 1) device.emit(uinput.EV_KEY, uinput.KEY_O, 0)
More examples can be found here.
Download & Install
There are couple of ways to obtain and install Python-uinput, depending on your needs. The following sections describe these ways, from the easiest to the geekiest.
Ubuntu 10.04 Lucid Lynx and later
Install from Codegrove's PPA:
sudo add-apt-repository ppa:tuos/codegrove sudo apt-get update sudo apt-get install python-uinput
Other systems
Grab the latest source release from PyPI and install it manually. Please refer to README and/or INSTALL files in the root of the source package for installation requirements and procedure.
Bug reports
Please report bugs at http://bugs.launchpad.net/python-uinput .