aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2017-04-15 18:16:50 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2017-04-17 23:19:34 -0400
commitad6493800b08791bd7ea1a578b8c8b14dfecec0d (patch)
tree2b3bdd8fc77a71e8796eee7b68624aa632ac4bfe
parentb08c118cde9dfd92f1f3c90544a682ee8b2ea740 (diff)
Input: docs - freshen up introduction
Stop saying that API is experimental and that only USB is supported, acknowledge that evdev is the preferred interface, and remove paragraph encouraging people sending snail mail to Vojtech :) along with his email. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r--Documentation/input/event-codes.rst2
-rw-r--r--Documentation/input/input.rst253
-rw-r--r--Documentation/input/joydev/joystick-api.rst2
-rw-r--r--Documentation/input/joydev/joystick.rst2
4 files changed, 127 insertions, 132 deletions
diff --git a/Documentation/input/event-codes.rst b/Documentation/input/event-codes.rst
index 92db50954169..00b88f113bda 100644
--- a/Documentation/input/event-codes.rst
+++ b/Documentation/input/event-codes.rst
@@ -1,3 +1,5 @@
1.. _input-event-codes:
2
1================= 3=================
2Input event codes 4Input event codes
3================= 5=================
diff --git a/Documentation/input/input.rst b/Documentation/input/input.rst
index ac7669ad3e76..3b3a22975106 100644
--- a/Documentation/input/input.rst
+++ b/Documentation/input/input.rst
@@ -1,25 +1,20 @@
1.. include:: <isonum.txt> 1.. include:: <isonum.txt>
2 2
3=================== 3============
4Linux Input drivers 4Introduction
5=================== 5============
6 6
7:Copyright: |copy| 1999-2001 Vojtech Pavlik <vojtech@ucw.cz> - Sponsored by SuSE 7:Copyright: |copy| 1999-2001 Vojtech Pavlik <vojtech@ucw.cz> - Sponsored by SuSE
8 8
9Should you need to contact me, the author, you can do so either by e-mail 9Architecture
10- mail your message to <vojtech@ucw.cz>, or by paper mail: Vojtech Pavlik,
11Simunkova 1594, Prague 8, 182 00 Czech Republic
12
13Introduction
14============ 10============
15 11
16This is a collection of drivers that is designed to support all input 12Input subsystem a collection of drivers that is designed to support
17devices under Linux. While it is currently used only on for USB input 13all input devices under Linux. Most of the drivers reside in
18devices, future use (say 2.5/2.6) is expected to expand to replace 14drivers/input, although quite a few live in drivers/hid and
19most of the existing input system, which is why it lives in 15drivers/platform.
20drivers/input/ instead of drivers/usb/.
21 16
22The centre of the input drivers is the input module, which must be 17The core of the input subsystem is the input module, which must be
23loaded before any other of the input modules - it serves as a way of 18loaded before any other of the input modules - it serves as a way of
24communication between two groups of modules: 19communication between two groups of modules:
25 20
@@ -32,9 +27,9 @@ events (keystrokes, mouse movements) to the input module.
32Event handlers 27Event handlers
33-------------- 28--------------
34 29
35These modules get events from input and pass them where needed via 30These modules get events from input core and pass them where needed
36various interfaces - keystrokes to the kernel, mouse movements via a 31via various interfaces - keystrokes to the kernel, mouse movements via
37simulated PS/2 interface to GPM and X and so on. 32a simulated PS/2 interface to GPM and X, and so on.
38 33
39Simple Usage 34Simple Usage
40============ 35============
@@ -45,19 +40,18 @@ kernel)::
45 40
46 input 41 input
47 mousedev 42 mousedev
48 keybdev
49 usbcore 43 usbcore
50 uhci_hcd or ohci_hcd or ehci_hcd 44 uhci_hcd or ohci_hcd or ehci_hcd
51 usbhid 45 usbhid
46 hid_generic
52 47
53After this, the USB keyboard will work straight away, and the USB mouse 48After this, the USB keyboard will work straight away, and the USB mouse
54will be available as a character device on major 13, minor 63:: 49will be available as a character device on major 13, minor 63::
55 50
56 crw-r--r-- 1 root root 13, 63 Mar 28 22:45 mice 51 crw-r--r-- 1 root root 13, 63 Mar 28 22:45 mice
57 52
58This device has to be created. 53This device usually created automatically by the system. The commands
59 54to create it by hand are::
60The commands to create it by hand are::
61 55
62 cd /dev 56 cd /dev
63 mkdir input 57 mkdir input
@@ -81,100 +75,50 @@ When you do all of the above, you can use your USB mouse and keyboard.
81Detailed Description 75Detailed Description
82==================== 76====================
83 77
84Device drivers 78Event handlers
85-------------- 79--------------
86 80
87Device drivers are the modules that generate events. The events are 81Event handlers distribute the events from the devices to userspace and
88however not useful without being handled, so you also will need to use some 82in-kernel consumers, as needed.
89of the modules from section 3.2.
90
91usbhid
92~~~~~~
93
94usbhid is the largest and most complex driver of the whole suite. It
95handles all HID devices, and because there is a very wide variety of them,
96and because the USB HID specification isn't simple, it needs to be this big.
97
98Currently, it handles USB mice, joysticks, gamepads, steering wheels
99keyboards, trackballs and digitizers.
100
101However, USB uses HID also for monitor controls, speaker controls, UPSs,
102LCDs and many other purposes.
103
104The monitor and speaker controls should be easy to add to the hid/input
105interface, but for the UPSs and LCDs it doesn't make much sense. For this,
106the hiddev interface was designed. See Documentation/hid/hiddev.txt
107for more information about it.
108
109The usage of the usbhid module is very simple, it takes no parameters,
110detects everything automatically and when a HID device is inserted, it
111detects it appropriately.
112
113However, because the devices vary wildly, you might happen to have a
114device that doesn't work well. In that case #define DEBUG at the beginning
115of hid-core.c and send me the syslog traces.
116 83
117usbmouse 84evdev
118~~~~~~~~
119
120For embedded systems, for mice with broken HID descriptors and just any
121other use when the big usbhid wouldn't be a good choice, there is the
122usbmouse driver. It handles USB mice only. It uses a simpler HIDBP
123protocol. This also means the mice must support this simpler protocol. Not
124all do. If you don't have any strong reason to use this module, use usbhid
125instead.
126
127usbkbd
128~~~~~~
129
130Much like usbmouse, this module talks to keyboards with a simplified
131HIDBP protocol. It's smaller, but doesn't support any extra special keys.
132Use usbhid instead if there isn't any special reason to use this.
133
134wacom
135~~~~~ 85~~~~~
136 86
137This is a driver for Wacom Graphire and Intuos tablets. Not for Wacom 87``evdev`` is the generic input event interface. It passes the events
138PenPartner, that one is handled by the HID driver. Although the Intuos and 88generated in the kernel straight to the program, with timestamps. The
139Graphire tablets claim that they are HID tablets as well, they are not and 89event codes are the same on all architectures and are hardware
140thus need this specific driver. 90independent.
141 91
142iforce 92This is the preferred interface for userspace to consume user
143~~~~~~ 93input, and all clients are encouraged to use it.
144 94
145A driver for I-Force joysticks and wheels, both over USB and RS232. 95See :ref:`event-interface` for notes on API.
146It includes ForceFeedback support now, even though Immersion
147Corp. considers the protocol a trade secret and won't disclose a word
148about it.
149 96
150Event handlers 97The devices are in /dev/input::
151--------------
152 98
153Event handlers distribute the events from the devices to userland and 99 crw-r--r-- 1 root root 13, 64 Apr 1 10:49 event0
154kernel, as needed. 100 crw-r--r-- 1 root root 13, 65 Apr 1 10:50 event1
101 crw-r--r-- 1 root root 13, 66 Apr 1 10:50 event2
102 crw-r--r-- 1 root root 13, 67 Apr 1 10:50 event3
103 ...
155 104
156keybdev 105There are two ranges of minors: 64 through 95 is the static legacy
157~~~~~~~ 106range. If there are more than 32 input devices in a system, additional
107evdev nodes are created with minors starting with 256.
158 108
159keybdev is currently a rather ugly hack that translates the input 109keyboard
160events into architecture-specific keyboard raw mode (Xlated AT Set2 on 110~~~~~~~~
161x86), and passes them into the handle_scancode function of the
162keyboard.c module. This works well enough on all architectures that
163keybdev can generate rawmode on, other architectures can be added to
164it.
165 111
166The right way would be to pass the events to keyboard.c directly, 112``keyboard`` is in-kernel input handler ad is a part of VT code. It
167best if keyboard.c would itself be an event handler. This is done in 113consumes keyboard keystrokes and handles user input for VT consoles.
168the input patch, available on the webpage mentioned below.
169 114
170mousedev 115mousedev
171~~~~~~~~ 116~~~~~~~~
172 117
173mousedev is also a hack to make programs that use mouse input 118``mousedev`` is a hack to make legacy programs that use mouse input
174work. It takes events from either mice or digitizers/tablets and makes 119work. It takes events from either mice or digitizers/tablets and makes
175a PS/2-style (a la /dev/psaux) mouse device available to the 120a PS/2-style (a la /dev/psaux) mouse device available to the
176userland. Ideally, the programs could use a more reasonable interface, 121userland.
177for example evdev
178 122
179Mousedev devices in /dev/input (as shown above) are:: 123Mousedev devices in /dev/input (as shown above) are::
180 124
@@ -190,8 +134,9 @@ Mousedev devices in /dev/input (as shown above) are::
190Each ``mouse`` device is assigned to a single mouse or digitizer, except 134Each ``mouse`` device is assigned to a single mouse or digitizer, except
191the last one - ``mice``. This single character device is shared by all 135the last one - ``mice``. This single character device is shared by all
192mice and digitizers, and even if none are connected, the device is 136mice and digitizers, and even if none are connected, the device is
193present. This is useful for hotplugging USB mice, so that programs 137present. This is useful for hotplugging USB mice, so that older programs
194can open the device even when no mice are present. 138that do not handle hotplug can open the device even when no mice are
139present.
195 140
196CONFIG_INPUT_MOUSEDEV_SCREEN_[XY] in the kernel configuration are 141CONFIG_INPUT_MOUSEDEV_SCREEN_[XY] in the kernel configuration are
197the size of your screen (in pixels) in XFree86. This is needed if you 142the size of your screen (in pixels) in XFree86. This is needed if you
@@ -208,11 +153,10 @@ mouse and ExplorerPS/2 if you want to use extra (up to 5) buttons.
208joydev 153joydev
209~~~~~~ 154~~~~~~
210 155
211Joydev implements v0.x and v1.x Linux joystick api, much like 156``joydev`` implements v0.x and v1.x Linux joystick API. See
212drivers/char/joystick/joystick.c used to in earlier versions. See 157:ref:`joystick-api` for details.
213joystick-api.txt in the Documentation subdirectory for details. As 158
214soon as any joystick is connected, it can be accessed in /dev/input 159As soon as any joystick is connected, it can be accessed in /dev/input on::
215on::
216 160
217 crw-r--r-- 1 root root 13, 0 Apr 1 10:50 js0 161 crw-r--r-- 1 root root 13, 0 Apr 1 10:50 js0
218 crw-r--r-- 1 root root 13, 1 Apr 1 10:50 js1 162 crw-r--r-- 1 root root 13, 1 Apr 1 10:50 js1
@@ -220,56 +164,99 @@ on::
220 crw-r--r-- 1 root root 13, 3 Apr 1 10:50 js3 164 crw-r--r-- 1 root root 13, 3 Apr 1 10:50 js3
221 ... 165 ...
222 166
223And so on up to js31. 167And so on up to js31 in legacy range, and additional nodes with minors
168above 256 if there are more joystick devices.
224 169
225evdev 170Device drivers
226~~~~~ 171--------------
227 172
228evdev is the generic input event interface. It passes the events 173Device drivers are the modules that generate events.
229generated in the kernel straight to the program, with timestamps. The
230API is still evolving, but should be usable now. It's described in
231section 5.
232 174
233This should be the way for GPM and X to get keyboard and mouse 175hid-generic
234events. It allows for multihead in X without any specific multihead 176~~~~~~~~~~~
235kernel support. The event codes are the same on all architectures and
236are hardware independent.
237 177
238The devices are in /dev/input:: 178``hid-generic`` is one of the largest and most complex driver of the
179whole suite. It handles all HID devices, and because there is a very
180wide variety of them, and because the USB HID specification isn't
181simple, it needs to be this big.
239 182
240 crw-r--r-- 1 root root 13, 64 Apr 1 10:49 event0 183Currently, it handles USB mice, joysticks, gamepads, steering wheels
241 crw-r--r-- 1 root root 13, 65 Apr 1 10:50 event1 184keyboards, trackballs and digitizers.
242 crw-r--r-- 1 root root 13, 66 Apr 1 10:50 event2 185
243 crw-r--r-- 1 root root 13, 67 Apr 1 10:50 event3 186However, USB uses HID also for monitor controls, speaker controls, UPSs,
244 ... 187LCDs and many other purposes.
188
189The monitor and speaker controls should be easy to add to the hid/input
190interface, but for the UPSs and LCDs it doesn't make much sense. For this,
191the hiddev interface was designed. See Documentation/hid/hiddev.txt
192for more information about it.
193
194The usage of the usbhid module is very simple, it takes no parameters,
195detects everything automatically and when a HID device is inserted, it
196detects it appropriately.
245 197
246And so on up to event31. 198However, because the devices vary wildly, you might happen to have a
199device that doesn't work well. In that case #define DEBUG at the beginning
200of hid-core.c and send me the syslog traces.
201
202usbmouse
203~~~~~~~~
204
205For embedded systems, for mice with broken HID descriptors and just any
206other use when the big usbhid wouldn't be a good choice, there is the
207usbmouse driver. It handles USB mice only. It uses a simpler HIDBP
208protocol. This also means the mice must support this simpler protocol. Not
209all do. If you don't have any strong reason to use this module, use usbhid
210instead.
211
212usbkbd
213~~~~~~
214
215Much like usbmouse, this module talks to keyboards with a simplified
216HIDBP protocol. It's smaller, but doesn't support any extra special keys.
217Use usbhid instead if there isn't any special reason to use this.
218
219psmouse
220~~~~~~~
221
222This is driver for all flavors of pointing devices using PS/2
223protocol, including Synaptics and ALPS touchpads, Intellimouse
224Explorer devices, Logitech PS/2 mice and so on.
225
226atkbd
227~~~~~
228
229This is driver for PS/2 (AT) keyboards.
230
231iforce
232~~~~~~
233
234A driver for I-Force joysticks and wheels, both over USB and RS232.
235It includes Force Feedback support now, even though Immersion
236Corp. considers the protocol a trade secret and won't disclose a word
237about it.
247 238
248Verifying if it works 239Verifying if it works
249===================== 240=====================
250 241
251Typing a couple keys on the keyboard should be enough to check that 242Typing a couple keys on the keyboard should be enough to check that
252a USB keyboard works and is correctly connected to the kernel keyboard 243a keyboard works and is correctly connected to the kernel keyboard
253driver. 244driver.
254 245
255Doing a ``cat /dev/input/mouse0`` (c, 13, 32) will verify that a mouse 246Doing a ``cat /dev/input/mouse0`` (c, 13, 32) will verify that a mouse
256is also emulated; characters should appear if you move it. 247is also emulated; characters should appear if you move it.
257 248
258You can test the joystick emulation with the ``jstest`` utility, 249You can test the joystick emulation with the ``jstest`` utility,
259available in the joystick package (see Documentation/input/joystick.txt). 250available in the joystick package (see :ref:`joystick-doc`).
260 251
261You can test the event devices with the ``evtest`` utility available 252You can test the event devices with the ``evtest`` utility.
262in the LinuxConsole project CVS archive (see the URL below). 253
254.. _event-interface:
263 255
264Event interface 256Event interface
265=============== 257===============
266 258
267Should you want to add event device support into any application (X, gpm, 259You can use blocking and nonblocking reads, and also select() on the
268svgalib ...) I <vojtech@ucw.cz> will be happy to provide you any help I
269can. Here goes a description of the current state of things, which is going
270to be extended, but not changed incompatibly as time goes:
271
272You can use blocking and nonblocking reads, also select() on the
273/dev/input/eventX devices, and you'll always get a whole number of input 260/dev/input/eventX devices, and you'll always get a whole number of input
274events on a read. Their layout is:: 261events on a read. Their layout is::
275 262
@@ -290,3 +277,5 @@ list is in include/uapi/linux/input-event-codes.h.
290``value`` is the value the event carries. Either a relative change for 277``value`` is the value the event carries. Either a relative change for
291EV_REL, absolute new value for EV_ABS (joysticks ...), or 0 for EV_KEY for 278EV_REL, absolute new value for EV_ABS (joysticks ...), or 0 for EV_KEY for
292release, 1 for keypress and 2 for autorepeat. 279release, 1 for keypress and 2 for autorepeat.
280
281See :ref:`input-event-codes` for more information about various even codes.
diff --git a/Documentation/input/joydev/joystick-api.rst b/Documentation/input/joydev/joystick-api.rst
index 42edcfc6e8af..95803e2e8cd0 100644
--- a/Documentation/input/joydev/joystick-api.rst
+++ b/Documentation/input/joydev/joystick-api.rst
@@ -1,3 +1,5 @@
1.. _joystick-api:
2
1===================== 3=====================
2Programming Interface 4Programming Interface
3===================== 5=====================
diff --git a/Documentation/input/joydev/joystick.rst b/Documentation/input/joydev/joystick.rst
index b90705eb69b1..9746fd76cc58 100644
--- a/Documentation/input/joydev/joystick.rst
+++ b/Documentation/input/joydev/joystick.rst
@@ -1,5 +1,7 @@
1.. include:: <isonum.txt> 1.. include:: <isonum.txt>
2 2
3.. _joystick-doc:
4
3Introduction 5Introduction
4============ 6============
5 7