summaryrefslogtreecommitdiffstats
path: root/Documentation/input
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@s-opensource.com>2017-04-04 20:46:28 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2017-04-05 18:44:59 -0400
commiteba31a3af9707bf5445f6d46fb7bff35086f16d3 (patch)
tree769c8317d6f8ee480614422080d347d67d33e7cd /Documentation/input
parentc8ae270e0eebe0030623ec671bb68358fc641ffc (diff)
Input: convert multi-touch protocol spec 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> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'Documentation/input')
-rw-r--r--Documentation/input/multi-touch-protocol.txt200
1 files changed, 96 insertions, 104 deletions
diff --git a/Documentation/input/multi-touch-protocol.txt b/Documentation/input/multi-touch-protocol.txt
index c51f1146f3bd..81775d7c1997 100644
--- a/Documentation/input/multi-touch-protocol.txt
+++ b/Documentation/input/multi-touch-protocol.txt
@@ -1,6 +1,10 @@
1.. include:: <isonum.txt>
2
3=========================
1Multi-touch (MT) Protocol 4Multi-touch (MT) Protocol
2------------------------- 5=========================
3 Copyright (C) 2009-2010 Henrik Rydberg <rydberg@euromail.se> 6
7:Copyright: |copy| 2009-2010 Henrik Rydberg <rydberg@euromail.se>
4 8
5 9
6Introduction 10Introduction
@@ -47,12 +51,12 @@ The main difference between the stateless type A protocol and the stateful
47type B slot protocol lies in the usage of identifiable contacts to reduce 51type B slot protocol lies in the usage of identifiable contacts to reduce
48the amount of data sent to userspace. The slot protocol requires the use of 52the amount of data sent to userspace. The slot protocol requires the use of
49the ABS_MT_TRACKING_ID, either provided by the hardware or computed from 53the ABS_MT_TRACKING_ID, either provided by the hardware or computed from
50the raw data [5]. 54the raw data [#f5]_.
51 55
52For type A devices, the kernel driver should generate an arbitrary 56For type A devices, the kernel driver should generate an arbitrary
53enumeration of the full set of anonymous contacts currently on the 57enumeration of the full set of anonymous contacts currently on the
54surface. The order in which the packets appear in the event stream is not 58surface. The order in which the packets appear in the event stream is not
55important. Event filtering and finger tracking is left to user space [3]. 59important. Event filtering and finger tracking is left to user space [#f3]_.
56 60
57For type B devices, the kernel driver should associate a slot with each 61For type B devices, the kernel driver should associate a slot with each
58identified contact, and use that slot to propagate changes for the contact. 62identified contact, and use that slot to propagate changes for the contact.
@@ -86,7 +90,7 @@ Protocol Example A
86------------------ 90------------------
87 91
88Here is what a minimal event sequence for a two-contact touch would look 92Here is what a minimal event sequence for a two-contact touch would look
89like for a type A device: 93like for a type A device::
90 94
91 ABS_MT_POSITION_X x[0] 95 ABS_MT_POSITION_X x[0]
92 ABS_MT_POSITION_Y y[0] 96 ABS_MT_POSITION_Y y[0]
@@ -100,14 +104,14 @@ The sequence after moving one of the contacts looks exactly the same; the
100raw data for all present contacts are sent between every synchronization 104raw data for all present contacts are sent between every synchronization
101with SYN_REPORT. 105with SYN_REPORT.
102 106
103Here is the sequence after lifting the first contact: 107Here is the sequence after lifting the first contact::
104 108
105 ABS_MT_POSITION_X x[1] 109 ABS_MT_POSITION_X x[1]
106 ABS_MT_POSITION_Y y[1] 110 ABS_MT_POSITION_Y y[1]
107 SYN_MT_REPORT 111 SYN_MT_REPORT
108 SYN_REPORT 112 SYN_REPORT
109 113
110And here is the sequence after lifting the second contact: 114And here is the sequence after lifting the second contact::
111 115
112 SYN_MT_REPORT 116 SYN_MT_REPORT
113 SYN_REPORT 117 SYN_REPORT
@@ -122,7 +126,7 @@ Protocol Example B
122------------------ 126------------------
123 127
124Here is what a minimal event sequence for a two-contact touch would look 128Here is what a minimal event sequence for a two-contact touch would look
125like for a type B device: 129like for a type B device::
126 130
127 ABS_MT_SLOT 0 131 ABS_MT_SLOT 0
128 ABS_MT_TRACKING_ID 45 132 ABS_MT_TRACKING_ID 45
@@ -134,13 +138,13 @@ like for a type B device:
134 ABS_MT_POSITION_Y y[1] 138 ABS_MT_POSITION_Y y[1]
135 SYN_REPORT 139 SYN_REPORT
136 140
137Here is the sequence after moving contact 45 in the x direction: 141Here is the sequence after moving contact 45 in the x direction::
138 142
139 ABS_MT_SLOT 0 143 ABS_MT_SLOT 0
140 ABS_MT_POSITION_X x[0] 144 ABS_MT_POSITION_X x[0]
141 SYN_REPORT 145 SYN_REPORT
142 146
143Here is the sequence after lifting the contact in slot 0: 147Here is the sequence after lifting the contact in slot 0::
144 148
145 ABS_MT_TRACKING_ID -1 149 ABS_MT_TRACKING_ID -1
146 SYN_REPORT 150 SYN_REPORT
@@ -149,7 +153,7 @@ The slot being modified is already 0, so the ABS_MT_SLOT is omitted. The
149message removes the association of slot 0 with contact 45, thereby 153message removes the association of slot 0 with contact 45, thereby
150destroying contact 45 and freeing slot 0 to be reused for another contact. 154destroying contact 45 and freeing slot 0 to be reused for another contact.
151 155
152Finally, here is the sequence after lifting the second contact: 156Finally, here is the sequence after lifting the second contact::
153 157
154 ABS_MT_SLOT 1 158 ABS_MT_SLOT 1
155 ABS_MT_TRACKING_ID -1 159 ABS_MT_TRACKING_ID -1
@@ -181,6 +185,8 @@ ABS_MT_PRESSURE may be used to provide the pressure on the contact area
181instead. Devices capable of contact hovering can use ABS_MT_DISTANCE to 185instead. Devices capable of contact hovering can use ABS_MT_DISTANCE to
182indicate the distance between the contact and the surface. 186indicate the distance between the contact and the surface.
183 187
188::
189
184 190
185 Linux MT Win8 191 Linux MT Win8
186 __________ _______________________ 192 __________ _______________________
@@ -212,7 +218,7 @@ via ABS_MT_BLOB_ID.
212 218
213The ABS_MT_TOOL_TYPE may be used to specify whether the touching tool is a 219The ABS_MT_TOOL_TYPE may be used to specify whether the touching tool is a
214finger or a pen or something else. Finally, the ABS_MT_TRACKING_ID event 220finger or a pen or something else. Finally, the ABS_MT_TRACKING_ID event
215may be used to track identified contacts over time [5]. 221may be used to track identified contacts over time [#f5]_.
216 222
217In the type B protocol, ABS_MT_TOOL_TYPE and ABS_MT_TRACKING_ID are 223In the type B protocol, ABS_MT_TOOL_TYPE and ABS_MT_TRACKING_ID are
218implicitly handled by input core; drivers should instead call 224implicitly handled by input core; drivers should instead call
@@ -223,117 +229,103 @@ Event Semantics
223--------------- 229---------------
224 230
225ABS_MT_TOUCH_MAJOR 231ABS_MT_TOUCH_MAJOR
226 232 The length of the major axis of the contact. The length should be given in
227The length of the major axis of the contact. The length should be given in 233 surface units. If the surface has an X times Y resolution, the largest
228surface units. If the surface has an X times Y resolution, the largest 234 possible value of ABS_MT_TOUCH_MAJOR is sqrt(X^2 + Y^2), the diagonal [#f4]_.
229possible value of ABS_MT_TOUCH_MAJOR is sqrt(X^2 + Y^2), the diagonal [4].
230 235
231ABS_MT_TOUCH_MINOR 236ABS_MT_TOUCH_MINOR
232 237 The length, in surface units, of the minor axis of the contact. If the
233The length, in surface units, of the minor axis of the contact. If the 238 contact is circular, this event can be omitted [#f4]_.
234contact is circular, this event can be omitted [4].
235 239
236ABS_MT_WIDTH_MAJOR 240ABS_MT_WIDTH_MAJOR
237 241 The length, in surface units, of the major axis of the approaching
238The length, in surface units, of the major axis of the approaching 242 tool. This should be understood as the size of the tool itself. The
239tool. This should be understood as the size of the tool itself. The 243 orientation of the contact and the approaching tool are assumed to be the
240orientation of the contact and the approaching tool are assumed to be the 244 same [#f4]_.
241same [4].
242 245
243ABS_MT_WIDTH_MINOR 246ABS_MT_WIDTH_MINOR
247 The length, in surface units, of the minor axis of the approaching
248 tool. Omit if circular [#f4]_.
244 249
245The length, in surface units, of the minor axis of the approaching 250 The above four values can be used to derive additional information about
246tool. Omit if circular [4]. 251 the contact. The ratio ABS_MT_TOUCH_MAJOR / ABS_MT_WIDTH_MAJOR approximates
247 252 the notion of pressure. The fingers of the hand and the palm all have
248The above four values can be used to derive additional information about 253 different characteristic widths.
249the contact. The ratio ABS_MT_TOUCH_MAJOR / ABS_MT_WIDTH_MAJOR approximates
250the notion of pressure. The fingers of the hand and the palm all have
251different characteristic widths.
252 254
253ABS_MT_PRESSURE 255ABS_MT_PRESSURE
254 256 The pressure, in arbitrary units, on the contact area. May be used instead
255The pressure, in arbitrary units, on the contact area. May be used instead 257 of TOUCH and WIDTH for pressure-based devices or any device with a spatial
256of TOUCH and WIDTH for pressure-based devices or any device with a spatial 258 signal intensity distribution.
257signal intensity distribution.
258 259
259ABS_MT_DISTANCE 260ABS_MT_DISTANCE
260 261 The distance, in surface units, between the contact and the surface. Zero
261The distance, in surface units, between the contact and the surface. Zero 262 distance means the contact is touching the surface. A positive number means
262distance means the contact is touching the surface. A positive number means 263 the contact is hovering above the surface.
263the contact is hovering above the surface.
264 264
265ABS_MT_ORIENTATION 265ABS_MT_ORIENTATION
266 266 The orientation of the touching ellipse. The value should describe a signed
267The orientation of the touching ellipse. The value should describe a signed 267 quarter of a revolution clockwise around the touch center. The signed value
268quarter of a revolution clockwise around the touch center. The signed value 268 range is arbitrary, but zero should be returned for an ellipse aligned with
269range is arbitrary, but zero should be returned for an ellipse aligned with 269 the Y axis of the surface, a negative value when the ellipse is turned to
270the Y axis of the surface, a negative value when the ellipse is turned to 270 the left, and a positive value when the ellipse is turned to the
271the left, and a positive value when the ellipse is turned to the 271 right. When completely aligned with the X axis, the range max should be
272right. When completely aligned with the X axis, the range max should be 272 returned.
273returned. 273
274 274 Touch ellipsis are symmetrical by default. For devices capable of true 360
275Touch ellipsis are symmetrical by default. For devices capable of true 360 275 degree orientation, the reported orientation must exceed the range max to
276degree orientation, the reported orientation must exceed the range max to 276 indicate more than a quarter of a revolution. For an upside-down finger,
277indicate more than a quarter of a revolution. For an upside-down finger, 277 range max * 2 should be returned.
278range max * 2 should be returned. 278
279 279 Orientation can be omitted if the touch area is circular, or if the
280Orientation can be omitted if the touch area is circular, or if the 280 information is not available in the kernel driver. Partial orientation
281information is not available in the kernel driver. Partial orientation 281 support is possible if the device can distinguish between the two axis, but
282support is possible if the device can distinguish between the two axis, but 282 not (uniquely) any values in between. In such cases, the range of
283not (uniquely) any values in between. In such cases, the range of 283 ABS_MT_ORIENTATION should be [0, 1] [#f4]_.
284ABS_MT_ORIENTATION should be [0, 1] [4].
285 284
286ABS_MT_POSITION_X 285ABS_MT_POSITION_X
287 286 The surface X coordinate of the center of the touching ellipse.
288The surface X coordinate of the center of the touching ellipse.
289 287
290ABS_MT_POSITION_Y 288ABS_MT_POSITION_Y
291 289 The surface Y coordinate of the center of the touching ellipse.
292The surface Y coordinate of the center of the touching ellipse.
293 290
294ABS_MT_TOOL_X 291ABS_MT_TOOL_X
295 292 The surface X coordinate of the center of the approaching tool. Omit if
296The surface X coordinate of the center of the approaching tool. Omit if 293 the device cannot distinguish between the intended touch point and the
297the device cannot distinguish between the intended touch point and the 294 tool itself.
298tool itself.
299 295
300ABS_MT_TOOL_Y 296ABS_MT_TOOL_Y
297 The surface Y coordinate of the center of the approaching tool. Omit if the
298 device cannot distinguish between the intended touch point and the tool
299 itself.
301 300
302The surface Y coordinate of the center of the approaching tool. Omit if the 301 The four position values can be used to separate the position of the touch
303device cannot distinguish between the intended touch point and the tool 302 from the position of the tool. If both positions are present, the major
304itself. 303 tool axis points towards the touch point [#f1]_. Otherwise, the tool axes are
305 304 aligned with the touch axes.
306The four position values can be used to separate the position of the touch
307from the position of the tool. If both positions are present, the major
308tool axis points towards the touch point [1]. Otherwise, the tool axes are
309aligned with the touch axes.
310 305
311ABS_MT_TOOL_TYPE 306ABS_MT_TOOL_TYPE
312 307 The type of approaching tool. A lot of kernel drivers cannot distinguish
313The type of approaching tool. A lot of kernel drivers cannot distinguish 308 between different tool types, such as a finger or a pen. In such cases, the
314between different tool types, such as a finger or a pen. In such cases, the 309 event should be omitted. The protocol currently supports MT_TOOL_FINGER,
315event should be omitted. The protocol currently supports MT_TOOL_FINGER, 310 MT_TOOL_PEN, and MT_TOOL_PALM [#f2]_. For type B devices, this event is
316MT_TOOL_PEN, and MT_TOOL_PALM [2]. For type B devices, this event is handled 311 handled by input core; drivers should instead use
317by input core; drivers should instead use input_mt_report_slot_state(). 312 input_mt_report_slot_state(). A contact's ABS_MT_TOOL_TYPE may change over
318A contact's ABS_MT_TOOL_TYPE may change over time while still touching the 313 time while still touching the device, because the firmware may not be able
319device, because the firmware may not be able to determine which tool is being 314 to determine which tool is being used when it first appears.
320used when it first appears.
321 315
322ABS_MT_BLOB_ID 316ABS_MT_BLOB_ID
323 317 The BLOB_ID groups several packets together into one arbitrarily shaped
324The BLOB_ID groups several packets together into one arbitrarily shaped 318 contact. The sequence of points forms a polygon which defines the shape of
325contact. The sequence of points forms a polygon which defines the shape of 319 the contact. This is a low-level anonymous grouping for type A devices, and
326the contact. This is a low-level anonymous grouping for type A devices, and 320 should not be confused with the high-level trackingID [#f5]_. Most type A
327should not be confused with the high-level trackingID [5]. Most type A 321 devices do not have blob capability, so drivers can safely omit this event.
328devices do not have blob capability, so drivers can safely omit this event.
329 322
330ABS_MT_TRACKING_ID 323ABS_MT_TRACKING_ID
331 324 The TRACKING_ID identifies an initiated contact throughout its life cycle
332The TRACKING_ID identifies an initiated contact throughout its life cycle 325 [#f5]_. The value range of the TRACKING_ID should be large enough to ensure
333[5]. The value range of the TRACKING_ID should be large enough to ensure 326 unique identification of a contact maintained over an extended period of
334unique identification of a contact maintained over an extended period of 327 time. For type B devices, this event is handled by input core; drivers
335time. For type B devices, this event is handled by input core; drivers 328 should instead use input_mt_report_slot_state().
336should instead use input_mt_report_slot_state().
337 329
338 330
339Event Computation 331Event Computation
@@ -346,7 +338,7 @@ this section gives recipes for how to compute certain events.
346For devices reporting contacts as rectangular shapes, signed orientation 338For devices reporting contacts as rectangular shapes, signed orientation
347cannot be obtained. Assuming X and Y are the lengths of the sides of the 339cannot be obtained. Assuming X and Y are the lengths of the sides of the
348touching rectangle, here is a simple formula that retains the most 340touching rectangle, here is a simple formula that retains the most
349information possible: 341information possible::
350 342
351 ABS_MT_TOUCH_MAJOR := max(X, Y) 343 ABS_MT_TOUCH_MAJOR := max(X, Y)
352 ABS_MT_TOUCH_MINOR := min(X, Y) 344 ABS_MT_TOUCH_MINOR := min(X, Y)
@@ -356,7 +348,7 @@ The range of ABS_MT_ORIENTATION should be set to [0, 1], to indicate that
356the device can distinguish between a finger along the Y axis (0) and a 348the device can distinguish between a finger along the Y axis (0) and a
357finger along the X axis (1). 349finger along the X axis (1).
358 350
359For win8 devices with both T and C coordinates, the position mapping is 351For win8 devices with both T and C coordinates, the position mapping is::
360 352
361 ABS_MT_POSITION_X := T_X 353 ABS_MT_POSITION_X := T_X
362 ABS_MT_POSITION_Y := T_Y 354 ABS_MT_POSITION_Y := T_Y
@@ -365,7 +357,7 @@ For win8 devices with both T and C coordinates, the position mapping is
365 357
366Unfortunately, there is not enough information to specify both the touching 358Unfortunately, there is not enough information to specify both the touching
367ellipse and the tool ellipse, so one has to resort to approximations. One 359ellipse and the tool ellipse, so one has to resort to approximations. One
368simple scheme, which is compatible with earlier usage, is: 360simple scheme, which is compatible with earlier usage, is::
369 361
370 ABS_MT_TOUCH_MAJOR := min(X, Y) 362 ABS_MT_TOUCH_MAJOR := min(X, Y)
371 ABS_MT_TOUCH_MINOR := <not used> 363 ABS_MT_TOUCH_MINOR := <not used>
@@ -386,7 +378,7 @@ The process of finger tracking, i.e., to assign a unique trackingID to each
386initiated contact on the surface, is a Euclidian Bipartite Matching 378initiated contact on the surface, is a Euclidian Bipartite Matching
387problem. At each event synchronization, the set of actual contacts is 379problem. At each event synchronization, the set of actual contacts is
388matched to the set of contacts from the previous synchronization. A full 380matched to the set of contacts from the previous synchronization. A full
389implementation can be found in [3]. 381implementation can be found in [#f3]_.
390 382
391 383
392Gestures 384Gestures
@@ -411,8 +403,8 @@ subsequent events of the same type refer to different fingers.
411For example usage of the type A protocol, see the bcm5974 driver. For 403For example usage of the type A protocol, see the bcm5974 driver. For
412example usage of the type B protocol, see the hid-egalax driver. 404example usage of the type B protocol, see the hid-egalax driver.
413 405
414[1] Also, the difference (TOOL_X - POSITION_X) can be used to model tilt. 406.. [#f1] Also, the difference (TOOL_X - POSITION_X) can be used to model tilt.
415[2] The list can of course be extended. 407.. [#f2] The list can of course be extended.
416[3] The mtdev project: http://bitmath.org/code/mtdev/. 408.. [#f3] The mtdev project: http://bitmath.org/code/mtdev/.
417[4] See the section on event computation. 409.. [#f4] See the section on event computation.
418[5] See the section on finger tracking. 410.. [#f5] See the section on finger tracking.