~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/input/multi-touch-protocol.rst

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /Documentation/input/multi-touch-protocol.rst (Version linux-6.12-rc7) and /Documentation/input/multi-touch-protocol.rst (Version linux-6.8.12)


  1 .. include:: <isonum.txt>                           1 .. include:: <isonum.txt>
  2                                                     2 
  3 =========================                           3 =========================
  4 Multi-touch (MT) Protocol                           4 Multi-touch (MT) Protocol
  5 =========================                           5 =========================
  6                                                     6 
  7 :Copyright: |copy| 2009-2010    Henrik Rydberg<      7 :Copyright: |copy| 2009-2010    Henrik Rydberg <rydberg@euromail.se>
  8                                                     8 
  9                                                     9 
 10 Introduction                                       10 Introduction
 11 ------------                                       11 ------------
 12                                                    12 
 13 In order to utilize the full power of the new      13 In order to utilize the full power of the new multi-touch and multi-user
 14 devices, a way to report detailed data from mu     14 devices, a way to report detailed data from multiple contacts, i.e.,
 15 objects in direct contact with the device surf     15 objects in direct contact with the device surface, is needed.  This
 16 document describes the multi-touch (MT) protoc     16 document describes the multi-touch (MT) protocol which allows kernel
 17 drivers to report details for an arbitrary num     17 drivers to report details for an arbitrary number of contacts.
 18                                                    18 
 19 The protocol is divided into two types, depend     19 The protocol is divided into two types, depending on the capabilities of the
 20 hardware. For devices handling anonymous conta     20 hardware. For devices handling anonymous contacts (type A), the protocol
 21 describes how to send the raw data for all con     21 describes how to send the raw data for all contacts to the receiver. For
 22 devices capable of tracking identifiable conta     22 devices capable of tracking identifiable contacts (type B), the protocol
 23 describes how to send updates for individual c     23 describes how to send updates for individual contacts via event slots.
 24                                                    24 
 25 .. note::                                          25 .. note::
 26    MT protocol type A is obsolete, all kernel      26    MT protocol type A is obsolete, all kernel drivers have been
 27    converted to use type B.                        27    converted to use type B.
 28                                                    28 
 29 Protocol Usage                                     29 Protocol Usage
 30 --------------                                     30 --------------
 31                                                    31 
 32 Contact details are sent sequentially as separ     32 Contact details are sent sequentially as separate packets of ABS_MT
 33 events. Only the ABS_MT events are recognized      33 events. Only the ABS_MT events are recognized as part of a contact
 34 packet. Since these events are ignored by curr     34 packet. Since these events are ignored by current single-touch (ST)
 35 applications, the MT protocol can be implement     35 applications, the MT protocol can be implemented on top of the ST protocol
 36 in an existing driver.                             36 in an existing driver.
 37                                                    37 
 38 Drivers for type A devices separate contact pa     38 Drivers for type A devices separate contact packets by calling
 39 input_mt_sync() at the end of each packet. Thi     39 input_mt_sync() at the end of each packet. This generates a SYN_MT_REPORT
 40 event, which instructs the receiver to accept      40 event, which instructs the receiver to accept the data for the current
 41 contact and prepare to receive another.            41 contact and prepare to receive another.
 42                                                    42 
 43 Drivers for type B devices separate contact pa     43 Drivers for type B devices separate contact packets by calling
 44 input_mt_slot(), with a slot as argument, at t     44 input_mt_slot(), with a slot as argument, at the beginning of each packet.
 45 This generates an ABS_MT_SLOT event, which ins     45 This generates an ABS_MT_SLOT event, which instructs the receiver to
 46 prepare for updates of the given slot.             46 prepare for updates of the given slot.
 47                                                    47 
 48 All drivers mark the end of a multi-touch tran     48 All drivers mark the end of a multi-touch transfer by calling the usual
 49 input_sync() function. This instructs the rece     49 input_sync() function. This instructs the receiver to act upon events
 50 accumulated since last EV_SYN/SYN_REPORT and p     50 accumulated since last EV_SYN/SYN_REPORT and prepare to receive a new set
 51 of events/packets.                                 51 of events/packets.
 52                                                    52 
 53 The main difference between the stateless type     53 The main difference between the stateless type A protocol and the stateful
 54 type B slot protocol lies in the usage of iden     54 type B slot protocol lies in the usage of identifiable contacts to reduce
 55 the amount of data sent to userspace. The slot     55 the amount of data sent to userspace. The slot protocol requires the use of
 56 the ABS_MT_TRACKING_ID, either provided by the     56 the ABS_MT_TRACKING_ID, either provided by the hardware or computed from
 57 the raw data [#f5]_.                               57 the raw data [#f5]_.
 58                                                    58 
 59 For type A devices, the kernel driver should g     59 For type A devices, the kernel driver should generate an arbitrary
 60 enumeration of the full set of anonymous conta     60 enumeration of the full set of anonymous contacts currently on the
 61 surface. The order in which the packets appear     61 surface. The order in which the packets appear in the event stream is not
 62 important.  Event filtering and finger trackin     62 important.  Event filtering and finger tracking is left to user space [#f3]_.
 63                                                    63 
 64 For type B devices, the kernel driver should a     64 For type B devices, the kernel driver should associate a slot with each
 65 identified contact, and use that slot to propa     65 identified contact, and use that slot to propagate changes for the contact.
 66 Creation, replacement and destruction of conta     66 Creation, replacement and destruction of contacts is achieved by modifying
 67 the ABS_MT_TRACKING_ID of the associated slot.     67 the ABS_MT_TRACKING_ID of the associated slot.  A non-negative tracking id
 68 is interpreted as a contact, and the value -1      68 is interpreted as a contact, and the value -1 denotes an unused slot.  A
 69 tracking id not previously present is consider     69 tracking id not previously present is considered new, and a tracking id no
 70 longer present is considered removed.  Since o     70 longer present is considered removed.  Since only changes are propagated,
 71 the full state of each initiated contact has t     71 the full state of each initiated contact has to reside in the receiving
 72 end.  Upon receiving an MT event, one simply u     72 end.  Upon receiving an MT event, one simply updates the appropriate
 73 attribute of the current slot.                     73 attribute of the current slot.
 74                                                    74 
 75 Some devices identify and/or track more contac     75 Some devices identify and/or track more contacts than they can report to the
 76 driver.  A driver for such a device should ass     76 driver.  A driver for such a device should associate one type B slot with each
 77 contact that is reported by the hardware.  Whe     77 contact that is reported by the hardware.  Whenever the identity of the
 78 contact associated with a slot changes, the dr     78 contact associated with a slot changes, the driver should invalidate that
 79 slot by changing its ABS_MT_TRACKING_ID.  If t     79 slot by changing its ABS_MT_TRACKING_ID.  If the hardware signals that it is
 80 tracking more contacts than it is currently re     80 tracking more contacts than it is currently reporting, the driver should use
 81 a BTN_TOOL_*TAP event to inform userspace of t     81 a BTN_TOOL_*TAP event to inform userspace of the total number of contacts
 82 being tracked by the hardware at that moment.      82 being tracked by the hardware at that moment.  The driver should do this by
 83 explicitly sending the corresponding BTN_TOOL_     83 explicitly sending the corresponding BTN_TOOL_*TAP event and setting
 84 use_count to false when calling input_mt_repor     84 use_count to false when calling input_mt_report_pointer_emulation().
 85 The driver should only advertise as many slots     85 The driver should only advertise as many slots as the hardware can report.
 86 Userspace can detect that a driver can report      86 Userspace can detect that a driver can report more total contacts than slots
 87 by noting that the largest supported BTN_TOOL_     87 by noting that the largest supported BTN_TOOL_*TAP event is larger than the
 88 total number of type B slots reported in the a     88 total number of type B slots reported in the absinfo for the ABS_MT_SLOT axis.
 89                                                    89 
 90 The minimum value of the ABS_MT_SLOT axis must     90 The minimum value of the ABS_MT_SLOT axis must be 0.
 91                                                    91 
 92 Protocol Example A                                 92 Protocol Example A
 93 ------------------                                 93 ------------------
 94                                                    94 
 95 Here is what a minimal event sequence for a tw     95 Here is what a minimal event sequence for a two-contact touch would look
 96 like for a type A device::                         96 like for a type A device::
 97                                                    97 
 98    ABS_MT_POSITION_X x[0]                          98    ABS_MT_POSITION_X x[0]
 99    ABS_MT_POSITION_Y y[0]                          99    ABS_MT_POSITION_Y y[0]
100    SYN_MT_REPORT                                  100    SYN_MT_REPORT
101    ABS_MT_POSITION_X x[1]                         101    ABS_MT_POSITION_X x[1]
102    ABS_MT_POSITION_Y y[1]                         102    ABS_MT_POSITION_Y y[1]
103    SYN_MT_REPORT                                  103    SYN_MT_REPORT
104    SYN_REPORT                                     104    SYN_REPORT
105                                                   105 
106 The sequence after moving one of the contacts     106 The sequence after moving one of the contacts looks exactly the same; the
107 raw data for all present contacts are sent bet    107 raw data for all present contacts are sent between every synchronization
108 with SYN_REPORT.                                  108 with SYN_REPORT.
109                                                   109 
110 Here is the sequence after lifting the first c    110 Here is the sequence after lifting the first contact::
111                                                   111 
112    ABS_MT_POSITION_X x[1]                         112    ABS_MT_POSITION_X x[1]
113    ABS_MT_POSITION_Y y[1]                         113    ABS_MT_POSITION_Y y[1]
114    SYN_MT_REPORT                                  114    SYN_MT_REPORT
115    SYN_REPORT                                     115    SYN_REPORT
116                                                   116 
117 And here is the sequence after lifting the sec    117 And here is the sequence after lifting the second contact::
118                                                   118 
119    SYN_MT_REPORT                                  119    SYN_MT_REPORT
120    SYN_REPORT                                     120    SYN_REPORT
121                                                   121 
122 If the driver reports one of BTN_TOUCH or ABS_    122 If the driver reports one of BTN_TOUCH or ABS_PRESSURE in addition to the
123 ABS_MT events, the last SYN_MT_REPORT event ma    123 ABS_MT events, the last SYN_MT_REPORT event may be omitted. Otherwise, the
124 last SYN_REPORT will be dropped by the input c    124 last SYN_REPORT will be dropped by the input core, resulting in no
125 zero-contact event reaching userland.             125 zero-contact event reaching userland.
126                                                   126 
127                                                   127 
128 Protocol Example B                                128 Protocol Example B
129 ------------------                                129 ------------------
130                                                   130 
131 Here is what a minimal event sequence for a tw    131 Here is what a minimal event sequence for a two-contact touch would look
132 like for a type B device::                        132 like for a type B device::
133                                                   133 
134    ABS_MT_SLOT 0                                  134    ABS_MT_SLOT 0
135    ABS_MT_TRACKING_ID 45                          135    ABS_MT_TRACKING_ID 45
136    ABS_MT_POSITION_X x[0]                         136    ABS_MT_POSITION_X x[0]
137    ABS_MT_POSITION_Y y[0]                         137    ABS_MT_POSITION_Y y[0]
138    ABS_MT_SLOT 1                                  138    ABS_MT_SLOT 1
139    ABS_MT_TRACKING_ID 46                          139    ABS_MT_TRACKING_ID 46
140    ABS_MT_POSITION_X x[1]                         140    ABS_MT_POSITION_X x[1]
141    ABS_MT_POSITION_Y y[1]                         141    ABS_MT_POSITION_Y y[1]
142    SYN_REPORT                                     142    SYN_REPORT
143                                                   143 
144 Here is the sequence after moving contact 45 i    144 Here is the sequence after moving contact 45 in the x direction::
145                                                   145 
146    ABS_MT_SLOT 0                                  146    ABS_MT_SLOT 0
147    ABS_MT_POSITION_X x[0]                         147    ABS_MT_POSITION_X x[0]
148    SYN_REPORT                                     148    SYN_REPORT
149                                                   149 
150 Here is the sequence after lifting the contact    150 Here is the sequence after lifting the contact in slot 0::
151                                                   151 
152    ABS_MT_TRACKING_ID -1                          152    ABS_MT_TRACKING_ID -1
153    SYN_REPORT                                     153    SYN_REPORT
154                                                   154 
155 The slot being modified is already 0, so the A    155 The slot being modified is already 0, so the ABS_MT_SLOT is omitted.  The
156 message removes the association of slot 0 with    156 message removes the association of slot 0 with contact 45, thereby
157 destroying contact 45 and freeing slot 0 to be    157 destroying contact 45 and freeing slot 0 to be reused for another contact.
158                                                   158 
159 Finally, here is the sequence after lifting th    159 Finally, here is the sequence after lifting the second contact::
160                                                   160 
161    ABS_MT_SLOT 1                                  161    ABS_MT_SLOT 1
162    ABS_MT_TRACKING_ID -1                          162    ABS_MT_TRACKING_ID -1
163    SYN_REPORT                                     163    SYN_REPORT
164                                                   164 
165                                                   165 
166 Event Usage                                       166 Event Usage
167 -----------                                       167 -----------
168                                                   168 
169 A set of ABS_MT events with the desired proper    169 A set of ABS_MT events with the desired properties is defined. The events
170 are divided into categories, to allow for part    170 are divided into categories, to allow for partial implementation.  The
171 minimum set consists of ABS_MT_POSITION_X and     171 minimum set consists of ABS_MT_POSITION_X and ABS_MT_POSITION_Y, which
172 allows for multiple contacts to be tracked.  I    172 allows for multiple contacts to be tracked.  If the device supports it, the
173 ABS_MT_TOUCH_MAJOR and ABS_MT_WIDTH_MAJOR may     173 ABS_MT_TOUCH_MAJOR and ABS_MT_WIDTH_MAJOR may be used to provide the size
174 of the contact area and approaching tool, resp    174 of the contact area and approaching tool, respectively.
175                                                   175 
176 The TOUCH and WIDTH parameters have a geometri    176 The TOUCH and WIDTH parameters have a geometrical interpretation; imagine
177 looking through a window at someone gently hol    177 looking through a window at someone gently holding a finger against the
178 glass.  You will see two regions, one inner re    178 glass.  You will see two regions, one inner region consisting of the part
179 of the finger actually touching the glass, and    179 of the finger actually touching the glass, and one outer region formed by
180 the perimeter of the finger. The center of the    180 the perimeter of the finger. The center of the touching region (a) is
181 ABS_MT_POSITION_X/Y and the center of the appr    181 ABS_MT_POSITION_X/Y and the center of the approaching finger (b) is
182 ABS_MT_TOOL_X/Y. The touch diameter is ABS_MT_    182 ABS_MT_TOOL_X/Y. The touch diameter is ABS_MT_TOUCH_MAJOR and the finger
183 diameter is ABS_MT_WIDTH_MAJOR. Now imagine th    183 diameter is ABS_MT_WIDTH_MAJOR. Now imagine the person pressing the finger
184 harder against the glass. The touch region wil    184 harder against the glass. The touch region will increase, and in general,
185 the ratio ABS_MT_TOUCH_MAJOR / ABS_MT_WIDTH_MA    185 the ratio ABS_MT_TOUCH_MAJOR / ABS_MT_WIDTH_MAJOR, which is always smaller
186 than unity, is related to the contact pressure    186 than unity, is related to the contact pressure. For pressure-based devices,
187 ABS_MT_PRESSURE may be used to provide the pre    187 ABS_MT_PRESSURE may be used to provide the pressure on the contact area
188 instead. Devices capable of contact hovering c    188 instead. Devices capable of contact hovering can use ABS_MT_DISTANCE to
189 indicate the distance between the contact and     189 indicate the distance between the contact and the surface.
190                                                   190 
191 ::                                                191 ::
192                                                   192 
193                                                   193 
194           Linux MT                                194           Linux MT                               Win8
195          __________                     ______    195          __________                     _______________________
196         /          \                   |          196         /          \                   |                       |
197        /            \                  |          197        /            \                  |                       |
198       /     ____     \                 |          198       /     ____     \                 |                       |
199      /     /    \     \                |          199      /     /    \     \                |                       |
200      \     \  a  \     \               |          200      \     \  a  \     \               |       a               |
201       \     \____/      \              |          201       \     \____/      \              |                       |
202        \                 \             |          202        \                 \             |                       |
203         \        b        \            |          203         \        b        \            |           b           |
204          \                 \           |          204          \                 \           |                       |
205           \                 \          |          205           \                 \          |                       |
206            \                 \         |          206            \                 \         |                       |
207             \                /         |          207             \                /         |                       |
208              \              /          |          208              \              /          |                       |
209               \            /           |          209               \            /           |                       |
210                \__________/            |______    210                \__________/            |_______________________|
211                                                   211 
212                                                   212 
213 In addition to the MAJOR parameters, the oval     213 In addition to the MAJOR parameters, the oval shape of the touch and finger
214 regions can be described by adding the MINOR p    214 regions can be described by adding the MINOR parameters, such that MAJOR
215 and MINOR are the major and minor axis of an e    215 and MINOR are the major and minor axis of an ellipse. The orientation of
216 the touch ellipse can be described with the OR    216 the touch ellipse can be described with the ORIENTATION parameter, and the
217 direction of the finger ellipse is given by th    217 direction of the finger ellipse is given by the vector (a - b).
218                                                   218 
219 For type A devices, further specification of t    219 For type A devices, further specification of the touch shape is possible
220 via ABS_MT_BLOB_ID.                               220 via ABS_MT_BLOB_ID.
221                                                   221 
222 The ABS_MT_TOOL_TYPE may be used to specify wh    222 The ABS_MT_TOOL_TYPE may be used to specify whether the touching tool is a
223 finger or a pen or something else. Finally, th    223 finger or a pen or something else. Finally, the ABS_MT_TRACKING_ID event
224 may be used to track identified contacts over     224 may be used to track identified contacts over time [#f5]_.
225                                                   225 
226 In the type B protocol, ABS_MT_TOOL_TYPE and A    226 In the type B protocol, ABS_MT_TOOL_TYPE and ABS_MT_TRACKING_ID are
227 implicitly handled by input core; drivers shou    227 implicitly handled by input core; drivers should instead call
228 input_mt_report_slot_state().                     228 input_mt_report_slot_state().
229                                                   229 
230                                                   230 
231 Event Semantics                                   231 Event Semantics
232 ---------------                                   232 ---------------
233                                                   233 
234 ABS_MT_TOUCH_MAJOR                                234 ABS_MT_TOUCH_MAJOR
235     The length of the major axis of the contac    235     The length of the major axis of the contact. The length should be given in
236     surface units. If the surface has an X tim    236     surface units. If the surface has an X times Y resolution, the largest
237     possible value of ABS_MT_TOUCH_MAJOR is sq    237     possible value of ABS_MT_TOUCH_MAJOR is sqrt(X^2 + Y^2), the diagonal [#f4]_.
238                                                   238 
239 ABS_MT_TOUCH_MINOR                                239 ABS_MT_TOUCH_MINOR
240     The length, in surface units, of the minor    240     The length, in surface units, of the minor axis of the contact. If the
241     contact is circular, this event can be omi    241     contact is circular, this event can be omitted [#f4]_.
242                                                   242 
243 ABS_MT_WIDTH_MAJOR                                243 ABS_MT_WIDTH_MAJOR
244     The length, in surface units, of the major    244     The length, in surface units, of the major axis of the approaching
245     tool. This should be understood as the siz    245     tool. This should be understood as the size of the tool itself. The
246     orientation of the contact and the approac    246     orientation of the contact and the approaching tool are assumed to be the
247     same [#f4]_.                                  247     same [#f4]_.
248                                                   248 
249 ABS_MT_WIDTH_MINOR                                249 ABS_MT_WIDTH_MINOR
250     The length, in surface units, of the minor    250     The length, in surface units, of the minor axis of the approaching
251     tool. Omit if circular [#f4]_.                251     tool. Omit if circular [#f4]_.
252                                                   252 
253     The above four values can be used to deriv    253     The above four values can be used to derive additional information about
254     the contact. The ratio ABS_MT_TOUCH_MAJOR     254     the contact. The ratio ABS_MT_TOUCH_MAJOR / ABS_MT_WIDTH_MAJOR approximates
255     the notion of pressure. The fingers of the    255     the notion of pressure. The fingers of the hand and the palm all have
256     different characteristic widths.              256     different characteristic widths.
257                                                   257 
258 ABS_MT_PRESSURE                                   258 ABS_MT_PRESSURE
259     The pressure, in arbitrary units, on the c    259     The pressure, in arbitrary units, on the contact area. May be used instead
260     of TOUCH and WIDTH for pressure-based devi    260     of TOUCH and WIDTH for pressure-based devices or any device with a spatial
261     signal intensity distribution.                261     signal intensity distribution.
262                                                   262 
263     If the resolution is zero, the pressure da    263     If the resolution is zero, the pressure data is in arbitrary units.
264     If the resolution is non-zero, the pressur    264     If the resolution is non-zero, the pressure data is in units/gram. See
265     :ref:`input-event-codes` for details.         265     :ref:`input-event-codes` for details.
266                                                   266 
267 ABS_MT_DISTANCE                                   267 ABS_MT_DISTANCE
268     The distance, in surface units, between th    268     The distance, in surface units, between the contact and the surface. Zero
269     distance means the contact is touching the    269     distance means the contact is touching the surface. A positive number means
270     the contact is hovering above the surface.    270     the contact is hovering above the surface.
271                                                   271 
272 ABS_MT_ORIENTATION                                272 ABS_MT_ORIENTATION
273     The orientation of the touching ellipse. T    273     The orientation of the touching ellipse. The value should describe a signed
274     quarter of a revolution clockwise around t    274     quarter of a revolution clockwise around the touch center. The signed value
275     range is arbitrary, but zero should be ret    275     range is arbitrary, but zero should be returned for an ellipse aligned with
276     the Y axis (north) of the surface, a negat    276     the Y axis (north) of the surface, a negative value when the ellipse is
277     turned to the left, and a positive value w    277     turned to the left, and a positive value when the ellipse is turned to the
278     right. When aligned with the X axis in the    278     right. When aligned with the X axis in the positive direction, the range
279     max should be returned; when aligned with     279     max should be returned; when aligned with the X axis in the negative
280     direction, the range -max should be return    280     direction, the range -max should be returned.
281                                                   281 
282     Touch ellipses are symmetrical by default.    282     Touch ellipses are symmetrical by default. For devices capable of true 360
283     degree orientation, the reported orientati    283     degree orientation, the reported orientation must exceed the range max to
284     indicate more than a quarter of a revoluti    284     indicate more than a quarter of a revolution. For an upside-down finger,
285     range max * 2 should be returned.             285     range max * 2 should be returned.
286                                                   286 
287     Orientation can be omitted if the touch ar    287     Orientation can be omitted if the touch area is circular, or if the
288     information is not available in the kernel    288     information is not available in the kernel driver. Partial orientation
289     support is possible if the device can dist    289     support is possible if the device can distinguish between the two axes, but
290     not (uniquely) any values in between. In s    290     not (uniquely) any values in between. In such cases, the range of
291     ABS_MT_ORIENTATION should be [0, 1] [#f4]_    291     ABS_MT_ORIENTATION should be [0, 1] [#f4]_.
292                                                   292 
293 ABS_MT_POSITION_X                                 293 ABS_MT_POSITION_X
294     The surface X coordinate of the center of     294     The surface X coordinate of the center of the touching ellipse.
295                                                   295 
296 ABS_MT_POSITION_Y                                 296 ABS_MT_POSITION_Y
297     The surface Y coordinate of the center of     297     The surface Y coordinate of the center of the touching ellipse.
298                                                   298 
299 ABS_MT_TOOL_X                                     299 ABS_MT_TOOL_X
300     The surface X coordinate of the center of     300     The surface X coordinate of the center of the approaching tool. Omit if
301     the device cannot distinguish between the     301     the device cannot distinguish between the intended touch point and the
302     tool itself.                                  302     tool itself.
303                                                   303 
304 ABS_MT_TOOL_Y                                     304 ABS_MT_TOOL_Y
305     The surface Y coordinate of the center of     305     The surface Y coordinate of the center of the approaching tool. Omit if the
306     device cannot distinguish between the inte    306     device cannot distinguish between the intended touch point and the tool
307     itself.                                       307     itself.
308                                                   308 
309     The four position values can be used to se    309     The four position values can be used to separate the position of the touch
310     from the position of the tool. If both pos    310     from the position of the tool. If both positions are present, the major
311     tool axis points towards the touch point [    311     tool axis points towards the touch point [#f1]_. Otherwise, the tool axes are
312     aligned with the touch axes.                  312     aligned with the touch axes.
313                                                   313 
314 ABS_MT_TOOL_TYPE                                  314 ABS_MT_TOOL_TYPE
315     The type of approaching tool. A lot of ker    315     The type of approaching tool. A lot of kernel drivers cannot distinguish
316     between different tool types, such as a fi    316     between different tool types, such as a finger or a pen. In such cases, the
317     event should be omitted. The protocol curr    317     event should be omitted. The protocol currently mainly supports
318     MT_TOOL_FINGER, MT_TOOL_PEN, and MT_TOOL_P    318     MT_TOOL_FINGER, MT_TOOL_PEN, and MT_TOOL_PALM [#f2]_.
319     For type B devices, this event is handled     319     For type B devices, this event is handled by input core; drivers should
320     instead use input_mt_report_slot_state().     320     instead use input_mt_report_slot_state(). A contact's ABS_MT_TOOL_TYPE may
321     change over time while still touching the     321     change over time while still touching the device, because the firmware may
322     not be able to determine which tool is bei    322     not be able to determine which tool is being used when it first appears.
323                                                   323 
324 ABS_MT_BLOB_ID                                    324 ABS_MT_BLOB_ID
325     The BLOB_ID groups several packets togethe    325     The BLOB_ID groups several packets together into one arbitrarily shaped
326     contact. The sequence of points forms a po    326     contact. The sequence of points forms a polygon which defines the shape of
327     the contact. This is a low-level anonymous    327     the contact. This is a low-level anonymous grouping for type A devices, and
328     should not be confused with the high-level    328     should not be confused with the high-level trackingID [#f5]_. Most type A
329     devices do not have blob capability, so dr    329     devices do not have blob capability, so drivers can safely omit this event.
330                                                   330 
331 ABS_MT_TRACKING_ID                                331 ABS_MT_TRACKING_ID
332     The TRACKING_ID identifies an initiated co    332     The TRACKING_ID identifies an initiated contact throughout its life cycle
333     [#f5]_. The value range of the TRACKING_ID    333     [#f5]_. The value range of the TRACKING_ID should be large enough to ensure
334     unique identification of a contact maintai    334     unique identification of a contact maintained over an extended period of
335     time. For type B devices, this event is ha    335     time. For type B devices, this event is handled by input core; drivers
336     should instead use input_mt_report_slot_st    336     should instead use input_mt_report_slot_state().
337                                                   337 
338                                                   338 
339 Event Computation                                 339 Event Computation
340 -----------------                                 340 -----------------
341                                                   341 
342 The flora of different hardware unavoidably le    342 The flora of different hardware unavoidably leads to some devices fitting
343 better to the MT protocol than others. To simp    343 better to the MT protocol than others. To simplify and unify the mapping,
344 this section gives recipes for how to compute     344 this section gives recipes for how to compute certain events.
345                                                   345 
346 For devices reporting contacts as rectangular     346 For devices reporting contacts as rectangular shapes, signed orientation
347 cannot be obtained. Assuming X and Y are the l    347 cannot be obtained. Assuming X and Y are the lengths of the sides of the
348 touching rectangle, here is a simple formula t    348 touching rectangle, here is a simple formula that retains the most
349 information possible::                            349 information possible::
350                                                   350 
351    ABS_MT_TOUCH_MAJOR := max(X, Y)                351    ABS_MT_TOUCH_MAJOR := max(X, Y)
352    ABS_MT_TOUCH_MINOR := min(X, Y)                352    ABS_MT_TOUCH_MINOR := min(X, Y)
353    ABS_MT_ORIENTATION := bool(X > Y)              353    ABS_MT_ORIENTATION := bool(X > Y)
354                                                   354 
355 The range of ABS_MT_ORIENTATION should be set     355 The range of ABS_MT_ORIENTATION should be set to [0, 1], to indicate that
356 the device can distinguish between a finger al    356 the device can distinguish between a finger along the Y axis (0) and a
357 finger along the X axis (1).                      357 finger along the X axis (1).
358                                                   358 
359 For Win8 devices with both T and C coordinates    359 For Win8 devices with both T and C coordinates, the position mapping is::
360                                                   360 
361    ABS_MT_POSITION_X := T_X                       361    ABS_MT_POSITION_X := T_X
362    ABS_MT_POSITION_Y := T_Y                       362    ABS_MT_POSITION_Y := T_Y
363    ABS_MT_TOOL_X := C_X                           363    ABS_MT_TOOL_X := C_X
364    ABS_MT_TOOL_Y := C_Y                           364    ABS_MT_TOOL_Y := C_Y
365                                                   365 
366 Unfortunately, there is not enough information    366 Unfortunately, there is not enough information to specify both the touching
367 ellipse and the tool ellipse, so one has to re    367 ellipse and the tool ellipse, so one has to resort to approximations.  One
368 simple scheme, which is compatible with earlie    368 simple scheme, which is compatible with earlier usage, is::
369                                                   369 
370    ABS_MT_TOUCH_MAJOR := min(X, Y)                370    ABS_MT_TOUCH_MAJOR := min(X, Y)
371    ABS_MT_TOUCH_MINOR := <not used>               371    ABS_MT_TOUCH_MINOR := <not used>
372    ABS_MT_ORIENTATION := <not used>               372    ABS_MT_ORIENTATION := <not used>
373    ABS_MT_WIDTH_MAJOR := min(X, Y) + distance(    373    ABS_MT_WIDTH_MAJOR := min(X, Y) + distance(T, C)
374    ABS_MT_WIDTH_MINOR := min(X, Y)                374    ABS_MT_WIDTH_MINOR := min(X, Y)
375                                                   375 
376 Rationale: We have no information about the or    376 Rationale: We have no information about the orientation of the touching
377 ellipse, so approximate it with an inscribed c    377 ellipse, so approximate it with an inscribed circle instead. The tool
378 ellipse should align with the vector (T - C),     378 ellipse should align with the vector (T - C), so the diameter must
379 increase with distance(T, C). Finally, assume     379 increase with distance(T, C). Finally, assume that the touch diameter is
380 equal to the tool thickness, and we arrive at     380 equal to the tool thickness, and we arrive at the formulas above.
381                                                   381 
382 Finger Tracking                                   382 Finger Tracking
383 ---------------                                   383 ---------------
384                                                   384 
385 The process of finger tracking, i.e., to assig    385 The process of finger tracking, i.e., to assign a unique trackingID to each
386 initiated contact on the surface, is a Euclide    386 initiated contact on the surface, is a Euclidean Bipartite Matching
387 problem.  At each event synchronization, the s    387 problem.  At each event synchronization, the set of actual contacts is
388 matched to the set of contacts from the previo    388 matched to the set of contacts from the previous synchronization. A full
389 implementation can be found in [#f3]_.            389 implementation can be found in [#f3]_.
390                                                   390 
391                                                   391 
392 Gestures                                          392 Gestures
393 --------                                          393 --------
394                                                   394 
395 In the specific application of creating gestur    395 In the specific application of creating gesture events, the TOUCH and WIDTH
396 parameters can be used to, e.g., approximate f    396 parameters can be used to, e.g., approximate finger pressure or distinguish
397 between index finger and thumb. With the addit    397 between index finger and thumb. With the addition of the MINOR parameters,
398 one can also distinguish between a sweeping fi    398 one can also distinguish between a sweeping finger and a pointing finger,
399 and with ORIENTATION, one can detect twisting     399 and with ORIENTATION, one can detect twisting of fingers.
400                                                   400 
401                                                   401 
402 Notes                                             402 Notes
403 -----                                             403 -----
404                                                   404 
405 In order to stay compatible with existing appl    405 In order to stay compatible with existing applications, the data reported
406 in a finger packet must not be recognized as s    406 in a finger packet must not be recognized as single-touch events.
407                                                   407 
408 For type A devices, all finger data bypasses i    408 For type A devices, all finger data bypasses input filtering, since
409 subsequent events of the same type refer to di    409 subsequent events of the same type refer to different fingers.
410                                                   410 
411 .. [#f1] Also, the difference (TOOL_X - POSITI    411 .. [#f1] Also, the difference (TOOL_X - POSITION_X) can be used to model tilt.
412 .. [#f2] The list can of course be extended.      412 .. [#f2] The list can of course be extended.
413 .. [#f3] The mtdev project: http://bitmath.org    413 .. [#f3] The mtdev project: http://bitmath.org/code/mtdev/.
414 .. [#f4] See the section on event computation.    414 .. [#f4] See the section on event computation.
415 .. [#f5] See the section on finger tracking.      415 .. [#f5] See the section on finger tracking.
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php