xref: /OK3568_Linux_fs/kernel/Documentation/input/event-codes.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. _input-event-codes:
2*4882a593Smuzhiyun
3*4882a593Smuzhiyun=================
4*4882a593SmuzhiyunInput event codes
5*4882a593Smuzhiyun=================
6*4882a593Smuzhiyun
7*4882a593Smuzhiyun
8*4882a593SmuzhiyunThe input protocol uses a map of types and codes to express input device values
9*4882a593Smuzhiyunto userspace. This document describes the types and codes and how and when they
10*4882a593Smuzhiyunmay be used.
11*4882a593Smuzhiyun
12*4882a593SmuzhiyunA single hardware event generates multiple input events. Each input event
13*4882a593Smuzhiyuncontains the new value of a single data item. A special event type, EV_SYN, is
14*4882a593Smuzhiyunused to separate input events into packets of input data changes occurring at
15*4882a593Smuzhiyunthe same moment in time. In the following, the term "event" refers to a single
16*4882a593Smuzhiyuninput event encompassing a type, code, and value.
17*4882a593Smuzhiyun
18*4882a593SmuzhiyunThe input protocol is a stateful protocol. Events are emitted only when values
19*4882a593Smuzhiyunof event codes have changed. However, the state is maintained within the Linux
20*4882a593Smuzhiyuninput subsystem; drivers do not need to maintain the state and may attempt to
21*4882a593Smuzhiyunemit unchanged values without harm. Userspace may obtain the current state of
22*4882a593Smuzhiyunevent code values using the EVIOCG* ioctls defined in linux/input.h. The event
23*4882a593Smuzhiyunreports supported by a device are also provided by sysfs in
24*4882a593Smuzhiyunclass/input/event*/device/capabilities/, and the properties of a device are
25*4882a593Smuzhiyunprovided in class/input/event*/device/properties.
26*4882a593Smuzhiyun
27*4882a593SmuzhiyunEvent types
28*4882a593Smuzhiyun===========
29*4882a593Smuzhiyun
30*4882a593SmuzhiyunEvent types are groupings of codes under a logical input construct. Each
31*4882a593Smuzhiyuntype has a set of applicable codes to be used in generating events. See the
32*4882a593SmuzhiyunCodes section for details on valid codes for each type.
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun* EV_SYN:
35*4882a593Smuzhiyun
36*4882a593Smuzhiyun  - Used as markers to separate events. Events may be separated in time or in
37*4882a593Smuzhiyun    space, such as with the multitouch protocol.
38*4882a593Smuzhiyun
39*4882a593Smuzhiyun* EV_KEY:
40*4882a593Smuzhiyun
41*4882a593Smuzhiyun  - Used to describe state changes of keyboards, buttons, or other key-like
42*4882a593Smuzhiyun    devices.
43*4882a593Smuzhiyun
44*4882a593Smuzhiyun* EV_REL:
45*4882a593Smuzhiyun
46*4882a593Smuzhiyun  - Used to describe relative axis value changes, e.g. moving the mouse 5 units
47*4882a593Smuzhiyun    to the left.
48*4882a593Smuzhiyun
49*4882a593Smuzhiyun* EV_ABS:
50*4882a593Smuzhiyun
51*4882a593Smuzhiyun  - Used to describe absolute axis value changes, e.g. describing the
52*4882a593Smuzhiyun    coordinates of a touch on a touchscreen.
53*4882a593Smuzhiyun
54*4882a593Smuzhiyun* EV_MSC:
55*4882a593Smuzhiyun
56*4882a593Smuzhiyun  - Used to describe miscellaneous input data that do not fit into other types.
57*4882a593Smuzhiyun
58*4882a593Smuzhiyun* EV_SW:
59*4882a593Smuzhiyun
60*4882a593Smuzhiyun  - Used to describe binary state input switches.
61*4882a593Smuzhiyun
62*4882a593Smuzhiyun* EV_LED:
63*4882a593Smuzhiyun
64*4882a593Smuzhiyun  - Used to turn LEDs on devices on and off.
65*4882a593Smuzhiyun
66*4882a593Smuzhiyun* EV_SND:
67*4882a593Smuzhiyun
68*4882a593Smuzhiyun  - Used to output sound to devices.
69*4882a593Smuzhiyun
70*4882a593Smuzhiyun* EV_REP:
71*4882a593Smuzhiyun
72*4882a593Smuzhiyun  - Used for autorepeating devices.
73*4882a593Smuzhiyun
74*4882a593Smuzhiyun* EV_FF:
75*4882a593Smuzhiyun
76*4882a593Smuzhiyun  - Used to send force feedback commands to an input device.
77*4882a593Smuzhiyun
78*4882a593Smuzhiyun* EV_PWR:
79*4882a593Smuzhiyun
80*4882a593Smuzhiyun  - A special type for power button and switch input.
81*4882a593Smuzhiyun
82*4882a593Smuzhiyun* EV_FF_STATUS:
83*4882a593Smuzhiyun
84*4882a593Smuzhiyun  - Used to receive force feedback device status.
85*4882a593Smuzhiyun
86*4882a593SmuzhiyunEvent codes
87*4882a593Smuzhiyun===========
88*4882a593Smuzhiyun
89*4882a593SmuzhiyunEvent codes define the precise type of event.
90*4882a593Smuzhiyun
91*4882a593SmuzhiyunEV_SYN
92*4882a593Smuzhiyun------
93*4882a593Smuzhiyun
94*4882a593SmuzhiyunEV_SYN event values are undefined. Their usage is defined only by when they are
95*4882a593Smuzhiyunsent in the evdev event stream.
96*4882a593Smuzhiyun
97*4882a593Smuzhiyun* SYN_REPORT:
98*4882a593Smuzhiyun
99*4882a593Smuzhiyun  - Used to synchronize and separate events into packets of input data changes
100*4882a593Smuzhiyun    occurring at the same moment in time. For example, motion of a mouse may set
101*4882a593Smuzhiyun    the REL_X and REL_Y values for one motion, then emit a SYN_REPORT. The next
102*4882a593Smuzhiyun    motion will emit more REL_X and REL_Y values and send another SYN_REPORT.
103*4882a593Smuzhiyun
104*4882a593Smuzhiyun* SYN_CONFIG:
105*4882a593Smuzhiyun
106*4882a593Smuzhiyun  - TBD
107*4882a593Smuzhiyun
108*4882a593Smuzhiyun* SYN_MT_REPORT:
109*4882a593Smuzhiyun
110*4882a593Smuzhiyun  - Used to synchronize and separate touch events. See the
111*4882a593Smuzhiyun    multi-touch-protocol.txt document for more information.
112*4882a593Smuzhiyun
113*4882a593Smuzhiyun* SYN_DROPPED:
114*4882a593Smuzhiyun
115*4882a593Smuzhiyun  - Used to indicate buffer overrun in the evdev client's event queue.
116*4882a593Smuzhiyun    Client should ignore all events up to and including next SYN_REPORT
117*4882a593Smuzhiyun    event and query the device (using EVIOCG* ioctls) to obtain its
118*4882a593Smuzhiyun    current state.
119*4882a593Smuzhiyun
120*4882a593SmuzhiyunEV_KEY
121*4882a593Smuzhiyun------
122*4882a593Smuzhiyun
123*4882a593SmuzhiyunEV_KEY events take the form KEY_<name> or BTN_<name>. For example, KEY_A is used
124*4882a593Smuzhiyunto represent the 'A' key on a keyboard. When a key is depressed, an event with
125*4882a593Smuzhiyunthe key's code is emitted with value 1. When the key is released, an event is
126*4882a593Smuzhiyunemitted with value 0. Some hardware send events when a key is repeated. These
127*4882a593Smuzhiyunevents have a value of 2. In general, KEY_<name> is used for keyboard keys, and
128*4882a593SmuzhiyunBTN_<name> is used for other types of momentary switch events.
129*4882a593Smuzhiyun
130*4882a593SmuzhiyunA few EV_KEY codes have special meanings:
131*4882a593Smuzhiyun
132*4882a593Smuzhiyun* BTN_TOOL_<name>:
133*4882a593Smuzhiyun
134*4882a593Smuzhiyun  - These codes are used in conjunction with input trackpads, tablets, and
135*4882a593Smuzhiyun    touchscreens. These devices may be used with fingers, pens, or other tools.
136*4882a593Smuzhiyun    When an event occurs and a tool is used, the corresponding BTN_TOOL_<name>
137*4882a593Smuzhiyun    code should be set to a value of 1. When the tool is no longer interacting
138*4882a593Smuzhiyun    with the input device, the BTN_TOOL_<name> code should be reset to 0. All
139*4882a593Smuzhiyun    trackpads, tablets, and touchscreens should use at least one BTN_TOOL_<name>
140*4882a593Smuzhiyun    code when events are generated.
141*4882a593Smuzhiyun
142*4882a593Smuzhiyun* BTN_TOUCH:
143*4882a593Smuzhiyun
144*4882a593Smuzhiyun    BTN_TOUCH is used for touch contact. While an input tool is determined to be
145*4882a593Smuzhiyun    within meaningful physical contact, the value of this property must be set
146*4882a593Smuzhiyun    to 1. Meaningful physical contact may mean any contact, or it may mean
147*4882a593Smuzhiyun    contact conditioned by an implementation defined property. For example, a
148*4882a593Smuzhiyun    touchpad may set the value to 1 only when the touch pressure rises above a
149*4882a593Smuzhiyun    certain value. BTN_TOUCH may be combined with BTN_TOOL_<name> codes. For
150*4882a593Smuzhiyun    example, a pen tablet may set BTN_TOOL_PEN to 1 and BTN_TOUCH to 0 while the
151*4882a593Smuzhiyun    pen is hovering over but not touching the tablet surface.
152*4882a593Smuzhiyun
153*4882a593SmuzhiyunNote: For appropriate function of the legacy mousedev emulation driver,
154*4882a593SmuzhiyunBTN_TOUCH must be the first evdev code emitted in a synchronization frame.
155*4882a593Smuzhiyun
156*4882a593SmuzhiyunNote: Historically a touch device with BTN_TOOL_FINGER and BTN_TOUCH was
157*4882a593Smuzhiyuninterpreted as a touchpad by userspace, while a similar device without
158*4882a593SmuzhiyunBTN_TOOL_FINGER was interpreted as a touchscreen. For backwards compatibility
159*4882a593Smuzhiyunwith current userspace it is recommended to follow this distinction. In the
160*4882a593Smuzhiyunfuture, this distinction will be deprecated and the device properties ioctl
161*4882a593SmuzhiyunEVIOCGPROP, defined in linux/input.h, will be used to convey the device type.
162*4882a593Smuzhiyun
163*4882a593Smuzhiyun* BTN_TOOL_FINGER, BTN_TOOL_DOUBLETAP, BTN_TOOL_TRIPLETAP, BTN_TOOL_QUADTAP:
164*4882a593Smuzhiyun
165*4882a593Smuzhiyun  - These codes denote one, two, three, and four finger interaction on a
166*4882a593Smuzhiyun    trackpad or touchscreen. For example, if the user uses two fingers and moves
167*4882a593Smuzhiyun    them on the touchpad in an effort to scroll content on screen,
168*4882a593Smuzhiyun    BTN_TOOL_DOUBLETAP should be set to value 1 for the duration of the motion.
169*4882a593Smuzhiyun    Note that all BTN_TOOL_<name> codes and the BTN_TOUCH code are orthogonal in
170*4882a593Smuzhiyun    purpose. A trackpad event generated by finger touches should generate events
171*4882a593Smuzhiyun    for one code from each group. At most only one of these BTN_TOOL_<name>
172*4882a593Smuzhiyun    codes should have a value of 1 during any synchronization frame.
173*4882a593Smuzhiyun
174*4882a593SmuzhiyunNote: Historically some drivers emitted multiple of the finger count codes with
175*4882a593Smuzhiyuna value of 1 in the same synchronization frame. This usage is deprecated.
176*4882a593Smuzhiyun
177*4882a593SmuzhiyunNote: In multitouch drivers, the input_mt_report_finger_count() function should
178*4882a593Smuzhiyunbe used to emit these codes. Please see multi-touch-protocol.txt for details.
179*4882a593Smuzhiyun
180*4882a593SmuzhiyunEV_REL
181*4882a593Smuzhiyun------
182*4882a593Smuzhiyun
183*4882a593SmuzhiyunEV_REL events describe relative changes in a property. For example, a mouse may
184*4882a593Smuzhiyunmove to the left by a certain number of units, but its absolute position in
185*4882a593Smuzhiyunspace is unknown. If the absolute position is known, EV_ABS codes should be used
186*4882a593Smuzhiyuninstead of EV_REL codes.
187*4882a593Smuzhiyun
188*4882a593SmuzhiyunA few EV_REL codes have special meanings:
189*4882a593Smuzhiyun
190*4882a593Smuzhiyun* REL_WHEEL, REL_HWHEEL:
191*4882a593Smuzhiyun
192*4882a593Smuzhiyun  - These codes are used for vertical and horizontal scroll wheels,
193*4882a593Smuzhiyun    respectively. The value is the number of detents moved on the wheel, the
194*4882a593Smuzhiyun    physical size of which varies by device. For high-resolution wheels
195*4882a593Smuzhiyun    this may be an approximation based on the high-resolution scroll events,
196*4882a593Smuzhiyun    see REL_WHEEL_HI_RES. These event codes are legacy codes and
197*4882a593Smuzhiyun    REL_WHEEL_HI_RES and REL_HWHEEL_HI_RES should be preferred where
198*4882a593Smuzhiyun    available.
199*4882a593Smuzhiyun
200*4882a593Smuzhiyun* REL_WHEEL_HI_RES, REL_HWHEEL_HI_RES:
201*4882a593Smuzhiyun
202*4882a593Smuzhiyun  - High-resolution scroll wheel data. The accumulated value 120 represents
203*4882a593Smuzhiyun    movement by one detent. For devices that do not provide high-resolution
204*4882a593Smuzhiyun    scrolling, the value is always a multiple of 120. For devices with
205*4882a593Smuzhiyun    high-resolution scrolling, the value may be a fraction of 120.
206*4882a593Smuzhiyun
207*4882a593Smuzhiyun    If a vertical scroll wheel supports high-resolution scrolling, this code
208*4882a593Smuzhiyun    will be emitted in addition to REL_WHEEL or REL_HWHEEL. The REL_WHEEL
209*4882a593Smuzhiyun    and REL_HWHEEL may be an approximation based on the high-resolution
210*4882a593Smuzhiyun    scroll events. There is no guarantee that the high-resolution data
211*4882a593Smuzhiyun    is a multiple of 120 at the time of an emulated REL_WHEEL or REL_HWHEEL
212*4882a593Smuzhiyun    event.
213*4882a593Smuzhiyun
214*4882a593SmuzhiyunEV_ABS
215*4882a593Smuzhiyun------
216*4882a593Smuzhiyun
217*4882a593SmuzhiyunEV_ABS events describe absolute changes in a property. For example, a touchpad
218*4882a593Smuzhiyunmay emit coordinates for a touch location.
219*4882a593Smuzhiyun
220*4882a593SmuzhiyunA few EV_ABS codes have special meanings:
221*4882a593Smuzhiyun
222*4882a593Smuzhiyun* ABS_DISTANCE:
223*4882a593Smuzhiyun
224*4882a593Smuzhiyun  - Used to describe the distance of a tool from an interaction surface. This
225*4882a593Smuzhiyun    event should only be emitted while the tool is hovering, meaning in close
226*4882a593Smuzhiyun    proximity of the device and while the value of the BTN_TOUCH code is 0. If
227*4882a593Smuzhiyun    the input device may be used freely in three dimensions, consider ABS_Z
228*4882a593Smuzhiyun    instead.
229*4882a593Smuzhiyun  - BTN_TOOL_<name> should be set to 1 when the tool comes into detectable
230*4882a593Smuzhiyun    proximity and set to 0 when the tool leaves detectable proximity.
231*4882a593Smuzhiyun    BTN_TOOL_<name> signals the type of tool that is currently detected by the
232*4882a593Smuzhiyun    hardware and is otherwise independent of ABS_DISTANCE and/or BTN_TOUCH.
233*4882a593Smuzhiyun
234*4882a593Smuzhiyun* ABS_MT_<name>:
235*4882a593Smuzhiyun
236*4882a593Smuzhiyun  - Used to describe multitouch input events. Please see
237*4882a593Smuzhiyun    multi-touch-protocol.txt for details.
238*4882a593Smuzhiyun
239*4882a593SmuzhiyunEV_SW
240*4882a593Smuzhiyun-----
241*4882a593Smuzhiyun
242*4882a593SmuzhiyunEV_SW events describe stateful binary switches. For example, the SW_LID code is
243*4882a593Smuzhiyunused to denote when a laptop lid is closed.
244*4882a593Smuzhiyun
245*4882a593SmuzhiyunUpon binding to a device or resuming from suspend, a driver must report
246*4882a593Smuzhiyunthe current switch state. This ensures that the device, kernel, and userspace
247*4882a593Smuzhiyunstate is in sync.
248*4882a593Smuzhiyun
249*4882a593SmuzhiyunUpon resume, if the switch state is the same as before suspend, then the input
250*4882a593Smuzhiyunsubsystem will filter out the duplicate switch state reports. The driver does
251*4882a593Smuzhiyunnot need to keep the state of the switch at any time.
252*4882a593Smuzhiyun
253*4882a593SmuzhiyunEV_MSC
254*4882a593Smuzhiyun------
255*4882a593Smuzhiyun
256*4882a593SmuzhiyunEV_MSC events are used for input and output events that do not fall under other
257*4882a593Smuzhiyuncategories.
258*4882a593Smuzhiyun
259*4882a593SmuzhiyunA few EV_MSC codes have special meaning:
260*4882a593Smuzhiyun
261*4882a593Smuzhiyun* MSC_TIMESTAMP:
262*4882a593Smuzhiyun
263*4882a593Smuzhiyun  - Used to report the number of microseconds since the last reset. This event
264*4882a593Smuzhiyun    should be coded as an uint32 value, which is allowed to wrap around with
265*4882a593Smuzhiyun    no special consequence. It is assumed that the time difference between two
266*4882a593Smuzhiyun    consecutive events is reliable on a reasonable time scale (hours).
267*4882a593Smuzhiyun    A reset to zero can happen, in which case the time since the last event is
268*4882a593Smuzhiyun    unknown.  If the device does not provide this information, the driver must
269*4882a593Smuzhiyun    not provide it to user space.
270*4882a593Smuzhiyun
271*4882a593SmuzhiyunEV_LED
272*4882a593Smuzhiyun------
273*4882a593Smuzhiyun
274*4882a593SmuzhiyunEV_LED events are used for input and output to set and query the state of
275*4882a593Smuzhiyunvarious LEDs on devices.
276*4882a593Smuzhiyun
277*4882a593SmuzhiyunEV_REP
278*4882a593Smuzhiyun------
279*4882a593Smuzhiyun
280*4882a593SmuzhiyunEV_REP events are used for specifying autorepeating events.
281*4882a593Smuzhiyun
282*4882a593SmuzhiyunEV_SND
283*4882a593Smuzhiyun------
284*4882a593Smuzhiyun
285*4882a593SmuzhiyunEV_SND events are used for sending sound commands to simple sound output
286*4882a593Smuzhiyundevices.
287*4882a593Smuzhiyun
288*4882a593SmuzhiyunEV_FF
289*4882a593Smuzhiyun-----
290*4882a593Smuzhiyun
291*4882a593SmuzhiyunEV_FF events are used to initialize a force feedback capable device and to cause
292*4882a593Smuzhiyunsuch device to feedback.
293*4882a593Smuzhiyun
294*4882a593SmuzhiyunEV_PWR
295*4882a593Smuzhiyun------
296*4882a593Smuzhiyun
297*4882a593SmuzhiyunEV_PWR events are a special type of event used specifically for power
298*4882a593Smuzhiyunmanagement. Its usage is not well defined. To be addressed later.
299*4882a593Smuzhiyun
300*4882a593SmuzhiyunDevice properties
301*4882a593Smuzhiyun=================
302*4882a593Smuzhiyun
303*4882a593SmuzhiyunNormally, userspace sets up an input device based on the data it emits,
304*4882a593Smuzhiyuni.e., the event types. In the case of two devices emitting the same event
305*4882a593Smuzhiyuntypes, additional information can be provided in the form of device
306*4882a593Smuzhiyunproperties.
307*4882a593Smuzhiyun
308*4882a593SmuzhiyunINPUT_PROP_DIRECT + INPUT_PROP_POINTER
309*4882a593Smuzhiyun--------------------------------------
310*4882a593Smuzhiyun
311*4882a593SmuzhiyunThe INPUT_PROP_DIRECT property indicates that device coordinates should be
312*4882a593Smuzhiyundirectly mapped to screen coordinates (not taking into account trivial
313*4882a593Smuzhiyuntransformations, such as scaling, flipping and rotating). Non-direct input
314*4882a593Smuzhiyundevices require non-trivial transformation, such as absolute to relative
315*4882a593Smuzhiyuntransformation for touchpads. Typical direct input devices: touchscreens,
316*4882a593Smuzhiyundrawing tablets; non-direct devices: touchpads, mice.
317*4882a593Smuzhiyun
318*4882a593SmuzhiyunThe INPUT_PROP_POINTER property indicates that the device is not transposed
319*4882a593Smuzhiyunon the screen and thus requires use of an on-screen pointer to trace user's
320*4882a593Smuzhiyunmovements.  Typical pointer devices: touchpads, tablets, mice; non-pointer
321*4882a593Smuzhiyundevice: touchscreen.
322*4882a593Smuzhiyun
323*4882a593SmuzhiyunIf neither INPUT_PROP_DIRECT or INPUT_PROP_POINTER are set, the property is
324*4882a593Smuzhiyunconsidered undefined and the device type should be deduced in the
325*4882a593Smuzhiyuntraditional way, using emitted event types.
326*4882a593Smuzhiyun
327*4882a593SmuzhiyunINPUT_PROP_BUTTONPAD
328*4882a593Smuzhiyun--------------------
329*4882a593Smuzhiyun
330*4882a593SmuzhiyunFor touchpads where the button is placed beneath the surface, such that
331*4882a593Smuzhiyunpressing down on the pad causes a button click, this property should be
332*4882a593Smuzhiyunset. Common in clickpad notebooks and macbooks from 2009 and onwards.
333*4882a593Smuzhiyun
334*4882a593SmuzhiyunOriginally, the buttonpad property was coded into the bcm5974 driver
335*4882a593Smuzhiyunversion field under the name integrated button. For backwards
336*4882a593Smuzhiyuncompatibility, both methods need to be checked in userspace.
337*4882a593Smuzhiyun
338*4882a593SmuzhiyunINPUT_PROP_SEMI_MT
339*4882a593Smuzhiyun------------------
340*4882a593Smuzhiyun
341*4882a593SmuzhiyunSome touchpads, most common between 2008 and 2011, can detect the presence
342*4882a593Smuzhiyunof multiple contacts without resolving the individual positions; only the
343*4882a593Smuzhiyunnumber of contacts and a rectangular shape is known. For such
344*4882a593Smuzhiyuntouchpads, the semi-mt property should be set.
345*4882a593Smuzhiyun
346*4882a593SmuzhiyunDepending on the device, the rectangle may enclose all touches, like a
347*4882a593Smuzhiyunbounding box, or just some of them, for instance the two most recent
348*4882a593Smuzhiyuntouches. The diversity makes the rectangle of limited use, but some
349*4882a593Smuzhiyungestures can normally be extracted from it.
350*4882a593Smuzhiyun
351*4882a593SmuzhiyunIf INPUT_PROP_SEMI_MT is not set, the device is assumed to be a true MT
352*4882a593Smuzhiyundevice.
353*4882a593Smuzhiyun
354*4882a593SmuzhiyunINPUT_PROP_TOPBUTTONPAD
355*4882a593Smuzhiyun-----------------------
356*4882a593Smuzhiyun
357*4882a593SmuzhiyunSome laptops, most notably the Lenovo 40 series provide a trackstick
358*4882a593Smuzhiyundevice but do not have physical buttons associated with the trackstick
359*4882a593Smuzhiyundevice. Instead, the top area of the touchpad is marked to show
360*4882a593Smuzhiyunvisual/haptic areas for left, middle, right buttons intended to be used
361*4882a593Smuzhiyunwith the trackstick.
362*4882a593Smuzhiyun
363*4882a593SmuzhiyunIf INPUT_PROP_TOPBUTTONPAD is set, userspace should emulate buttons
364*4882a593Smuzhiyunaccordingly. This property does not affect kernel behavior.
365*4882a593SmuzhiyunThe kernel does not provide button emulation for such devices but treats
366*4882a593Smuzhiyunthem as any other INPUT_PROP_BUTTONPAD device.
367*4882a593Smuzhiyun
368*4882a593SmuzhiyunINPUT_PROP_ACCELEROMETER
369*4882a593Smuzhiyun------------------------
370*4882a593Smuzhiyun
371*4882a593SmuzhiyunDirectional axes on this device (absolute and/or relative x, y, z) represent
372*4882a593Smuzhiyunaccelerometer data. Some devices also report gyroscope data, which devices
373*4882a593Smuzhiyuncan report through the rotational axes (absolute and/or relative rx, ry, rz).
374*4882a593Smuzhiyun
375*4882a593SmuzhiyunAll other axes retain their meaning. A device must not mix
376*4882a593Smuzhiyunregular directional axes and accelerometer axes on the same event node.
377*4882a593Smuzhiyun
378*4882a593SmuzhiyunGuidelines
379*4882a593Smuzhiyun==========
380*4882a593Smuzhiyun
381*4882a593SmuzhiyunThe guidelines below ensure proper single-touch and multi-finger functionality.
382*4882a593SmuzhiyunFor multi-touch functionality, see the multi-touch-protocol.txt document for
383*4882a593Smuzhiyunmore information.
384*4882a593Smuzhiyun
385*4882a593SmuzhiyunMice
386*4882a593Smuzhiyun----
387*4882a593Smuzhiyun
388*4882a593SmuzhiyunREL_{X,Y} must be reported when the mouse moves. BTN_LEFT must be used to report
389*4882a593Smuzhiyunthe primary button press. BTN_{MIDDLE,RIGHT,4,5,etc.} should be used to report
390*4882a593Smuzhiyunfurther buttons of the device. REL_WHEEL and REL_HWHEEL should be used to report
391*4882a593Smuzhiyunscroll wheel events where available.
392*4882a593Smuzhiyun
393*4882a593SmuzhiyunTouchscreens
394*4882a593Smuzhiyun------------
395*4882a593Smuzhiyun
396*4882a593SmuzhiyunABS_{X,Y} must be reported with the location of the touch. BTN_TOUCH must be
397*4882a593Smuzhiyunused to report when a touch is active on the screen.
398*4882a593SmuzhiyunBTN_{MOUSE,LEFT,MIDDLE,RIGHT} must not be reported as the result of touch
399*4882a593Smuzhiyuncontact. BTN_TOOL_<name> events should be reported where possible.
400*4882a593Smuzhiyun
401*4882a593SmuzhiyunFor new hardware, INPUT_PROP_DIRECT should be set.
402*4882a593Smuzhiyun
403*4882a593SmuzhiyunTrackpads
404*4882a593Smuzhiyun---------
405*4882a593Smuzhiyun
406*4882a593SmuzhiyunLegacy trackpads that only provide relative position information must report
407*4882a593Smuzhiyunevents like mice described above.
408*4882a593Smuzhiyun
409*4882a593SmuzhiyunTrackpads that provide absolute touch position must report ABS_{X,Y} for the
410*4882a593Smuzhiyunlocation of the touch. BTN_TOUCH should be used to report when a touch is active
411*4882a593Smuzhiyunon the trackpad. Where multi-finger support is available, BTN_TOOL_<name> should
412*4882a593Smuzhiyunbe used to report the number of touches active on the trackpad.
413*4882a593Smuzhiyun
414*4882a593SmuzhiyunFor new hardware, INPUT_PROP_POINTER should be set.
415*4882a593Smuzhiyun
416*4882a593SmuzhiyunTablets
417*4882a593Smuzhiyun-------
418*4882a593Smuzhiyun
419*4882a593SmuzhiyunBTN_TOOL_<name> events must be reported when a stylus or other tool is active on
420*4882a593Smuzhiyunthe tablet. ABS_{X,Y} must be reported with the location of the tool. BTN_TOUCH
421*4882a593Smuzhiyunshould be used to report when the tool is in contact with the tablet.
422*4882a593SmuzhiyunBTN_{STYLUS,STYLUS2} should be used to report buttons on the tool itself. Any
423*4882a593Smuzhiyunbutton may be used for buttons on the tablet except BTN_{MOUSE,LEFT}.
424*4882a593SmuzhiyunBTN_{0,1,2,etc} are good generic codes for unlabeled buttons. Do not use
425*4882a593Smuzhiyunmeaningful buttons, like BTN_FORWARD, unless the button is labeled for that
426*4882a593Smuzhiyunpurpose on the device.
427*4882a593Smuzhiyun
428*4882a593SmuzhiyunFor new hardware, both INPUT_PROP_DIRECT and INPUT_PROP_POINTER should be set.
429