diff options
author | Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com> | 2017-04-10 02:25:27 -0400 |
---|---|---|
committer | Juergen Gross <jgross@suse.com> | 2017-05-02 05:12:56 -0400 |
commit | f9ebfc22cc15c06ba61563c885f40a4bc07cccea (patch) | |
tree | b3d7bd50a7a8dc9f6edc0d339e17eedb8c241ce8 | |
parent | 8ec9dd0e69cfaab05649ed7ab3838eb4eea96081 (diff) |
xen/kbdif: add multi-touch support
Multi-touch fields re-use the page that is used by the other features
which means that you can interleave multi-touch, motion, and key
events.
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Acked-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
-rw-r--r-- | include/xen/interface/io/kbdif.h | 210 |
1 files changed, 210 insertions, 0 deletions
diff --git a/include/xen/interface/io/kbdif.h b/include/xen/interface/io/kbdif.h index 7adfb15fec9d..2a9510ade701 100644 --- a/include/xen/interface/io/kbdif.h +++ b/include/xen/interface/io/kbdif.h | |||
@@ -57,6 +57,12 @@ | |||
57 | * Backends, which support reporting of absolute coordinates for pointer | 57 | * Backends, which support reporting of absolute coordinates for pointer |
58 | * device should set this to 1. | 58 | * device should set this to 1. |
59 | * | 59 | * |
60 | * feature-multi-touch | ||
61 | * Values: <uint> | ||
62 | * | ||
63 | * Backends, which support reporting of multi-touch events | ||
64 | * should set this to 1. | ||
65 | * | ||
60 | *------------------------- Pointer Device Parameters ------------------------ | 66 | *------------------------- Pointer Device Parameters ------------------------ |
61 | * | 67 | * |
62 | * width | 68 | * width |
@@ -87,6 +93,11 @@ | |||
87 | * Request backend to report absolute pointer coordinates | 93 | * Request backend to report absolute pointer coordinates |
88 | * (XENKBD_TYPE_POS) instead of relative ones (XENKBD_TYPE_MOTION). | 94 | * (XENKBD_TYPE_POS) instead of relative ones (XENKBD_TYPE_MOTION). |
89 | * | 95 | * |
96 | * request-multi-touch | ||
97 | * Values: <uint> | ||
98 | * | ||
99 | * Request backend to report multi-touch events. | ||
100 | * | ||
90 | *----------------------- Request Transport Parameters ----------------------- | 101 | *----------------------- Request Transport Parameters ----------------------- |
91 | * | 102 | * |
92 | * event-channel | 103 | * event-channel |
@@ -106,6 +117,25 @@ | |||
106 | * | 117 | * |
107 | * OBSOLETE, not recommended for use. | 118 | * OBSOLETE, not recommended for use. |
108 | * PFN of the shared page. | 119 | * PFN of the shared page. |
120 | * | ||
121 | *----------------------- Multi-touch Device Parameters ----------------------- | ||
122 | * | ||
123 | * multi-touch-num-contacts | ||
124 | * Values: <uint> | ||
125 | * | ||
126 | * Number of simultaneous touches reported. | ||
127 | * | ||
128 | * multi-touch-width | ||
129 | * Values: <uint> | ||
130 | * | ||
131 | * Width of the touch area to be used by the frontend | ||
132 | * while reporting input events, pixels, [0; UINT32_MAX]. | ||
133 | * | ||
134 | * multi-touch-height | ||
135 | * Values: <uint> | ||
136 | * | ||
137 | * Height of the touch area to be used by the frontend | ||
138 | * while reporting input events, pixels, [0; UINT32_MAX]. | ||
109 | */ | 139 | */ |
110 | 140 | ||
111 | /* | 141 | /* |
@@ -116,6 +146,16 @@ | |||
116 | #define XENKBD_TYPE_RESERVED 2 | 146 | #define XENKBD_TYPE_RESERVED 2 |
117 | #define XENKBD_TYPE_KEY 3 | 147 | #define XENKBD_TYPE_KEY 3 |
118 | #define XENKBD_TYPE_POS 4 | 148 | #define XENKBD_TYPE_POS 4 |
149 | #define XENKBD_TYPE_MTOUCH 5 | ||
150 | |||
151 | /* Multi-touch event sub-codes */ | ||
152 | |||
153 | #define XENKBD_MT_EV_DOWN 0 | ||
154 | #define XENKBD_MT_EV_UP 1 | ||
155 | #define XENKBD_MT_EV_MOTION 2 | ||
156 | #define XENKBD_MT_EV_SYN 3 | ||
157 | #define XENKBD_MT_EV_SHAPE 4 | ||
158 | #define XENKBD_MT_EV_ORIENT 5 | ||
119 | 159 | ||
120 | /* | 160 | /* |
121 | * CONSTANTS, XENSTORE FIELD AND PATH NAME STRINGS, HELPERS. | 161 | * CONSTANTS, XENSTORE FIELD AND PATH NAME STRINGS, HELPERS. |
@@ -124,11 +164,16 @@ | |||
124 | #define XENKBD_DRIVER_NAME "vkbd" | 164 | #define XENKBD_DRIVER_NAME "vkbd" |
125 | 165 | ||
126 | #define XENKBD_FIELD_FEAT_ABS_POINTER "feature-abs-pointer" | 166 | #define XENKBD_FIELD_FEAT_ABS_POINTER "feature-abs-pointer" |
167 | #define XENKBD_FIELD_FEAT_MTOUCH "feature-multi-touch" | ||
127 | #define XENKBD_FIELD_REQ_ABS_POINTER "request-abs-pointer" | 168 | #define XENKBD_FIELD_REQ_ABS_POINTER "request-abs-pointer" |
169 | #define XENKBD_FIELD_REQ_MTOUCH "request-multi-touch" | ||
128 | #define XENKBD_FIELD_RING_GREF "page-gref" | 170 | #define XENKBD_FIELD_RING_GREF "page-gref" |
129 | #define XENKBD_FIELD_EVT_CHANNEL "event-channel" | 171 | #define XENKBD_FIELD_EVT_CHANNEL "event-channel" |
130 | #define XENKBD_FIELD_WIDTH "width" | 172 | #define XENKBD_FIELD_WIDTH "width" |
131 | #define XENKBD_FIELD_HEIGHT "height" | 173 | #define XENKBD_FIELD_HEIGHT "height" |
174 | #define XENKBD_FIELD_MT_WIDTH "multi-touch-width" | ||
175 | #define XENKBD_FIELD_MT_HEIGHT "multi-touch-height" | ||
176 | #define XENKBD_FIELD_MT_NUM_CONTACTS "multi-touch-num-contacts" | ||
132 | 177 | ||
133 | /* OBSOLETE, not recommended for use */ | 178 | /* OBSOLETE, not recommended for use */ |
134 | #define XENKBD_FIELD_RING_REF "page-ref" | 179 | #define XENKBD_FIELD_RING_REF "page-ref" |
@@ -245,6 +290,170 @@ struct xenkbd_position { | |||
245 | int32_t rel_z; | 290 | int32_t rel_z; |
246 | }; | 291 | }; |
247 | 292 | ||
293 | /* | ||
294 | * Multi-touch event and its sub-types | ||
295 | * | ||
296 | * All multi-touch event packets have common header: | ||
297 | * | ||
298 | * 0 1 2 3 octet | ||
299 | * +----------------+----------------+----------------+----------------+ | ||
300 | * | _TYPE_MTOUCH | event_type | contact_id | reserved | 4 | ||
301 | * +----------------+----------------+----------------+----------------+ | ||
302 | * | reserved | 8 | ||
303 | * +----------------+----------------+----------------+----------------+ | ||
304 | * | ||
305 | * event_type - unt8_t, multi-touch event sub-type, XENKBD_MT_EV_??? | ||
306 | * contact_id - unt8_t, ID of the contact | ||
307 | * | ||
308 | * Touch interactions can consist of one or more contacts. | ||
309 | * For each contact, a series of events is generated, starting | ||
310 | * with a down event, followed by zero or more motion events, | ||
311 | * and ending with an up event. Events relating to the same | ||
312 | * contact point can be identified by the ID of the sequence: contact ID. | ||
313 | * Contact ID may be reused after XENKBD_MT_EV_UP event and | ||
314 | * is in the [0; XENKBD_FIELD_NUM_CONTACTS - 1] range. | ||
315 | * | ||
316 | * For further information please refer to documentation on Wayland [1], | ||
317 | * Linux [2] and Windows [3] multi-touch support. | ||
318 | * | ||
319 | * [1] https://cgit.freedesktop.org/wayland/wayland/tree/protocol/wayland.xml | ||
320 | * [2] https://www.kernel.org/doc/Documentation/input/multi-touch-protocol.txt | ||
321 | * [3] https://msdn.microsoft.com/en-us/library/jj151564(v=vs.85).aspx | ||
322 | * | ||
323 | * | ||
324 | * Multi-touch down event - sent when a new touch is made: touch is assigned | ||
325 | * a unique contact ID, sent with this and consequent events related | ||
326 | * to this touch. | ||
327 | * 0 1 2 3 octet | ||
328 | * +----------------+----------------+----------------+----------------+ | ||
329 | * | _TYPE_MTOUCH | _MT_EV_DOWN | contact_id | reserved | 4 | ||
330 | * +----------------+----------------+----------------+----------------+ | ||
331 | * | reserved | 8 | ||
332 | * +----------------+----------------+----------------+----------------+ | ||
333 | * | abs_x | 12 | ||
334 | * +----------------+----------------+----------------+----------------+ | ||
335 | * | abs_y | 16 | ||
336 | * +----------------+----------------+----------------+----------------+ | ||
337 | * | reserved | 20 | ||
338 | * +----------------+----------------+----------------+----------------+ | ||
339 | * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/| | ||
340 | * +----------------+----------------+----------------+----------------+ | ||
341 | * | reserved | 40 | ||
342 | * +----------------+----------------+----------------+----------------+ | ||
343 | * | ||
344 | * abs_x - int32_t, absolute X position, in pixels | ||
345 | * abs_y - int32_t, absolute Y position, in pixels | ||
346 | * | ||
347 | * Multi-touch contact release event | ||
348 | * 0 1 2 3 octet | ||
349 | * +----------------+----------------+----------------+----------------+ | ||
350 | * | _TYPE_MTOUCH | _MT_EV_UP | contact_id | reserved | 4 | ||
351 | * +----------------+----------------+----------------+----------------+ | ||
352 | * | reserved | 8 | ||
353 | * +----------------+----------------+----------------+----------------+ | ||
354 | * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/| | ||
355 | * +----------------+----------------+----------------+----------------+ | ||
356 | * | reserved | 40 | ||
357 | * +----------------+----------------+----------------+----------------+ | ||
358 | * | ||
359 | * Multi-touch motion event | ||
360 | * 0 1 2 3 octet | ||
361 | * +----------------+----------------+----------------+----------------+ | ||
362 | * | _TYPE_MTOUCH | _MT_EV_MOTION | contact_id | reserved | 4 | ||
363 | * +----------------+----------------+----------------+----------------+ | ||
364 | * | reserved | 8 | ||
365 | * +----------------+----------------+----------------+----------------+ | ||
366 | * | abs_x | 12 | ||
367 | * +----------------+----------------+----------------+----------------+ | ||
368 | * | abs_y | 16 | ||
369 | * +----------------+----------------+----------------+----------------+ | ||
370 | * | reserved | 20 | ||
371 | * +----------------+----------------+----------------+----------------+ | ||
372 | * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/| | ||
373 | * +----------------+----------------+----------------+----------------+ | ||
374 | * | reserved | 40 | ||
375 | * +----------------+----------------+----------------+----------------+ | ||
376 | * | ||
377 | * abs_x - int32_t, absolute X position, in pixels, | ||
378 | * abs_y - int32_t, absolute Y position, in pixels, | ||
379 | * | ||
380 | * Multi-touch input synchronization event - shows end of a set of events | ||
381 | * which logically belong together. | ||
382 | * 0 1 2 3 octet | ||
383 | * +----------------+----------------+----------------+----------------+ | ||
384 | * | _TYPE_MTOUCH | _MT_EV_SYN | contact_id | reserved | 4 | ||
385 | * +----------------+----------------+----------------+----------------+ | ||
386 | * | reserved | 8 | ||
387 | * +----------------+----------------+----------------+----------------+ | ||
388 | * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/| | ||
389 | * +----------------+----------------+----------------+----------------+ | ||
390 | * | reserved | 40 | ||
391 | * +----------------+----------------+----------------+----------------+ | ||
392 | * | ||
393 | * Multi-touch shape event - touch point's shape has changed its shape. | ||
394 | * Shape is approximated by an ellipse through the major and minor axis | ||
395 | * lengths: major is the longer diameter of the ellipse and minor is the | ||
396 | * shorter one. Center of the ellipse is reported via | ||
397 | * XENKBD_MT_EV_DOWN/XENKBD_MT_EV_MOTION events. | ||
398 | * 0 1 2 3 octet | ||
399 | * +----------------+----------------+----------------+----------------+ | ||
400 | * | _TYPE_MTOUCH | _MT_EV_SHAPE | contact_id | reserved | 4 | ||
401 | * +----------------+----------------+----------------+----------------+ | ||
402 | * | reserved | 8 | ||
403 | * +----------------+----------------+----------------+----------------+ | ||
404 | * | major | 12 | ||
405 | * +----------------+----------------+----------------+----------------+ | ||
406 | * | minor | 16 | ||
407 | * +----------------+----------------+----------------+----------------+ | ||
408 | * | reserved | 20 | ||
409 | * +----------------+----------------+----------------+----------------+ | ||
410 | * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/| | ||
411 | * +----------------+----------------+----------------+----------------+ | ||
412 | * | reserved | 40 | ||
413 | * +----------------+----------------+----------------+----------------+ | ||
414 | * | ||
415 | * major - unt32_t, length of the major axis, pixels | ||
416 | * minor - unt32_t, length of the minor axis, pixels | ||
417 | * | ||
418 | * Multi-touch orientation event - touch point's shape has changed | ||
419 | * its orientation: calculated as a clockwise angle between the major axis | ||
420 | * of the ellipse and positive Y axis in degrees, [-180; +180]. | ||
421 | * 0 1 2 3 octet | ||
422 | * +----------------+----------------+----------------+----------------+ | ||
423 | * | _TYPE_MTOUCH | _MT_EV_ORIENT | contact_id | reserved | 4 | ||
424 | * +----------------+----------------+----------------+----------------+ | ||
425 | * | reserved | 8 | ||
426 | * +----------------+----------------+----------------+----------------+ | ||
427 | * | orientation | reserved | 12 | ||
428 | * +----------------+----------------+----------------+----------------+ | ||
429 | * | reserved | 16 | ||
430 | * +----------------+----------------+----------------+----------------+ | ||
431 | * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/| | ||
432 | * +----------------+----------------+----------------+----------------+ | ||
433 | * | reserved | 40 | ||
434 | * +----------------+----------------+----------------+----------------+ | ||
435 | * | ||
436 | * orientation - int16_t, clockwise angle of the major axis | ||
437 | */ | ||
438 | |||
439 | struct xenkbd_mtouch { | ||
440 | uint8_t type; /* XENKBD_TYPE_MTOUCH */ | ||
441 | uint8_t event_type; /* XENKBD_MT_EV_??? */ | ||
442 | uint8_t contact_id; | ||
443 | uint8_t reserved[5]; /* reserved for the future use */ | ||
444 | union { | ||
445 | struct { | ||
446 | int32_t abs_x; /* absolute X position, pixels */ | ||
447 | int32_t abs_y; /* absolute Y position, pixels */ | ||
448 | } pos; | ||
449 | struct { | ||
450 | uint32_t major; /* length of the major axis, pixels */ | ||
451 | uint32_t minor; /* length of the minor axis, pixels */ | ||
452 | } shape; | ||
453 | int16_t orientation; /* clockwise angle of the major axis */ | ||
454 | } u; | ||
455 | }; | ||
456 | |||
248 | #define XENKBD_IN_EVENT_SIZE 40 | 457 | #define XENKBD_IN_EVENT_SIZE 40 |
249 | 458 | ||
250 | union xenkbd_in_event { | 459 | union xenkbd_in_event { |
@@ -252,6 +461,7 @@ union xenkbd_in_event { | |||
252 | struct xenkbd_motion motion; | 461 | struct xenkbd_motion motion; |
253 | struct xenkbd_key key; | 462 | struct xenkbd_key key; |
254 | struct xenkbd_position pos; | 463 | struct xenkbd_position pos; |
464 | struct xenkbd_mtouch mtouch; | ||
255 | char pad[XENKBD_IN_EVENT_SIZE]; | 465 | char pad[XENKBD_IN_EVENT_SIZE]; |
256 | }; | 466 | }; |
257 | 467 | ||