Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+140 -145
+2
Documentation/input/event-codes.rst
··· 1 + .. _input-event-codes: 2 + 1 3 ================= 2 4 Input event codes 3 5 =================
+134 -145
Documentation/input/input.rst
··· 1 1 .. include:: <isonum.txt> 2 2 3 - =================== 4 - Linux Input drivers 5 - =================== 6 - 7 - :Copyright: |copy| 1999-2001 Vojtech Pavlik <vojtech@ucw.cz> - Sponsored by SuSE 8 - 9 - Should you need to contact me, the author, you can do so either by e-mail 10 - - mail your message to <vojtech@ucw.cz>, or by paper mail: Vojtech Pavlik, 11 - Simunkova 1594, Prague 8, 182 00 Czech Republic 12 - 3 + ============ 13 4 Introduction 14 5 ============ 15 6 16 - This is a collection of drivers that is designed to support all input 17 - devices under Linux. While it is currently used only on for USB input 18 - devices, future use (say 2.5/2.6) is expected to expand to replace 19 - most of the existing input system, which is why it lives in 20 - drivers/input/ instead of drivers/usb/. 7 + :Copyright: |copy| 1999-2001 Vojtech Pavlik <vojtech@ucw.cz> - Sponsored by SuSE 21 8 22 - The centre of the input drivers is the input module, which must be 9 + Architecture 10 + ============ 11 + 12 + Input subsystem a collection of drivers that is designed to support 13 + all input devices under Linux. Most of the drivers reside in 14 + drivers/input, although quite a few live in drivers/hid and 15 + drivers/platform. 16 + 17 + The core of the input subsystem is the input module, which must be 23 18 loaded before any other of the input modules - it serves as a way of 24 19 communication between two groups of modules: 25 20 ··· 27 32 Event handlers 28 33 -------------- 29 34 30 - These modules get events from input and pass them where needed via 31 - various interfaces - keystrokes to the kernel, mouse movements via a 32 - simulated PS/2 interface to GPM and X and so on. 35 + These modules get events from input core and pass them where needed 36 + via various interfaces - keystrokes to the kernel, mouse movements via 37 + a simulated PS/2 interface to GPM and X, and so on. 33 38 34 39 Simple Usage 35 40 ============ ··· 40 45 41 46 input 42 47 mousedev 43 - keybdev 44 48 usbcore 45 49 uhci_hcd or ohci_hcd or ehci_hcd 46 50 usbhid 51 + hid_generic 47 52 48 53 After this, the USB keyboard will work straight away, and the USB mouse 49 54 will be available as a character device on major 13, minor 63:: 50 55 51 56 crw-r--r-- 1 root root 13, 63 Mar 28 22:45 mice 52 57 53 - This device has to be created. 54 - 55 - The commands to create it by hand are:: 58 + This device usually created automatically by the system. The commands 59 + to create it by hand are:: 56 60 57 61 cd /dev 58 62 mkdir input ··· 75 81 Detailed Description 76 82 ==================== 77 83 84 + Event handlers 85 + -------------- 86 + 87 + Event handlers distribute the events from the devices to userspace and 88 + in-kernel consumers, as needed. 89 + 90 + evdev 91 + ~~~~~ 92 + 93 + ``evdev`` is the generic input event interface. It passes the events 94 + generated in the kernel straight to the program, with timestamps. The 95 + event codes are the same on all architectures and are hardware 96 + independent. 97 + 98 + This is the preferred interface for userspace to consume user 99 + input, and all clients are encouraged to use it. 100 + 101 + See :ref:`event-interface` for notes on API. 102 + 103 + The devices are in /dev/input:: 104 + 105 + crw-r--r-- 1 root root 13, 64 Apr 1 10:49 event0 106 + crw-r--r-- 1 root root 13, 65 Apr 1 10:50 event1 107 + crw-r--r-- 1 root root 13, 66 Apr 1 10:50 event2 108 + crw-r--r-- 1 root root 13, 67 Apr 1 10:50 event3 109 + ... 110 + 111 + There are two ranges of minors: 64 through 95 is the static legacy 112 + range. If there are more than 32 input devices in a system, additional 113 + evdev nodes are created with minors starting with 256. 114 + 115 + keyboard 116 + ~~~~~~~~ 117 + 118 + ``keyboard`` is in-kernel input handler ad is a part of VT code. It 119 + consumes keyboard keystrokes and handles user input for VT consoles. 120 + 121 + mousedev 122 + ~~~~~~~~ 123 + 124 + ``mousedev`` is a hack to make legacy programs that use mouse input 125 + work. It takes events from either mice or digitizers/tablets and makes 126 + a PS/2-style (a la /dev/psaux) mouse device available to the 127 + userland. 128 + 129 + Mousedev devices in /dev/input (as shown above) are:: 130 + 131 + crw-r--r-- 1 root root 13, 32 Mar 28 22:45 mouse0 132 + crw-r--r-- 1 root root 13, 33 Mar 29 00:41 mouse1 133 + crw-r--r-- 1 root root 13, 34 Mar 29 00:41 mouse2 134 + crw-r--r-- 1 root root 13, 35 Apr 1 10:50 mouse3 135 + ... 136 + ... 137 + crw-r--r-- 1 root root 13, 62 Apr 1 10:50 mouse30 138 + crw-r--r-- 1 root root 13, 63 Apr 1 10:50 mice 139 + 140 + Each ``mouse`` device is assigned to a single mouse or digitizer, except 141 + the last one - ``mice``. This single character device is shared by all 142 + mice and digitizers, and even if none are connected, the device is 143 + present. This is useful for hotplugging USB mice, so that older programs 144 + that do not handle hotplug can open the device even when no mice are 145 + present. 146 + 147 + CONFIG_INPUT_MOUSEDEV_SCREEN_[XY] in the kernel configuration are 148 + the size of your screen (in pixels) in XFree86. This is needed if you 149 + want to use your digitizer in X, because its movement is sent to X 150 + via a virtual PS/2 mouse and thus needs to be scaled 151 + accordingly. These values won't be used if you use a mouse only. 152 + 153 + Mousedev will generate either PS/2, ImPS/2 (Microsoft IntelliMouse) or 154 + ExplorerPS/2 (IntelliMouse Explorer) protocols, depending on what the 155 + program reading the data wishes. You can set GPM and X to any of 156 + these. You'll need ImPS/2 if you want to make use of a wheel on a USB 157 + mouse and ExplorerPS/2 if you want to use extra (up to 5) buttons. 158 + 159 + joydev 160 + ~~~~~~ 161 + 162 + ``joydev`` implements v0.x and v1.x Linux joystick API. See 163 + :ref:`joystick-api` for details. 164 + 165 + As soon as any joystick is connected, it can be accessed in /dev/input on:: 166 + 167 + crw-r--r-- 1 root root 13, 0 Apr 1 10:50 js0 168 + crw-r--r-- 1 root root 13, 1 Apr 1 10:50 js1 169 + crw-r--r-- 1 root root 13, 2 Apr 1 10:50 js2 170 + crw-r--r-- 1 root root 13, 3 Apr 1 10:50 js3 171 + ... 172 + 173 + And so on up to js31 in legacy range, and additional nodes with minors 174 + above 256 if there are more joystick devices. 175 + 78 176 Device drivers 79 177 -------------- 80 178 81 - Device drivers are the modules that generate events. The events are 82 - however not useful without being handled, so you also will need to use some 83 - of the modules from section 3.2. 179 + Device drivers are the modules that generate events. 84 180 85 - usbhid 86 - ~~~~~~ 181 + hid-generic 182 + ~~~~~~~~~~~ 87 183 88 - usbhid is the largest and most complex driver of the whole suite. It 89 - handles all HID devices, and because there is a very wide variety of them, 90 - and because the USB HID specification isn't simple, it needs to be this big. 184 + ``hid-generic`` is one of the largest and most complex driver of the 185 + whole suite. It handles all HID devices, and because there is a very 186 + wide variety of them, and because the USB HID specification isn't 187 + simple, it needs to be this big. 91 188 92 189 Currently, it handles USB mice, joysticks, gamepads, steering wheels 93 190 keyboards, trackballs and digitizers. ··· 216 131 HIDBP protocol. It's smaller, but doesn't support any extra special keys. 217 132 Use usbhid instead if there isn't any special reason to use this. 218 133 219 - wacom 134 + psmouse 135 + ~~~~~~~ 136 + 137 + This is driver for all flavors of pointing devices using PS/2 138 + protocol, including Synaptics and ALPS touchpads, Intellimouse 139 + Explorer devices, Logitech PS/2 mice and so on. 140 + 141 + atkbd 220 142 ~~~~~ 221 143 222 - This is a driver for Wacom Graphire and Intuos tablets. Not for Wacom 223 - PenPartner, that one is handled by the HID driver. Although the Intuos and 224 - Graphire tablets claim that they are HID tablets as well, they are not and 225 - thus need this specific driver. 144 + This is driver for PS/2 (AT) keyboards. 226 145 227 146 iforce 228 147 ~~~~~~ 229 148 230 149 A driver for I-Force joysticks and wheels, both over USB and RS232. 231 - It includes ForceFeedback support now, even though Immersion 150 + It includes Force Feedback support now, even though Immersion 232 151 Corp. considers the protocol a trade secret and won't disclose a word 233 152 about it. 234 - 235 - Event handlers 236 - -------------- 237 - 238 - Event handlers distribute the events from the devices to userland and 239 - kernel, as needed. 240 - 241 - keybdev 242 - ~~~~~~~ 243 - 244 - keybdev is currently a rather ugly hack that translates the input 245 - events into architecture-specific keyboard raw mode (Xlated AT Set2 on 246 - x86), and passes them into the handle_scancode function of the 247 - keyboard.c module. This works well enough on all architectures that 248 - keybdev can generate rawmode on, other architectures can be added to 249 - it. 250 - 251 - The right way would be to pass the events to keyboard.c directly, 252 - best if keyboard.c would itself be an event handler. This is done in 253 - the input patch, available on the webpage mentioned below. 254 - 255 - mousedev 256 - ~~~~~~~~ 257 - 258 - mousedev is also a hack to make programs that use mouse input 259 - work. It takes events from either mice or digitizers/tablets and makes 260 - a PS/2-style (a la /dev/psaux) mouse device available to the 261 - userland. Ideally, the programs could use a more reasonable interface, 262 - for example evdev 263 - 264 - Mousedev devices in /dev/input (as shown above) are:: 265 - 266 - crw-r--r-- 1 root root 13, 32 Mar 28 22:45 mouse0 267 - crw-r--r-- 1 root root 13, 33 Mar 29 00:41 mouse1 268 - crw-r--r-- 1 root root 13, 34 Mar 29 00:41 mouse2 269 - crw-r--r-- 1 root root 13, 35 Apr 1 10:50 mouse3 270 - ... 271 - ... 272 - crw-r--r-- 1 root root 13, 62 Apr 1 10:50 mouse30 273 - crw-r--r-- 1 root root 13, 63 Apr 1 10:50 mice 274 - 275 - Each ``mouse`` device is assigned to a single mouse or digitizer, except 276 - the last one - ``mice``. This single character device is shared by all 277 - mice and digitizers, and even if none are connected, the device is 278 - present. This is useful for hotplugging USB mice, so that programs 279 - can open the device even when no mice are present. 280 - 281 - CONFIG_INPUT_MOUSEDEV_SCREEN_[XY] in the kernel configuration are 282 - the size of your screen (in pixels) in XFree86. This is needed if you 283 - want to use your digitizer in X, because its movement is sent to X 284 - via a virtual PS/2 mouse and thus needs to be scaled 285 - accordingly. These values won't be used if you use a mouse only. 286 - 287 - Mousedev will generate either PS/2, ImPS/2 (Microsoft IntelliMouse) or 288 - ExplorerPS/2 (IntelliMouse Explorer) protocols, depending on what the 289 - program reading the data wishes. You can set GPM and X to any of 290 - these. You'll need ImPS/2 if you want to make use of a wheel on a USB 291 - mouse and ExplorerPS/2 if you want to use extra (up to 5) buttons. 292 - 293 - joydev 294 - ~~~~~~ 295 - 296 - Joydev implements v0.x and v1.x Linux joystick api, much like 297 - drivers/char/joystick/joystick.c used to in earlier versions. See 298 - joystick-api.txt in the Documentation subdirectory for details. As 299 - soon as any joystick is connected, it can be accessed in /dev/input 300 - on:: 301 - 302 - crw-r--r-- 1 root root 13, 0 Apr 1 10:50 js0 303 - crw-r--r-- 1 root root 13, 1 Apr 1 10:50 js1 304 - crw-r--r-- 1 root root 13, 2 Apr 1 10:50 js2 305 - crw-r--r-- 1 root root 13, 3 Apr 1 10:50 js3 306 - ... 307 - 308 - And so on up to js31. 309 - 310 - evdev 311 - ~~~~~ 312 - 313 - evdev is the generic input event interface. It passes the events 314 - generated in the kernel straight to the program, with timestamps. The 315 - API is still evolving, but should be usable now. It's described in 316 - section 5. 317 - 318 - This should be the way for GPM and X to get keyboard and mouse 319 - events. It allows for multihead in X without any specific multihead 320 - kernel support. The event codes are the same on all architectures and 321 - are hardware independent. 322 - 323 - The devices are in /dev/input:: 324 - 325 - crw-r--r-- 1 root root 13, 64 Apr 1 10:49 event0 326 - crw-r--r-- 1 root root 13, 65 Apr 1 10:50 event1 327 - crw-r--r-- 1 root root 13, 66 Apr 1 10:50 event2 328 - crw-r--r-- 1 root root 13, 67 Apr 1 10:50 event3 329 - ... 330 - 331 - And so on up to event31. 332 153 333 154 Verifying if it works 334 155 ===================== 335 156 336 157 Typing a couple keys on the keyboard should be enough to check that 337 - a USB keyboard works and is correctly connected to the kernel keyboard 158 + a keyboard works and is correctly connected to the kernel keyboard 338 159 driver. 339 160 340 161 Doing a ``cat /dev/input/mouse0`` (c, 13, 32) will verify that a mouse 341 162 is also emulated; characters should appear if you move it. 342 163 343 164 You can test the joystick emulation with the ``jstest`` utility, 344 - available in the joystick package (see Documentation/input/joystick.txt). 165 + available in the joystick package (see :ref:`joystick-doc`). 345 166 346 - You can test the event devices with the ``evtest`` utility available 347 - in the LinuxConsole project CVS archive (see the URL below). 167 + You can test the event devices with the ``evtest`` utility. 168 + 169 + .. _event-interface: 348 170 349 171 Event interface 350 172 =============== 351 173 352 - Should you want to add event device support into any application (X, gpm, 353 - svgalib ...) I <vojtech@ucw.cz> will be happy to provide you any help I 354 - can. Here goes a description of the current state of things, which is going 355 - to be extended, but not changed incompatibly as time goes: 356 - 357 - You can use blocking and nonblocking reads, also select() on the 174 + You can use blocking and nonblocking reads, and also select() on the 358 175 /dev/input/eventX devices, and you'll always get a whole number of input 359 176 events on a read. Their layout is:: 360 177 ··· 277 290 ``value`` is the value the event carries. Either a relative change for 278 291 EV_REL, absolute new value for EV_ABS (joysticks ...), or 0 for EV_KEY for 279 292 release, 1 for keypress and 2 for autorepeat. 293 + 294 + See :ref:`input-event-codes` for more information about various even codes.
+2
Documentation/input/joydev/joystick-api.rst
··· 1 + .. _joystick-api: 2 + 1 3 ===================== 2 4 Programming Interface 3 5 =====================
+2
Documentation/input/joydev/joystick.rst
··· 1 1 .. include:: <isonum.txt> 2 2 3 + .. _joystick-doc: 4 + 3 5 Introduction 4 6 ============ 5 7