Technical insight - uinput

 

 

Prerequisites

Kernel 2.6 with evdev, uinput support and libusb >= 1.0 are necessary to compile and execute. And, obviously, USB support, minimum kernel configuration as follows :

 

Device Drivers  --->
 USB support  --->
  <*> Support for Host-side USB
  ---   USB Host Controller Drivers
  < >   EHCI HCD (USB 2.0) support
  <*>   OHCI HCD support
  <*>   UHCI HCD (most Intel and VIA) support

 

Loading uinput module

If uinput is built as a kernel module, it must be loaded before launching the application, as superuser :

 

# modprobe uinput

 

Make sure you autoload the module if your distro does not by default, this is distro-specific (in gentoo : /etc/modules.autoload.d/kernel-2.6 or /etc/conf.d/modules in baselayout-2).

 

Permissions for uinput

/dev/input/uinput device requires write access for user running the application, you can perform as superuser :

 

# chmod 666 /dev/input/uinput

 

if permissions are not appropriate. A better automatic solution is to use udev rules, a sample is provided with this package. Copy sample file to /etc/udev/rules.d/ (or another path depending on your distro) and reload udev rules (or reboot). Sample provided assumes you have created a uinput group and have assigned your user(s) to it, you can change to another group if you so wish. Content of the rules file :

 

KERNEL=="uinput", GROUP:="uinput", MODE:="0660"

 

Note that for some distros (such as Ubuntu Maverick), uinput is built in the kernel (hence no module loading) and default device is /dev/uinput, but the sample udev rules file provided will function anyway.

 

Permissions for pid file

On execution, chmfp creates a pid file to avoid multiple instances running. This pid file is created in /var/tmp/ as a default directory, you can change this in chmfp.h before compilation. This directory requires read/write access for user executing the application.