The Input Subsystem
href="The Input Subsystem_file/style.css" rel=stylesheet>
The Input Subsystem
The Input subsystem is an abstraction layer between input devices
(keyboard, mouse, joystick, and so on) and input handlers. The input devices
capture inputs from the user actions or from other sources and generate
input_events. The input events go through the Input core and are
dispatched to the interested handlers, which can make them available to user
space through the standard Unix file interface, eg, read.2.
Read more about the href="http://www.geocities.com/marco_corvi/games/lkpe/input/input.htm">Linux
Input Subsystem
Now look at a few examples of input devices. These are taken from Hard's
article, with minor changes to make them run on 2.4 kernels. Try them out:
href="http://www.geocities.com/marco_corvi/games/lkpe/input/example1.c">example1.c,
basic register/unregister
href="http://www.geocities.com/marco_corvi/games/lkpe/input/example2.c">example2.c,
key event device
href="http://www.geocities.com/marco_corvi/games/lkpe/input/example3.c">example3.c,
motion event device
Exercise 1
Write a driver that generates led input events. You can begin with examples
2 or 3 above, and replace the driver event type with EV_LED, and set some
ledbit. Give it a try before looking at a solution, href="http://www.geocities.com/marco_corvi/games/lkpe/input/example4.c">example4.c,
led event device.
Exercise 2
Write a handler for the led device of the first exercise. As a hint you may
look at the joydev.c code in drivers/input subdirectory of Linux. Here is a
solution, href="http://www.geocities.com/marco_corvi/games/lkpe/input/leddev.c">leddev.c,
href="http://www.geocities.com/marco_corvi/games/lkpe/input/leddev_h.txt">leddev.h,
led event handler. And these are two user programs for it, href="http://www.geocities.com/marco_corvi/games/lkpe/input/ledtest.c">ledtest.c,
href="http://www.geocities.com/marco_corvi/games/lkpe/input/ledreset.c">ledreset.c.
Code: href="http://www.geocities.com/marco_corvi/games/lkpe/input/example1.c">example1.c,
register/unregister input device href="http://www.geocities.com/marco_corvi/games/lkpe/input/example2.c">example2.c,
key event input device href="http://www.geocities.com/marco_corvi/games/lkpe/input/example3.c">example3.c,
motion event input device href="http://www.geocities.com/marco_corvi/games/lkpe/input/example4.c">example4.c,
led event input device href="http://www.geocities.com/marco_corvi/games/lkpe/input/leddev.c">leddev.c,
led event input handler href="http://www.geocities.com/marco_corvi/games/lkpe/input/makefile.txt">Makefile,
makefileMarco Corvi - 2003
language=JavaScript>var PUpage="76001084"; var PUprop="geocities";
var yviContents='http://us.toto.geo.yahoo.com/toto?s=76001084&l=NE&b=1&t=1057747027';yviR='us';yfiEA(0);
geovisit();
width=1 border=0> src="The Input Subsystem_file/serv.gif" width=1>