📄 the input subsystem.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0063)http://www.geocities.com/marco_corvi/games/lkpe/input/index.htm -->
<HTML><HEAD><TITLE>The Input Subsystem</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252"><LINK
href="The Input Subsystem_file/style.css" rel=stylesheet>
<META content="MSHTML 6.00.2800.1170" name=GENERATOR></HEAD>
<BODY>
<H2>The Input Subsystem</H2>
<P>
<DIV>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
<CODE>input_event</CODE>s. 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, <CODE>read.2</CODE>. </DIV>
<DIV>Read more about the <A
href="http://www.geocities.com/marco_corvi/games/lkpe/input/input.htm">Linux
Input Subsystem</A> </DIV>
<DIV>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:
<OL>
<LI><A
href="http://www.geocities.com/marco_corvi/games/lkpe/input/example1.c">example1.c</A>,
basic register/unregister
<LI><A
href="http://www.geocities.com/marco_corvi/games/lkpe/input/example2.c">example2.c</A>,
key event device
<LI><A
href="http://www.geocities.com/marco_corvi/games/lkpe/input/example3.c">example3.c</A>,
motion event device </LI></OL></DIV>
<P><B>Exercise 1</B><BR>
<DIV>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
<CODE>ledbit</CODE>. Give it a try before looking at a solution, <BR><A
href="http://www.geocities.com/marco_corvi/games/lkpe/input/example4.c">example4.c</A>,
led event device. </DIV>
<P><B>Exercise 2</B><BR>
<DIV>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, <A
href="http://www.geocities.com/marco_corvi/games/lkpe/input/leddev.c">leddev.c</A>,
<A
href="http://www.geocities.com/marco_corvi/games/lkpe/input/leddev_h.txt">leddev.h</A>,
led event handler. And these are two user programs for it, <A
href="http://www.geocities.com/marco_corvi/games/lkpe/input/ledtest.c">ledtest.c</A>,
<A
href="http://www.geocities.com/marco_corvi/games/lkpe/input/ledreset.c">ledreset.c</A>.
</DIV><BR clear=all>
<DIV><B>Code</B>:<BR><A
href="http://www.geocities.com/marco_corvi/games/lkpe/input/example1.c">example1.c</A>,
register/unregister input device<BR><A
href="http://www.geocities.com/marco_corvi/games/lkpe/input/example2.c">example2.c</A>,
key event input device<BR><A
href="http://www.geocities.com/marco_corvi/games/lkpe/input/example3.c">example3.c</A>,
motion event input device<BR><A
href="http://www.geocities.com/marco_corvi/games/lkpe/input/example4.c">example4.c</A>,
led event input device<BR><A
href="http://www.geocities.com/marco_corvi/games/lkpe/input/leddev.c">leddev.c</A>,
led event input handler<BR><A
href="http://www.geocities.com/marco_corvi/games/lkpe/input/makefile.txt">Makefile</A>,
makefile<BR></DIV><BR clear=all><FONT size=-1>Marco Corvi - 2003</FONT> <!-- text below generated by server. PLEASE REMOVE --></OBJECT></LAYER>
<DIV></DIV></SPAN></STYLE></NOSCRIPT></TABLE></SCRIPT></APPLET>
<SCRIPT
language=JavaScript>var PUpage="76001084"; var PUprop="geocities"; </SCRIPT>
<SCRIPT language=JavaScript src="The Input Subsystem_file/pu5geo.js"></SCRIPT>
<SCRIPT language=JavaScript src="The Input Subsystem_file/ygIELib9.js"></SCRIPT>
<SCRIPT language=JavaScript>var yviContents='http://us.toto.geo.yahoo.com/toto?s=76001084&l=NE&b=1&t=1057747027';yviR='us';yfiEA(0);</SCRIPT>
<SCRIPT language=JavaScript src="The Input Subsystem_file/mc.js"></SCRIPT>
<SCRIPT language=JavaScript src="The Input Subsystem_file/geov2.js"></SCRIPT>
<SCRIPT language=javascript>geovisit();</SCRIPT>
<NOSCRIPT><IMG height=1 alt=setstats src="The Input Subsystem_file/visit.gif"
width=1 border=0></NOSCRIPT> <IMG height=1 alt=1
src="The Input Subsystem_file/serv.gif" width=1> <!-- w22.geo.scd.yahoo.com compressed/chunked Wed Jul 9 03:37:07 PDT 2003 --></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -