Hardware Reference
In-Depth Information
The following example shows both:
int rc;
rc = ioctl(fd,UI_DEV_DESTROY);
assert(!rc);
close(fd);
Closing the file descriptor implies the ioctl(2,UI_DEV_DESTROY) operation.
The application has the option of destroying the device node while keeping the file
descriptor open.
X-Window
The creation of our new uinput device node is useful only if our desktop system is
listening to it. Raspbian Linux's X-Windows system needs a little configuration help to
notice our Frankenstein creation. The following definition can be added to the
/usr/share/X11/xorg.config.d directory. Name the file 20-nunchuk.conf :
# Nunchuck event queue
Section "InputClass"
Identifier "Raspberry Pi Nunchuk"
Option "Mode" "Relative"
MatchDevicePath "/dev/input/event3"
Driver "evdev"
EndSection
# End 20−nunchuk.conf
This configuration change works only if your Nunchuk uinput device shows up
as /dev/input/event3 . If you have other specialized input device creations on your
Raspberry Pi, it could well be event4 or some other number. See the upcoming section
“Testing the Nunchuk” for troubleshooting information.
Restart your X-Windows server to have the configuration file noticed.
Normally, your Nunchuk program should be running already. But the X-Window
server will notice it when the Nunchuk does start.
Tip
 
 
Search WWH ::




Custom Search