diff options
author | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-04-04 20:46:28 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2017-04-05 18:44:59 -0400 |
commit | eba31a3af9707bf5445f6d46fb7bff35086f16d3 (patch) | |
tree | 769c8317d6f8ee480614422080d347d67d33e7cd /Documentation/input | |
parent | c8ae270e0eebe0030623ec671bb68358fc641ffc (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.txt | 200 |
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 | ========================= | ||
1 | Multi-touch (MT) Protocol | 4 | Multi-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 | ||
6 | Introduction | 10 | Introduction |
@@ -47,12 +51,12 @@ The main difference between the stateless type A protocol and the stateful | |||
47 | type B slot protocol lies in the usage of identifiable contacts to reduce | 51 | type B slot protocol lies in the usage of identifiable contacts to reduce |
48 | the amount of data sent to userspace. The slot protocol requires the use of | 52 | the amount of data sent to userspace. The slot protocol requires the use of |
49 | the ABS_MT_TRACKING_ID, either provided by the hardware or computed from | 53 | the ABS_MT_TRACKING_ID, either provided by the hardware or computed from |
50 | the raw data [5]. | 54 | the raw data [#f5]_. |
51 | 55 | ||
52 | For type A devices, the kernel driver should generate an arbitrary | 56 | For type A devices, the kernel driver should generate an arbitrary |
53 | enumeration of the full set of anonymous contacts currently on the | 57 | enumeration of the full set of anonymous contacts currently on the |
54 | surface. The order in which the packets appear in the event stream is not | 58 | surface. The order in which the packets appear in the event stream is not |
55 | important. Event filtering and finger tracking is left to user space [3]. | 59 | important. Event filtering and finger tracking is left to user space [#f3]_. |
56 | 60 | ||
57 | For type B devices, the kernel driver should associate a slot with each | 61 | For type B devices, the kernel driver should associate a slot with each |
58 | identified contact, and use that slot to propagate changes for the contact. | 62 | identified contact, and use that slot to propagate changes for the contact. |
@@ -86,7 +90,7 @@ Protocol Example A | |||
86 | ------------------ | 90 | ------------------ |
87 | 91 | ||
88 | Here is what a minimal event sequence for a two-contact touch would look | 92 | Here is what a minimal event sequence for a two-contact touch would look |
89 | like for a type A device: | 93 | like 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 | |||
100 | raw data for all present contacts are sent between every synchronization | 104 | raw data for all present contacts are sent between every synchronization |
101 | with SYN_REPORT. | 105 | with SYN_REPORT. |
102 | 106 | ||
103 | Here is the sequence after lifting the first contact: | 107 | Here 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 | ||
110 | And here is the sequence after lifting the second contact: | 114 | And 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 | ||
124 | Here is what a minimal event sequence for a two-contact touch would look | 128 | Here is what a minimal event sequence for a two-contact touch would look |
125 | like for a type B device: | 129 | like 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 | ||
137 | Here is the sequence after moving contact 45 in the x direction: | 141 | Here 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 | ||
143 | Here is the sequence after lifting the contact in slot 0: | 147 | Here 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 | |||
149 | message removes the association of slot 0 with contact 45, thereby | 153 | message removes the association of slot 0 with contact 45, thereby |
150 | destroying contact 45 and freeing slot 0 to be reused for another contact. | 154 | destroying contact 45 and freeing slot 0 to be reused for another contact. |
151 | 155 | ||
152 | Finally, here is the sequence after lifting the second contact: | 156 | Finally, 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 | |||
181 | instead. Devices capable of contact hovering can use ABS_MT_DISTANCE to | 185 | instead. Devices capable of contact hovering can use ABS_MT_DISTANCE to |
182 | indicate the distance between the contact and the surface. | 186 | indicate 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 | ||
213 | The ABS_MT_TOOL_TYPE may be used to specify whether the touching tool is a | 219 | The ABS_MT_TOOL_TYPE may be used to specify whether the touching tool is a |
214 | finger or a pen or something else. Finally, the ABS_MT_TRACKING_ID event | 220 | finger or a pen or something else. Finally, the ABS_MT_TRACKING_ID event |
215 | may be used to track identified contacts over time [5]. | 221 | may be used to track identified contacts over time [#f5]_. |
216 | 222 | ||
217 | In the type B protocol, ABS_MT_TOOL_TYPE and ABS_MT_TRACKING_ID are | 223 | In the type B protocol, ABS_MT_TOOL_TYPE and ABS_MT_TRACKING_ID are |
218 | implicitly handled by input core; drivers should instead call | 224 | implicitly handled by input core; drivers should instead call |
@@ -223,117 +229,103 @@ Event Semantics | |||
223 | --------------- | 229 | --------------- |
224 | 230 | ||
225 | ABS_MT_TOUCH_MAJOR | 231 | ABS_MT_TOUCH_MAJOR |
226 | 232 | The length of the major axis of the contact. The length should be given in | |
227 | The 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 |
228 | surface 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]_. |
229 | possible value of ABS_MT_TOUCH_MAJOR is sqrt(X^2 + Y^2), the diagonal [4]. | ||
230 | 235 | ||
231 | ABS_MT_TOUCH_MINOR | 236 | ABS_MT_TOUCH_MINOR |
232 | 237 | The length, in surface units, of the minor axis of the contact. If the | |
233 | The length, in surface units, of the minor axis of the contact. If the | 238 | contact is circular, this event can be omitted [#f4]_. |
234 | contact is circular, this event can be omitted [4]. | ||
235 | 239 | ||
236 | ABS_MT_WIDTH_MAJOR | 240 | ABS_MT_WIDTH_MAJOR |
237 | 241 | The length, in surface units, of the major axis of the approaching | |
238 | The 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 |
239 | tool. 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 |
240 | orientation of the contact and the approaching tool are assumed to be the | 244 | same [#f4]_. |
241 | same [4]. | ||
242 | 245 | ||
243 | ABS_MT_WIDTH_MINOR | 246 | ABS_MT_WIDTH_MINOR |
247 | The length, in surface units, of the minor axis of the approaching | ||
248 | tool. Omit if circular [#f4]_. | ||
244 | 249 | ||
245 | The length, in surface units, of the minor axis of the approaching | 250 | The above four values can be used to derive additional information about |
246 | tool. 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 | |
248 | The above four values can be used to derive additional information about | 253 | different characteristic widths. |
249 | the contact. The ratio ABS_MT_TOUCH_MAJOR / ABS_MT_WIDTH_MAJOR approximates | ||
250 | the notion of pressure. The fingers of the hand and the palm all have | ||
251 | different characteristic widths. | ||
252 | 254 | ||
253 | ABS_MT_PRESSURE | 255 | ABS_MT_PRESSURE |
254 | 256 | The pressure, in arbitrary units, on the contact area. May be used instead | |
255 | The 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 |
256 | of TOUCH and WIDTH for pressure-based devices or any device with a spatial | 258 | signal intensity distribution. |
257 | signal intensity distribution. | ||
258 | 259 | ||
259 | ABS_MT_DISTANCE | 260 | ABS_MT_DISTANCE |
260 | 261 | The distance, in surface units, between the contact and the surface. Zero | |
261 | The distance, in surface units, between the contact and the surface. Zero | 262 | distance means the contact is touching the surface. A positive number means |
262 | distance means the contact is touching the surface. A positive number means | 263 | the contact is hovering above the surface. |
263 | the contact is hovering above the surface. | ||
264 | 264 | ||
265 | ABS_MT_ORIENTATION | 265 | ABS_MT_ORIENTATION |
266 | 266 | The orientation of the touching ellipse. The value should describe a signed | |
267 | The orientation of the touching ellipse. The value should describe a signed | 267 | quarter of a revolution clockwise around the touch center. The signed value |
268 | quarter 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 |
269 | range 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 |
270 | the 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 |
271 | the 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 |
272 | right. When completely aligned with the X axis, the range max should be | 272 | returned. |
273 | returned. | 273 | |
274 | 274 | Touch ellipsis are symmetrical by default. For devices capable of true 360 | |
275 | Touch ellipsis are symmetrical by default. For devices capable of true 360 | 275 | degree orientation, the reported orientation must exceed the range max to |
276 | degree orientation, the reported orientation must exceed the range max to | 276 | indicate more than a quarter of a revolution. For an upside-down finger, |
277 | indicate more than a quarter of a revolution. For an upside-down finger, | 277 | range max * 2 should be returned. |
278 | range max * 2 should be returned. | 278 | |
279 | 279 | Orientation can be omitted if the touch area is circular, or if the | |
280 | Orientation can be omitted if the touch area is circular, or if the | 280 | information is not available in the kernel driver. Partial orientation |
281 | information is not available in the kernel driver. Partial orientation | 281 | support is possible if the device can distinguish between the two axis, but |
282 | support 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 |
283 | not (uniquely) any values in between. In such cases, the range of | 283 | ABS_MT_ORIENTATION should be [0, 1] [#f4]_. |
284 | ABS_MT_ORIENTATION should be [0, 1] [4]. | ||
285 | 284 | ||
286 | ABS_MT_POSITION_X | 285 | ABS_MT_POSITION_X |
287 | 286 | The surface X coordinate of the center of the touching ellipse. | |
288 | The surface X coordinate of the center of the touching ellipse. | ||
289 | 287 | ||
290 | ABS_MT_POSITION_Y | 288 | ABS_MT_POSITION_Y |
291 | 289 | The surface Y coordinate of the center of the touching ellipse. | |
292 | The surface Y coordinate of the center of the touching ellipse. | ||
293 | 290 | ||
294 | ABS_MT_TOOL_X | 291 | ABS_MT_TOOL_X |
295 | 292 | The surface X coordinate of the center of the approaching tool. Omit if | |
296 | The surface X coordinate of the center of the approaching tool. Omit if | 293 | the device cannot distinguish between the intended touch point and the |
297 | the device cannot distinguish between the intended touch point and the | 294 | tool itself. |
298 | tool itself. | ||
299 | 295 | ||
300 | ABS_MT_TOOL_Y | 296 | ABS_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 | ||
302 | The 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 |
303 | device cannot distinguish between the intended touch point and the tool | 302 | from the position of the tool. If both positions are present, the major |
304 | itself. | 303 | tool axis points towards the touch point [#f1]_. Otherwise, the tool axes are |
305 | 304 | aligned with the touch axes. | |
306 | The four position values can be used to separate the position of the touch | ||
307 | from the position of the tool. If both positions are present, the major | ||
308 | tool axis points towards the touch point [1]. Otherwise, the tool axes are | ||
309 | aligned with the touch axes. | ||
310 | 305 | ||
311 | ABS_MT_TOOL_TYPE | 306 | ABS_MT_TOOL_TYPE |
312 | 307 | The type of approaching tool. A lot of kernel drivers cannot distinguish | |
313 | The 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 |
314 | between 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, |
315 | event 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 |
316 | MT_TOOL_PEN, and MT_TOOL_PALM [2]. For type B devices, this event is handled | 311 | handled by input core; drivers should instead use |
317 | by 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 |
318 | A 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 |
319 | device, 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. |
320 | used when it first appears. | ||
321 | 315 | ||
322 | ABS_MT_BLOB_ID | 316 | ABS_MT_BLOB_ID |
323 | 317 | The BLOB_ID groups several packets together into one arbitrarily shaped | |
324 | The BLOB_ID groups several packets together into one arbitrarily shaped | 318 | contact. The sequence of points forms a polygon which defines the shape of |
325 | contact. 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 |
326 | the 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 |
327 | should 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. |
328 | devices do not have blob capability, so drivers can safely omit this event. | ||
329 | 322 | ||
330 | ABS_MT_TRACKING_ID | 323 | ABS_MT_TRACKING_ID |
331 | 324 | The TRACKING_ID identifies an initiated contact throughout its life cycle | |
332 | The 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 |
334 | unique identification of a contact maintained over an extended period of | 327 | time. For type B devices, this event is handled by input core; drivers |
335 | time. For type B devices, this event is handled by input core; drivers | 328 | should instead use input_mt_report_slot_state(). |
336 | should instead use input_mt_report_slot_state(). | ||
337 | 329 | ||
338 | 330 | ||
339 | Event Computation | 331 | Event Computation |
@@ -346,7 +338,7 @@ this section gives recipes for how to compute certain events. | |||
346 | For devices reporting contacts as rectangular shapes, signed orientation | 338 | For devices reporting contacts as rectangular shapes, signed orientation |
347 | cannot be obtained. Assuming X and Y are the lengths of the sides of the | 339 | cannot be obtained. Assuming X and Y are the lengths of the sides of the |
348 | touching rectangle, here is a simple formula that retains the most | 340 | touching rectangle, here is a simple formula that retains the most |
349 | information possible: | 341 | information 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 | |||
356 | the device can distinguish between a finger along the Y axis (0) and a | 348 | the device can distinguish between a finger along the Y axis (0) and a |
357 | finger along the X axis (1). | 349 | finger along the X axis (1). |
358 | 350 | ||
359 | For win8 devices with both T and C coordinates, the position mapping is | 351 | For 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 | ||
366 | Unfortunately, there is not enough information to specify both the touching | 358 | Unfortunately, there is not enough information to specify both the touching |
367 | ellipse and the tool ellipse, so one has to resort to approximations. One | 359 | ellipse and the tool ellipse, so one has to resort to approximations. One |
368 | simple scheme, which is compatible with earlier usage, is: | 360 | simple 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 | |||
386 | initiated contact on the surface, is a Euclidian Bipartite Matching | 378 | initiated contact on the surface, is a Euclidian Bipartite Matching |
387 | problem. At each event synchronization, the set of actual contacts is | 379 | problem. At each event synchronization, the set of actual contacts is |
388 | matched to the set of contacts from the previous synchronization. A full | 380 | matched to the set of contacts from the previous synchronization. A full |
389 | implementation can be found in [3]. | 381 | implementation can be found in [#f3]_. |
390 | 382 | ||
391 | 383 | ||
392 | Gestures | 384 | Gestures |
@@ -411,8 +403,8 @@ subsequent events of the same type refer to different fingers. | |||
411 | For example usage of the type A protocol, see the bcm5974 driver. For | 403 | For example usage of the type A protocol, see the bcm5974 driver. For |
412 | example usage of the type B protocol, see the hid-egalax driver. | 404 | example 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. |