~ [ 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 unix-v6-master)


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