aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/input
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@s-opensource.com>2017-04-04 20:39:30 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2017-04-05 18:44:13 -0400
commitacbdca8bf162f7d5bbec89778dbbefd29badf57b (patch)
tree66d07c888c1ecb98be041f8e6db9bf7c7f5b8556 /Documentation/input
parent604aed61303b88fdf67e56c338d950fe4a8da5c2 (diff)
Input: convert event codes documentation into ReST format
This file require minimum adjustments to be a valid ReST file. Do it, in order to be able to parse it with Sphinx. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'Documentation/input')
-rw-r--r--Documentation/input/event-codes.txt132
1 files changed, 92 insertions, 40 deletions
diff --git a/Documentation/input/event-codes.txt b/Documentation/input/event-codes.txt
index 36ea940e5bb9..92db50954169 100644
--- a/Documentation/input/event-codes.txt
+++ b/Documentation/input/event-codes.txt
@@ -1,3 +1,8 @@
1=================
2Input event codes
3=================
4
5
1The input protocol uses a map of types and codes to express input device values 6The input protocol uses a map of types and codes to express input device values
2to userspace. This document describes the types and codes and how and when they 7to userspace. This document describes the types and codes and how and when they
3may be used. 8may be used.
@@ -17,82 +22,102 @@ reports supported by a device are also provided by sysfs in
17class/input/event*/device/capabilities/, and the properties of a device are 22class/input/event*/device/capabilities/, and the properties of a device are
18provided in class/input/event*/device/properties. 23provided in class/input/event*/device/properties.
19 24
20Event types: 25Event types
21=========== 26===========
27
22Event types are groupings of codes under a logical input construct. Each 28Event types are groupings of codes under a logical input construct. Each
23type has a set of applicable codes to be used in generating events. See the 29type has a set of applicable codes to be used in generating events. See the
24Codes section for details on valid codes for each type. 30Codes section for details on valid codes for each type.
25 31
26* EV_SYN: 32* EV_SYN:
33
27 - Used as markers to separate events. Events may be separated in time or in 34 - Used as markers to separate events. Events may be separated in time or in
28 space, such as with the multitouch protocol. 35 space, such as with the multitouch protocol.
29 36
30* EV_KEY: 37* EV_KEY:
38
31 - Used to describe state changes of keyboards, buttons, or other key-like 39 - Used to describe state changes of keyboards, buttons, or other key-like
32 devices. 40 devices.
33 41
34* EV_REL: 42* EV_REL:
43
35 - Used to describe relative axis value changes, e.g. moving the mouse 5 units 44 - Used to describe relative axis value changes, e.g. moving the mouse 5 units
36 to the left. 45 to the left.
37 46
38* EV_ABS: 47* EV_ABS:
48
39 - Used to describe absolute axis value changes, e.g. describing the 49 - Used to describe absolute axis value changes, e.g. describing the
40 coordinates of a touch on a touchscreen. 50 coordinates of a touch on a touchscreen.
41 51
42* EV_MSC: 52* EV_MSC:
53
43 - Used to describe miscellaneous input data that do not fit into other types. 54 - Used to describe miscellaneous input data that do not fit into other types.
44 55
45* EV_SW: 56* EV_SW:
57
46 - Used to describe binary state input switches. 58 - Used to describe binary state input switches.
47 59
48* EV_LED: 60* EV_LED:
61
49 - Used to turn LEDs on devices on and off. 62 - Used to turn LEDs on devices on and off.
50 63
51* EV_SND: 64* EV_SND:
65
52 - Used to output sound to devices. 66 - Used to output sound to devices.
53 67
54* EV_REP: 68* EV_REP:
69
55 - Used for autorepeating devices. 70 - Used for autorepeating devices.
56 71
57* EV_FF: 72* EV_FF:
73
58 - Used to send force feedback commands to an input device. 74 - Used to send force feedback commands to an input device.
59 75
60* EV_PWR: 76* EV_PWR:
77
61 - A special type for power button and switch input. 78 - A special type for power button and switch input.
62 79
63* EV_FF_STATUS: 80* EV_FF_STATUS:
81
64 - Used to receive force feedback device status. 82 - Used to receive force feedback device status.
65 83
66Event codes: 84Event codes
67=========== 85===========
86
68Event codes define the precise type of event. 87Event codes define the precise type of event.
69 88
70EV_SYN: 89EV_SYN
71---------- 90------
91
72EV_SYN event values are undefined. Their usage is defined only by when they are 92EV_SYN event values are undefined. Their usage is defined only by when they are
73sent in the evdev event stream. 93sent in the evdev event stream.
74 94
75* SYN_REPORT: 95* SYN_REPORT:
96
76 - Used to synchronize and separate events into packets of input data changes 97 - Used to synchronize and separate events into packets of input data changes
77 occurring at the same moment in time. For example, motion of a mouse may set 98 occurring at the same moment in time. For example, motion of a mouse may set
78 the REL_X and REL_Y values for one motion, then emit a SYN_REPORT. The next 99 the REL_X and REL_Y values for one motion, then emit a SYN_REPORT. The next
79 motion will emit more REL_X and REL_Y values and send another SYN_REPORT. 100 motion will emit more REL_X and REL_Y values and send another SYN_REPORT.
80 101
81* SYN_CONFIG: 102* SYN_CONFIG:
103
82 - TBD 104 - TBD
83 105
84* SYN_MT_REPORT: 106* SYN_MT_REPORT:
107
85 - Used to synchronize and separate touch events. See the 108 - Used to synchronize and separate touch events. See the
86 multi-touch-protocol.txt document for more information. 109 multi-touch-protocol.txt document for more information.
87 110
88* SYN_DROPPED: 111* SYN_DROPPED:
112
89 - Used to indicate buffer overrun in the evdev client's event queue. 113 - Used to indicate buffer overrun in the evdev client's event queue.
90 Client should ignore all events up to and including next SYN_REPORT 114 Client should ignore all events up to and including next SYN_REPORT
91 event and query the device (using EVIOCG* ioctls) to obtain its 115 event and query the device (using EVIOCG* ioctls) to obtain its
92 current state. 116 current state.
93 117
94EV_KEY: 118EV_KEY
95---------- 119------
120
96EV_KEY events take the form KEY_<name> or BTN_<name>. For example, KEY_A is used 121EV_KEY events take the form KEY_<name> or BTN_<name>. For example, KEY_A is used
97to represent the 'A' key on a keyboard. When a key is depressed, an event with 122to represent the 'A' key on a keyboard. When a key is depressed, an event with
98the key's code is emitted with value 1. When the key is released, an event is 123the key's code is emitted with value 1. When the key is released, an event is
@@ -103,6 +128,7 @@ BTN_<name> is used for other types of momentary switch events.
103A few EV_KEY codes have special meanings: 128A few EV_KEY codes have special meanings:
104 129
105* BTN_TOOL_<name>: 130* BTN_TOOL_<name>:
131
106 - These codes are used in conjunction with input trackpads, tablets, and 132 - These codes are used in conjunction with input trackpads, tablets, and
107 touchscreens. These devices may be used with fingers, pens, or other tools. 133 touchscreens. These devices may be used with fingers, pens, or other tools.
108 When an event occurs and a tool is used, the corresponding BTN_TOOL_<name> 134 When an event occurs and a tool is used, the corresponding BTN_TOOL_<name>
@@ -112,6 +138,7 @@ A few EV_KEY codes have special meanings:
112 code when events are generated. 138 code when events are generated.
113 139
114* BTN_TOUCH: 140* BTN_TOUCH:
141
115 BTN_TOUCH is used for touch contact. While an input tool is determined to be 142 BTN_TOUCH is used for touch contact. While an input tool is determined to be
116 within meaningful physical contact, the value of this property must be set 143 within meaningful physical contact, the value of this property must be set
117 to 1. Meaningful physical contact may mean any contact, or it may mean 144 to 1. Meaningful physical contact may mean any contact, or it may mean
@@ -132,6 +159,7 @@ future, this distinction will be deprecated and the device properties ioctl
132EVIOCGPROP, defined in linux/input.h, will be used to convey the device type. 159EVIOCGPROP, defined in linux/input.h, will be used to convey the device type.
133 160
134* BTN_TOOL_FINGER, BTN_TOOL_DOUBLETAP, BTN_TOOL_TRIPLETAP, BTN_TOOL_QUADTAP: 161* BTN_TOOL_FINGER, BTN_TOOL_DOUBLETAP, BTN_TOOL_TRIPLETAP, BTN_TOOL_QUADTAP:
162
135 - These codes denote one, two, three, and four finger interaction on a 163 - These codes denote one, two, three, and four finger interaction on a
136 trackpad or touchscreen. For example, if the user uses two fingers and moves 164 trackpad or touchscreen. For example, if the user uses two fingers and moves
137 them on the touchpad in an effort to scroll content on screen, 165 them on the touchpad in an effort to scroll content on screen,
@@ -147,8 +175,9 @@ a value of 1 in the same synchronization frame. This usage is deprecated.
147Note: In multitouch drivers, the input_mt_report_finger_count() function should 175Note: In multitouch drivers, the input_mt_report_finger_count() function should
148be used to emit these codes. Please see multi-touch-protocol.txt for details. 176be used to emit these codes. Please see multi-touch-protocol.txt for details.
149 177
150EV_REL: 178EV_REL
151---------- 179------
180
152EV_REL events describe relative changes in a property. For example, a mouse may 181EV_REL events describe relative changes in a property. For example, a mouse may
153move to the left by a certain number of units, but its absolute position in 182move to the left by a certain number of units, but its absolute position in
154space is unknown. If the absolute position is known, EV_ABS codes should be used 183space is unknown. If the absolute position is known, EV_ABS codes should be used
@@ -157,17 +186,20 @@ instead of EV_REL codes.
157A few EV_REL codes have special meanings: 186A few EV_REL codes have special meanings:
158 187
159* REL_WHEEL, REL_HWHEEL: 188* REL_WHEEL, REL_HWHEEL:
189
160 - These codes are used for vertical and horizontal scroll wheels, 190 - These codes are used for vertical and horizontal scroll wheels,
161 respectively. 191 respectively.
162 192
163EV_ABS: 193EV_ABS
164---------- 194------
195
165EV_ABS events describe absolute changes in a property. For example, a touchpad 196EV_ABS events describe absolute changes in a property. For example, a touchpad
166may emit coordinates for a touch location. 197may emit coordinates for a touch location.
167 198
168A few EV_ABS codes have special meanings: 199A few EV_ABS codes have special meanings:
169 200
170* ABS_DISTANCE: 201* ABS_DISTANCE:
202
171 - Used to describe the distance of a tool from an interaction surface. This 203 - Used to describe the distance of a tool from an interaction surface. This
172 event should only be emitted while the tool is hovering, meaning in close 204 event should only be emitted while the tool is hovering, meaning in close
173 proximity of the device and while the value of the BTN_TOUCH code is 0. If 205 proximity of the device and while the value of the BTN_TOUCH code is 0. If
@@ -179,11 +211,13 @@ A few EV_ABS codes have special meanings:
179 hardware and is otherwise independent of ABS_DISTANCE and/or BTN_TOUCH. 211 hardware and is otherwise independent of ABS_DISTANCE and/or BTN_TOUCH.
180 212
181* ABS_MT_<name>: 213* ABS_MT_<name>:
214
182 - Used to describe multitouch input events. Please see 215 - Used to describe multitouch input events. Please see
183 multi-touch-protocol.txt for details. 216 multi-touch-protocol.txt for details.
184 217
185EV_SW: 218EV_SW
186---------- 219-----
220
187EV_SW events describe stateful binary switches. For example, the SW_LID code is 221EV_SW events describe stateful binary switches. For example, the SW_LID code is
188used to denote when a laptop lid is closed. 222used to denote when a laptop lid is closed.
189 223
@@ -195,14 +229,16 @@ Upon resume, if the switch state is the same as before suspend, then the input
195subsystem will filter out the duplicate switch state reports. The driver does 229subsystem will filter out the duplicate switch state reports. The driver does
196not need to keep the state of the switch at any time. 230not need to keep the state of the switch at any time.
197 231
198EV_MSC: 232EV_MSC
199---------- 233------
234
200EV_MSC events are used for input and output events that do not fall under other 235EV_MSC events are used for input and output events that do not fall under other
201categories. 236categories.
202 237
203A few EV_MSC codes have special meaning: 238A few EV_MSC codes have special meaning:
204 239
205* MSC_TIMESTAMP: 240* MSC_TIMESTAMP:
241
206 - Used to report the number of microseconds since the last reset. This event 242 - Used to report the number of microseconds since the last reset. This event
207 should be coded as an uint32 value, which is allowed to wrap around with 243 should be coded as an uint32 value, which is allowed to wrap around with
208 no special consequence. It is assumed that the time difference between two 244 no special consequence. It is assumed that the time difference between two
@@ -211,39 +247,46 @@ A few EV_MSC codes have special meaning:
211 unknown. If the device does not provide this information, the driver must 247 unknown. If the device does not provide this information, the driver must
212 not provide it to user space. 248 not provide it to user space.
213 249
214EV_LED: 250EV_LED
215---------- 251------
252
216EV_LED events are used for input and output to set and query the state of 253EV_LED events are used for input and output to set and query the state of
217various LEDs on devices. 254various LEDs on devices.
218 255
219EV_REP: 256EV_REP
220---------- 257------
258
221EV_REP events are used for specifying autorepeating events. 259EV_REP events are used for specifying autorepeating events.
222 260
223EV_SND: 261EV_SND
224---------- 262------
263
225EV_SND events are used for sending sound commands to simple sound output 264EV_SND events are used for sending sound commands to simple sound output
226devices. 265devices.
227 266
228EV_FF: 267EV_FF
229---------- 268-----
269
230EV_FF events are used to initialize a force feedback capable device and to cause 270EV_FF events are used to initialize a force feedback capable device and to cause
231such device to feedback. 271such device to feedback.
232 272
233EV_PWR: 273EV_PWR
234---------- 274------
275
235EV_PWR events are a special type of event used specifically for power 276EV_PWR events are a special type of event used specifically for power
236management. Its usage is not well defined. To be addressed later. 277management. Its usage is not well defined. To be addressed later.
237 278
238Device properties: 279Device properties
239================= 280=================
281
240Normally, userspace sets up an input device based on the data it emits, 282Normally, userspace sets up an input device based on the data it emits,
241i.e., the event types. In the case of two devices emitting the same event 283i.e., the event types. In the case of two devices emitting the same event
242types, additional information can be provided in the form of device 284types, additional information can be provided in the form of device
243properties. 285properties.
244 286
245INPUT_PROP_DIRECT + INPUT_PROP_POINTER: 287INPUT_PROP_DIRECT + INPUT_PROP_POINTER
246-------------------------------------- 288--------------------------------------
289
247The INPUT_PROP_DIRECT property indicates that device coordinates should be 290The INPUT_PROP_DIRECT property indicates that device coordinates should be
248directly mapped to screen coordinates (not taking into account trivial 291directly mapped to screen coordinates (not taking into account trivial
249transformations, such as scaling, flipping and rotating). Non-direct input 292transformations, such as scaling, flipping and rotating). Non-direct input
@@ -260,8 +303,9 @@ If neither INPUT_PROP_DIRECT or INPUT_PROP_POINTER are set, the property is
260considered undefined and the device type should be deduced in the 303considered undefined and the device type should be deduced in the
261traditional way, using emitted event types. 304traditional way, using emitted event types.
262 305
263INPUT_PROP_BUTTONPAD: 306INPUT_PROP_BUTTONPAD
264-------------------- 307--------------------
308
265For touchpads where the button is placed beneath the surface, such that 309For touchpads where the button is placed beneath the surface, such that
266pressing down on the pad causes a button click, this property should be 310pressing down on the pad causes a button click, this property should be
267set. Common in clickpad notebooks and macbooks from 2009 and onwards. 311set. Common in clickpad notebooks and macbooks from 2009 and onwards.
@@ -270,8 +314,9 @@ Originally, the buttonpad property was coded into the bcm5974 driver
270version field under the name integrated button. For backwards 314version field under the name integrated button. For backwards
271compatibility, both methods need to be checked in userspace. 315compatibility, both methods need to be checked in userspace.
272 316
273INPUT_PROP_SEMI_MT: 317INPUT_PROP_SEMI_MT
274------------------ 318------------------
319
275Some touchpads, most common between 2008 and 2011, can detect the presence 320Some touchpads, most common between 2008 and 2011, can detect the presence
276of multiple contacts without resolving the individual positions; only the 321of multiple contacts without resolving the individual positions; only the
277number of contacts and a rectangular shape is known. For such 322number of contacts and a rectangular shape is known. For such
@@ -285,9 +330,10 @@ gestures can normally be extracted from it.
285If INPUT_PROP_SEMI_MT is not set, the device is assumed to be a true MT 330If INPUT_PROP_SEMI_MT is not set, the device is assumed to be a true MT
286device. 331device.
287 332
288INPUT_PROP_TOPBUTTONPAD: 333INPUT_PROP_TOPBUTTONPAD
289----------------------- 334-----------------------
290Some laptops, most notably the Lenovo *40 series provide a trackstick 335
336Some laptops, most notably the Lenovo 40 series provide a trackstick
291device but do not have physical buttons associated with the trackstick 337device but do not have physical buttons associated with the trackstick
292device. Instead, the top area of the touchpad is marked to show 338device. Instead, the top area of the touchpad is marked to show
293visual/haptic areas for left, middle, right buttons intended to be used 339visual/haptic areas for left, middle, right buttons intended to be used
@@ -299,26 +345,30 @@ The kernel does not provide button emulation for such devices but treats
299them as any other INPUT_PROP_BUTTONPAD device. 345them as any other INPUT_PROP_BUTTONPAD device.
300 346
301INPUT_PROP_ACCELEROMETER 347INPUT_PROP_ACCELEROMETER
302------------------------- 348------------------------
349
303Directional axes on this device (absolute and/or relative x, y, z) represent 350Directional axes on this device (absolute and/or relative x, y, z) represent
304accelerometer data. All other axes retain their meaning. A device must not mix 351accelerometer data. All other axes retain their meaning. A device must not mix
305regular directional axes and accelerometer axes on the same event node. 352regular directional axes and accelerometer axes on the same event node.
306 353
307Guidelines: 354Guidelines
308========== 355==========
356
309The guidelines below ensure proper single-touch and multi-finger functionality. 357The guidelines below ensure proper single-touch and multi-finger functionality.
310For multi-touch functionality, see the multi-touch-protocol.txt document for 358For multi-touch functionality, see the multi-touch-protocol.txt document for
311more information. 359more information.
312 360
313Mice: 361Mice
314---------- 362----
363
315REL_{X,Y} must be reported when the mouse moves. BTN_LEFT must be used to report 364REL_{X,Y} must be reported when the mouse moves. BTN_LEFT must be used to report
316the primary button press. BTN_{MIDDLE,RIGHT,4,5,etc.} should be used to report 365the primary button press. BTN_{MIDDLE,RIGHT,4,5,etc.} should be used to report
317further buttons of the device. REL_WHEEL and REL_HWHEEL should be used to report 366further buttons of the device. REL_WHEEL and REL_HWHEEL should be used to report
318scroll wheel events where available. 367scroll wheel events where available.
319 368
320Touchscreens: 369Touchscreens
321---------- 370------------
371
322ABS_{X,Y} must be reported with the location of the touch. BTN_TOUCH must be 372ABS_{X,Y} must be reported with the location of the touch. BTN_TOUCH must be
323used to report when a touch is active on the screen. 373used to report when a touch is active on the screen.
324BTN_{MOUSE,LEFT,MIDDLE,RIGHT} must not be reported as the result of touch 374BTN_{MOUSE,LEFT,MIDDLE,RIGHT} must not be reported as the result of touch
@@ -326,8 +376,9 @@ contact. BTN_TOOL_<name> events should be reported where possible.
326 376
327For new hardware, INPUT_PROP_DIRECT should be set. 377For new hardware, INPUT_PROP_DIRECT should be set.
328 378
329Trackpads: 379Trackpads
330---------- 380---------
381
331Legacy trackpads that only provide relative position information must report 382Legacy trackpads that only provide relative position information must report
332events like mice described above. 383events like mice described above.
333 384
@@ -338,8 +389,9 @@ be used to report the number of touches active on the trackpad.
338 389
339For new hardware, INPUT_PROP_POINTER should be set. 390For new hardware, INPUT_PROP_POINTER should be set.
340 391
341Tablets: 392Tablets
342---------- 393-------
394
343BTN_TOOL_<name> events must be reported when a stylus or other tool is active on 395BTN_TOOL_<name> events must be reported when a stylus or other tool is active on
344the tablet. ABS_{X,Y} must be reported with the location of the tool. BTN_TOUCH 396the tablet. ABS_{X,Y} must be reported with the location of the tool. BTN_TOUCH
345should be used to report when the tool is in contact with the tablet. 397should be used to report when the tool is in contact with the tablet.