Hardware Reference
In-Depth Information
Input Utilities
When writing
uinput
event-based code, you will find the package
input-utils
to be
extremely helpful. They can be installed from the command line as follows:
$ sudo apt−get install input−utils
The following commands are installed:
lsinput(8)
:
List
uinput
devices
input-events(8)
:
Dump selected
uinput
events
input-kbd(8)
:
Keyboard map display
This chapter uses the first two utilities:
lsinput(8)
and
input-events(8)
.
Testing the Nunchuk
Now that the hardware, drivers, and software are ready, it is time to exercise the Nunchuk.
Unfortunately, there is no direct way for applications to identify your created
uinput
node. When the Nunchuk program runs, the node may show up as
/dev/input/event3
or some other numbered node if
event3
already exists. If you wanted to start a Nunchuk
driver as part of the Linux boot process, you need to create a script to edit the file with the
actual device name. The affected X-Windows config file is as follows:
/usr/share/X11/xord.conf.d/20-nunchuk.conf
The script (shown next) determines which node the Nunchuk program created. The
following is an example run, while the Nunchuk program was running:
$ ./findchuk
/dev/input/event3
When the node is not found, the
findchuk
script exits with a nonzero code and
prints a message to
stderr
:
$ ./findchuk
Nunchuk uinput device not found.
$ echo $?
1