Install - setting up uinput



Loading uinput

Now you want to do two things : check that uinput module is loaded, if relevant, and check uinput permissions.


Try and find uinput device, check which of the following provides you with non-empty output and keep it for after :


$ ls -l /dev/input/uinput
$ ls -l /dev/uinput
$ ls -l /dev/misc/uinput


If all these commands give empty results, probably that uinput module is not loaded. You should therefore load it, and to avoid doing so after every reboot, make sure module is autoloaded at startup - this is largely distribution specific, I am providing you the code for gentoo (you need superuser privileges, of course) :


# modprobe uinput
# echo "uinput" >> /etc/modules.autoload.d/kernel-2.6
# echo "uinput" >> /etc/conf.d/modules       // if using baselayout-2


Do not do it if it is not required, i.e. maybe your distribution already autoloads uinput module, or maybe uinput is built inside the kernel, in which case there is no module to load.



Checking uinput permissions

In most cases, you will not have write access to uinput device, which is required. Check in the following result of the ls command listed above, if you see something like :


crw-rw---- 1 root root 10, 223 Dec 31  2009 /dev/input/uinput


It is clear that root is the owner of the device, and does not allow users outside the root group to access it. Two ways to address that, the temporary quick hack one, and the permanent cleaner one. For the first, to be done after each reboot :


# chmod 666 /dev/input/uinput


For the second one, you can use the udev rules file which is provided with the chmfp package (rename it if you want), and copy it in the appropriate directory (again, distribution-specific, example for gentoo). I then create a uinput group to which I assign users (if you prefer to use a different group, you can edit the file).


# cp /usr/local/src/chmfp-0.6.0/14-uinput.rules /etc/udev/rules.d/.
# udevadm control restart
# groupadd uinput
# usermod -a -G uinput <username>