1*8ac98aedSDavid Woodhouse /* SPDX-License-Identifier: MIT */ 2a3434a2dSAnthony PERARD /* 3a3434a2dSAnthony PERARD * kbdif.h -- Xen virtual keyboard/mouse 4a3434a2dSAnthony PERARD * 5a3434a2dSAnthony PERARD * Copyright (C) 2005 Anthony Liguori <aliguori@us.ibm.com> 6a3434a2dSAnthony PERARD * Copyright (C) 2006 Red Hat, Inc., Markus Armbruster <armbru@redhat.com> 7a3434a2dSAnthony PERARD */ 8a3434a2dSAnthony PERARD 9a3434a2dSAnthony PERARD #ifndef __XEN_PUBLIC_IO_KBDIF_H__ 10a3434a2dSAnthony PERARD #define __XEN_PUBLIC_IO_KBDIF_H__ 11a3434a2dSAnthony PERARD 12a3434a2dSAnthony PERARD /* 13a3434a2dSAnthony PERARD ***************************************************************************** 14a3434a2dSAnthony PERARD * Feature and Parameter Negotiation 15a3434a2dSAnthony PERARD ***************************************************************************** 16a3434a2dSAnthony PERARD * 17a3434a2dSAnthony PERARD * The two halves of a para-virtual driver utilize nodes within 18a3434a2dSAnthony PERARD * XenStore to communicate capabilities and to negotiate operating parameters. 19a3434a2dSAnthony PERARD * This section enumerates these nodes which reside in the respective front and 20a3434a2dSAnthony PERARD * backend portions of XenStore, following XenBus convention. 21a3434a2dSAnthony PERARD * 22a3434a2dSAnthony PERARD * All data in XenStore is stored as strings. Nodes specifying numeric 23a3434a2dSAnthony PERARD * values are encoded in decimal. Integer value ranges listed below are 24a3434a2dSAnthony PERARD * expressed as fixed sized integer types capable of storing the conversion 25a3434a2dSAnthony PERARD * of a properly formated node string, without loss of information. 26a3434a2dSAnthony PERARD * 27a3434a2dSAnthony PERARD ***************************************************************************** 28a3434a2dSAnthony PERARD * Backend XenBus Nodes 29a3434a2dSAnthony PERARD ***************************************************************************** 30a3434a2dSAnthony PERARD * 31a3434a2dSAnthony PERARD *---------------------------- Features supported ---------------------------- 32a3434a2dSAnthony PERARD * 33a3434a2dSAnthony PERARD * Capable backend advertises supported features by publishing 34a3434a2dSAnthony PERARD * corresponding entries in XenStore and puts 1 as the value of the entry. 35a3434a2dSAnthony PERARD * If a feature is not supported then 0 must be set or feature entry omitted. 36a3434a2dSAnthony PERARD * 37a3434a2dSAnthony PERARD * feature-disable-keyboard 38a3434a2dSAnthony PERARD * Values: <uint> 39a3434a2dSAnthony PERARD * 40a3434a2dSAnthony PERARD * If there is no need to expose a virtual keyboard device by the 41a3434a2dSAnthony PERARD * frontend then this must be set to 1. 42a3434a2dSAnthony PERARD * 43a3434a2dSAnthony PERARD * feature-disable-pointer 44a3434a2dSAnthony PERARD * Values: <uint> 45a3434a2dSAnthony PERARD * 46a3434a2dSAnthony PERARD * If there is no need to expose a virtual pointer device by the 47a3434a2dSAnthony PERARD * frontend then this must be set to 1. 48a3434a2dSAnthony PERARD * 49a3434a2dSAnthony PERARD * feature-abs-pointer 50a3434a2dSAnthony PERARD * Values: <uint> 51a3434a2dSAnthony PERARD * 52a3434a2dSAnthony PERARD * Backends, which support reporting of absolute coordinates for pointer 53a3434a2dSAnthony PERARD * device should set this to 1. 54a3434a2dSAnthony PERARD * 55a3434a2dSAnthony PERARD * feature-multi-touch 56a3434a2dSAnthony PERARD * Values: <uint> 57a3434a2dSAnthony PERARD * 58a3434a2dSAnthony PERARD * Backends, which support reporting of multi-touch events 59a3434a2dSAnthony PERARD * should set this to 1. 60a3434a2dSAnthony PERARD * 61a3434a2dSAnthony PERARD * feature-raw-pointer 62a3434a2dSAnthony PERARD * Values: <uint> 63a3434a2dSAnthony PERARD * 64a3434a2dSAnthony PERARD * Backends, which support reporting raw (unscaled) absolute coordinates 65a3434a2dSAnthony PERARD * for pointer devices should set this to 1. Raw (unscaled) values have 66a3434a2dSAnthony PERARD * a range of [0, 0x7fff]. 67a3434a2dSAnthony PERARD * 68a3434a2dSAnthony PERARD *----------------------- Device Instance Parameters ------------------------ 69a3434a2dSAnthony PERARD * 70a3434a2dSAnthony PERARD * unique-id 71a3434a2dSAnthony PERARD * Values: <string> 72a3434a2dSAnthony PERARD * 73a3434a2dSAnthony PERARD * After device instance initialization it is assigned a unique ID, 74a3434a2dSAnthony PERARD * so every instance of the frontend can be identified by the backend 75a3434a2dSAnthony PERARD * by this ID. This can be UUID or such. 76a3434a2dSAnthony PERARD * 77a3434a2dSAnthony PERARD *------------------------- Pointer Device Parameters ------------------------ 78a3434a2dSAnthony PERARD * 79a3434a2dSAnthony PERARD * width 80a3434a2dSAnthony PERARD * Values: <uint> 81a3434a2dSAnthony PERARD * 82a3434a2dSAnthony PERARD * Maximum X coordinate (width) to be used by the frontend 83a3434a2dSAnthony PERARD * while reporting input events, pixels, [0; UINT32_MAX]. 84a3434a2dSAnthony PERARD * 85a3434a2dSAnthony PERARD * height 86a3434a2dSAnthony PERARD * Values: <uint> 87a3434a2dSAnthony PERARD * 88a3434a2dSAnthony PERARD * Maximum Y coordinate (height) to be used by the frontend 89a3434a2dSAnthony PERARD * while reporting input events, pixels, [0; UINT32_MAX]. 90a3434a2dSAnthony PERARD * 91a3434a2dSAnthony PERARD *----------------------- Multi-touch Device Parameters ---------------------- 92a3434a2dSAnthony PERARD * 93a3434a2dSAnthony PERARD * multi-touch-num-contacts 94a3434a2dSAnthony PERARD * Values: <uint> 95a3434a2dSAnthony PERARD * 96a3434a2dSAnthony PERARD * Number of simultaneous touches reported. 97a3434a2dSAnthony PERARD * 98a3434a2dSAnthony PERARD * multi-touch-width 99a3434a2dSAnthony PERARD * Values: <uint> 100a3434a2dSAnthony PERARD * 101a3434a2dSAnthony PERARD * Width of the touch area to be used by the frontend 102a3434a2dSAnthony PERARD * while reporting input events, pixels, [0; UINT32_MAX]. 103a3434a2dSAnthony PERARD * 104a3434a2dSAnthony PERARD * multi-touch-height 105a3434a2dSAnthony PERARD * Values: <uint> 106a3434a2dSAnthony PERARD * 107a3434a2dSAnthony PERARD * Height of the touch area to be used by the frontend 108a3434a2dSAnthony PERARD * while reporting input events, pixels, [0; UINT32_MAX]. 109a3434a2dSAnthony PERARD * 110a3434a2dSAnthony PERARD ***************************************************************************** 111a3434a2dSAnthony PERARD * Frontend XenBus Nodes 112a3434a2dSAnthony PERARD ***************************************************************************** 113a3434a2dSAnthony PERARD * 114a3434a2dSAnthony PERARD *------------------------------ Feature request ----------------------------- 115a3434a2dSAnthony PERARD * 116a3434a2dSAnthony PERARD * Capable frontend requests features from backend via setting corresponding 117a3434a2dSAnthony PERARD * entries to 1 in XenStore. Requests for features not advertised as supported 118a3434a2dSAnthony PERARD * by the backend have no effect. 119a3434a2dSAnthony PERARD * 120a3434a2dSAnthony PERARD * request-abs-pointer 121a3434a2dSAnthony PERARD * Values: <uint> 122a3434a2dSAnthony PERARD * 123a3434a2dSAnthony PERARD * Request backend to report absolute pointer coordinates 124a3434a2dSAnthony PERARD * (XENKBD_TYPE_POS) instead of relative ones (XENKBD_TYPE_MOTION). 125a3434a2dSAnthony PERARD * 126a3434a2dSAnthony PERARD * request-multi-touch 127a3434a2dSAnthony PERARD * Values: <uint> 128a3434a2dSAnthony PERARD * 129a3434a2dSAnthony PERARD * Request backend to report multi-touch events. 130a3434a2dSAnthony PERARD * 131a3434a2dSAnthony PERARD * request-raw-pointer 132a3434a2dSAnthony PERARD * Values: <uint> 133a3434a2dSAnthony PERARD * 134a3434a2dSAnthony PERARD * Request backend to report raw unscaled absolute pointer coordinates. 135a3434a2dSAnthony PERARD * This option is only valid if request-abs-pointer is also set. 136a3434a2dSAnthony PERARD * Raw unscaled coordinates have the range [0, 0x7fff] 137a3434a2dSAnthony PERARD * 138a3434a2dSAnthony PERARD *----------------------- Request Transport Parameters ----------------------- 139a3434a2dSAnthony PERARD * 140a3434a2dSAnthony PERARD * event-channel 141a3434a2dSAnthony PERARD * Values: <uint> 142a3434a2dSAnthony PERARD * 143a3434a2dSAnthony PERARD * The identifier of the Xen event channel used to signal activity 144a3434a2dSAnthony PERARD * in the ring buffer. 145a3434a2dSAnthony PERARD * 146a3434a2dSAnthony PERARD * page-gref 147a3434a2dSAnthony PERARD * Values: <uint> 148a3434a2dSAnthony PERARD * 149a3434a2dSAnthony PERARD * The Xen grant reference granting permission for the backend to map 150a3434a2dSAnthony PERARD * a sole page in a single page sized event ring buffer. 151a3434a2dSAnthony PERARD * 152a3434a2dSAnthony PERARD * page-ref 153a3434a2dSAnthony PERARD * Values: <uint> 154a3434a2dSAnthony PERARD * 155a3434a2dSAnthony PERARD * OBSOLETE, not recommended for use. 156a3434a2dSAnthony PERARD * PFN of the shared page. 157a3434a2dSAnthony PERARD */ 158a3434a2dSAnthony PERARD 159a3434a2dSAnthony PERARD /* 160a3434a2dSAnthony PERARD * EVENT CODES. 161a3434a2dSAnthony PERARD */ 162a3434a2dSAnthony PERARD 163a3434a2dSAnthony PERARD #define XENKBD_TYPE_MOTION 1 164a3434a2dSAnthony PERARD #define XENKBD_TYPE_RESERVED 2 165a3434a2dSAnthony PERARD #define XENKBD_TYPE_KEY 3 166a3434a2dSAnthony PERARD #define XENKBD_TYPE_POS 4 167a3434a2dSAnthony PERARD #define XENKBD_TYPE_MTOUCH 5 168a3434a2dSAnthony PERARD 169a3434a2dSAnthony PERARD /* Multi-touch event sub-codes */ 170a3434a2dSAnthony PERARD 171a3434a2dSAnthony PERARD #define XENKBD_MT_EV_DOWN 0 172a3434a2dSAnthony PERARD #define XENKBD_MT_EV_UP 1 173a3434a2dSAnthony PERARD #define XENKBD_MT_EV_MOTION 2 174a3434a2dSAnthony PERARD #define XENKBD_MT_EV_SYN 3 175a3434a2dSAnthony PERARD #define XENKBD_MT_EV_SHAPE 4 176a3434a2dSAnthony PERARD #define XENKBD_MT_EV_ORIENT 5 177a3434a2dSAnthony PERARD 178a3434a2dSAnthony PERARD /* 179a3434a2dSAnthony PERARD * CONSTANTS, XENSTORE FIELD AND PATH NAME STRINGS, HELPERS. 180a3434a2dSAnthony PERARD */ 181a3434a2dSAnthony PERARD 182a3434a2dSAnthony PERARD #define XENKBD_DRIVER_NAME "vkbd" 183a3434a2dSAnthony PERARD 184a3434a2dSAnthony PERARD #define XENKBD_FIELD_FEAT_DSBL_KEYBRD "feature-disable-keyboard" 185a3434a2dSAnthony PERARD #define XENKBD_FIELD_FEAT_DSBL_POINTER "feature-disable-pointer" 186a3434a2dSAnthony PERARD #define XENKBD_FIELD_FEAT_ABS_POINTER "feature-abs-pointer" 187a3434a2dSAnthony PERARD #define XENKBD_FIELD_FEAT_RAW_POINTER "feature-raw-pointer" 188a3434a2dSAnthony PERARD #define XENKBD_FIELD_FEAT_MTOUCH "feature-multi-touch" 189a3434a2dSAnthony PERARD #define XENKBD_FIELD_REQ_ABS_POINTER "request-abs-pointer" 190a3434a2dSAnthony PERARD #define XENKBD_FIELD_REQ_RAW_POINTER "request-raw-pointer" 191a3434a2dSAnthony PERARD #define XENKBD_FIELD_REQ_MTOUCH "request-multi-touch" 192a3434a2dSAnthony PERARD #define XENKBD_FIELD_RING_GREF "page-gref" 193a3434a2dSAnthony PERARD #define XENKBD_FIELD_EVT_CHANNEL "event-channel" 194a3434a2dSAnthony PERARD #define XENKBD_FIELD_WIDTH "width" 195a3434a2dSAnthony PERARD #define XENKBD_FIELD_HEIGHT "height" 196a3434a2dSAnthony PERARD #define XENKBD_FIELD_MT_WIDTH "multi-touch-width" 197a3434a2dSAnthony PERARD #define XENKBD_FIELD_MT_HEIGHT "multi-touch-height" 198a3434a2dSAnthony PERARD #define XENKBD_FIELD_MT_NUM_CONTACTS "multi-touch-num-contacts" 199a3434a2dSAnthony PERARD #define XENKBD_FIELD_UNIQUE_ID "unique-id" 200a3434a2dSAnthony PERARD 201a3434a2dSAnthony PERARD /* OBSOLETE, not recommended for use */ 202a3434a2dSAnthony PERARD #define XENKBD_FIELD_RING_REF "page-ref" 203a3434a2dSAnthony PERARD 204a3434a2dSAnthony PERARD /* 205a3434a2dSAnthony PERARD ***************************************************************************** 206a3434a2dSAnthony PERARD * Description of the protocol between frontend and backend driver. 207a3434a2dSAnthony PERARD ***************************************************************************** 208a3434a2dSAnthony PERARD * 209a3434a2dSAnthony PERARD * The two halves of a Para-virtual driver communicate with 210a3434a2dSAnthony PERARD * each other using a shared page and an event channel. 211a3434a2dSAnthony PERARD * Shared page contains a ring with event structures. 212a3434a2dSAnthony PERARD * 213a3434a2dSAnthony PERARD * All reserved fields in the structures below must be 0. 214a3434a2dSAnthony PERARD * 215a3434a2dSAnthony PERARD ***************************************************************************** 216a3434a2dSAnthony PERARD * Backend to frontend events 217a3434a2dSAnthony PERARD ***************************************************************************** 218a3434a2dSAnthony PERARD * 219a3434a2dSAnthony PERARD * Frontends should ignore unknown in events. 220a3434a2dSAnthony PERARD * All event packets have the same length (40 octets) 221a3434a2dSAnthony PERARD * All event packets have common header: 222a3434a2dSAnthony PERARD * 223a3434a2dSAnthony PERARD * 0 octet 224a3434a2dSAnthony PERARD * +-----------------+ 225a3434a2dSAnthony PERARD * | type | 226a3434a2dSAnthony PERARD * +-----------------+ 227a3434a2dSAnthony PERARD * type - uint8_t, event code, XENKBD_TYPE_??? 228a3434a2dSAnthony PERARD * 229a3434a2dSAnthony PERARD * 230a3434a2dSAnthony PERARD * Pointer relative movement event 231a3434a2dSAnthony PERARD * 0 1 2 3 octet 232a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 233a3434a2dSAnthony PERARD * | _TYPE_MOTION | reserved | 4 234a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 235a3434a2dSAnthony PERARD * | rel_x | 8 236a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 237a3434a2dSAnthony PERARD * | rel_y | 12 238a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 239a3434a2dSAnthony PERARD * | rel_z | 16 240a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 241a3434a2dSAnthony PERARD * | reserved | 20 242a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 243a3434a2dSAnthony PERARD * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/| 244a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 245a3434a2dSAnthony PERARD * | reserved | 40 246a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 247a3434a2dSAnthony PERARD * 248a3434a2dSAnthony PERARD * rel_x - int32_t, relative X motion 249a3434a2dSAnthony PERARD * rel_y - int32_t, relative Y motion 250a3434a2dSAnthony PERARD * rel_z - int32_t, relative Z motion (wheel) 251a3434a2dSAnthony PERARD */ 252a3434a2dSAnthony PERARD 253a3434a2dSAnthony PERARD struct xenkbd_motion 254a3434a2dSAnthony PERARD { 255a3434a2dSAnthony PERARD uint8_t type; 256a3434a2dSAnthony PERARD int32_t rel_x; 257a3434a2dSAnthony PERARD int32_t rel_y; 258a3434a2dSAnthony PERARD int32_t rel_z; 259a3434a2dSAnthony PERARD }; 260a3434a2dSAnthony PERARD 261a3434a2dSAnthony PERARD /* 262a3434a2dSAnthony PERARD * Key event (includes pointer buttons) 263a3434a2dSAnthony PERARD * 0 1 2 3 octet 264a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 265a3434a2dSAnthony PERARD * | _TYPE_KEY | pressed | reserved | 4 266a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 267a3434a2dSAnthony PERARD * | keycode | 8 268a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 269a3434a2dSAnthony PERARD * | reserved | 12 270a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 271a3434a2dSAnthony PERARD * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/| 272a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 273a3434a2dSAnthony PERARD * | reserved | 40 274a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 275a3434a2dSAnthony PERARD * 276a3434a2dSAnthony PERARD * pressed - uint8_t, 1 if pressed; 0 otherwise 277a3434a2dSAnthony PERARD * keycode - uint32_t, KEY_* from linux/input.h 278a3434a2dSAnthony PERARD */ 279a3434a2dSAnthony PERARD 280a3434a2dSAnthony PERARD struct xenkbd_key 281a3434a2dSAnthony PERARD { 282a3434a2dSAnthony PERARD uint8_t type; 283a3434a2dSAnthony PERARD uint8_t pressed; 284a3434a2dSAnthony PERARD uint32_t keycode; 285a3434a2dSAnthony PERARD }; 286a3434a2dSAnthony PERARD 287a3434a2dSAnthony PERARD /* 288a3434a2dSAnthony PERARD * Pointer absolute position event 289a3434a2dSAnthony PERARD * 0 1 2 3 octet 290a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 291a3434a2dSAnthony PERARD * | _TYPE_POS | reserved | 4 292a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 293a3434a2dSAnthony PERARD * | abs_x | 8 294a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 295a3434a2dSAnthony PERARD * | abs_y | 12 296a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 297a3434a2dSAnthony PERARD * | rel_z | 16 298a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 299a3434a2dSAnthony PERARD * | reserved | 20 300a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 301a3434a2dSAnthony PERARD * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/| 302a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 303a3434a2dSAnthony PERARD * | reserved | 40 304a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 305a3434a2dSAnthony PERARD * 306a3434a2dSAnthony PERARD * abs_x - int32_t, absolute X position (in FB pixels) 307a3434a2dSAnthony PERARD * abs_y - int32_t, absolute Y position (in FB pixels) 308a3434a2dSAnthony PERARD * rel_z - int32_t, relative Z motion (wheel) 309a3434a2dSAnthony PERARD */ 310a3434a2dSAnthony PERARD 311a3434a2dSAnthony PERARD struct xenkbd_position 312a3434a2dSAnthony PERARD { 313a3434a2dSAnthony PERARD uint8_t type; 314a3434a2dSAnthony PERARD int32_t abs_x; 315a3434a2dSAnthony PERARD int32_t abs_y; 316a3434a2dSAnthony PERARD int32_t rel_z; 317a3434a2dSAnthony PERARD }; 318a3434a2dSAnthony PERARD 319a3434a2dSAnthony PERARD /* 320a3434a2dSAnthony PERARD * Multi-touch event and its sub-types 321a3434a2dSAnthony PERARD * 322a3434a2dSAnthony PERARD * All multi-touch event packets have common header: 323a3434a2dSAnthony PERARD * 324a3434a2dSAnthony PERARD * 0 1 2 3 octet 325a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 326a3434a2dSAnthony PERARD * | _TYPE_MTOUCH | event_type | contact_id | reserved | 4 327a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 328a3434a2dSAnthony PERARD * | reserved | 8 329a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 330a3434a2dSAnthony PERARD * 331a3434a2dSAnthony PERARD * event_type - unt8_t, multi-touch event sub-type, XENKBD_MT_EV_??? 332a3434a2dSAnthony PERARD * contact_id - unt8_t, ID of the contact 333a3434a2dSAnthony PERARD * 334a3434a2dSAnthony PERARD * Touch interactions can consist of one or more contacts. 335a3434a2dSAnthony PERARD * For each contact, a series of events is generated, starting 336a3434a2dSAnthony PERARD * with a down event, followed by zero or more motion events, 337a3434a2dSAnthony PERARD * and ending with an up event. Events relating to the same 338a3434a2dSAnthony PERARD * contact point can be identified by the ID of the sequence: contact ID. 339a3434a2dSAnthony PERARD * Contact ID may be reused after XENKBD_MT_EV_UP event and 340a3434a2dSAnthony PERARD * is in the [0; XENKBD_FIELD_NUM_CONTACTS - 1] range. 341a3434a2dSAnthony PERARD * 342a3434a2dSAnthony PERARD * For further information please refer to documentation on Wayland [1], 343a3434a2dSAnthony PERARD * Linux [2] and Windows [3] multi-touch support. 344a3434a2dSAnthony PERARD * 345a3434a2dSAnthony PERARD * [1] https://cgit.freedesktop.org/wayland/wayland/tree/protocol/wayland.xml 346a3434a2dSAnthony PERARD * [2] https://www.kernel.org/doc/Documentation/input/multi-touch-protocol.txt 347a3434a2dSAnthony PERARD * [3] https://msdn.microsoft.com/en-us/library/jj151564(v=vs.85).aspx 348a3434a2dSAnthony PERARD * 349a3434a2dSAnthony PERARD * 350a3434a2dSAnthony PERARD * Multi-touch down event - sent when a new touch is made: touch is assigned 351a3434a2dSAnthony PERARD * a unique contact ID, sent with this and consequent events related 352a3434a2dSAnthony PERARD * to this touch. 353a3434a2dSAnthony PERARD * 0 1 2 3 octet 354a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 355a3434a2dSAnthony PERARD * | _TYPE_MTOUCH | _MT_EV_DOWN | contact_id | reserved | 4 356a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 357a3434a2dSAnthony PERARD * | reserved | 8 358a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 359a3434a2dSAnthony PERARD * | abs_x | 12 360a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 361a3434a2dSAnthony PERARD * | abs_y | 16 362a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 363a3434a2dSAnthony PERARD * | reserved | 20 364a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 365a3434a2dSAnthony PERARD * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/| 366a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 367a3434a2dSAnthony PERARD * | reserved | 40 368a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 369a3434a2dSAnthony PERARD * 370a3434a2dSAnthony PERARD * abs_x - int32_t, absolute X position, in pixels 371a3434a2dSAnthony PERARD * abs_y - int32_t, absolute Y position, in pixels 372a3434a2dSAnthony PERARD * 373a3434a2dSAnthony PERARD * Multi-touch contact release event 374a3434a2dSAnthony PERARD * 0 1 2 3 octet 375a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 376a3434a2dSAnthony PERARD * | _TYPE_MTOUCH | _MT_EV_UP | contact_id | reserved | 4 377a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 378a3434a2dSAnthony PERARD * | reserved | 8 379a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 380a3434a2dSAnthony PERARD * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/| 381a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 382a3434a2dSAnthony PERARD * | reserved | 40 383a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 384a3434a2dSAnthony PERARD * 385a3434a2dSAnthony PERARD * Multi-touch motion event 386a3434a2dSAnthony PERARD * 0 1 2 3 octet 387a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 388a3434a2dSAnthony PERARD * | _TYPE_MTOUCH | _MT_EV_MOTION | contact_id | reserved | 4 389a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 390a3434a2dSAnthony PERARD * | reserved | 8 391a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 392a3434a2dSAnthony PERARD * | abs_x | 12 393a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 394a3434a2dSAnthony PERARD * | abs_y | 16 395a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 396a3434a2dSAnthony PERARD * | reserved | 20 397a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 398a3434a2dSAnthony PERARD * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/| 399a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 400a3434a2dSAnthony PERARD * | reserved | 40 401a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 402a3434a2dSAnthony PERARD * 403a3434a2dSAnthony PERARD * abs_x - int32_t, absolute X position, in pixels, 404a3434a2dSAnthony PERARD * abs_y - int32_t, absolute Y position, in pixels, 405a3434a2dSAnthony PERARD * 406a3434a2dSAnthony PERARD * Multi-touch input synchronization event - shows end of a set of events 407a3434a2dSAnthony PERARD * which logically belong together. 408a3434a2dSAnthony PERARD * 0 1 2 3 octet 409a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 410a3434a2dSAnthony PERARD * | _TYPE_MTOUCH | _MT_EV_SYN | contact_id | reserved | 4 411a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 412a3434a2dSAnthony PERARD * | reserved | 8 413a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 414a3434a2dSAnthony PERARD * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/| 415a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 416a3434a2dSAnthony PERARD * | reserved | 40 417a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 418a3434a2dSAnthony PERARD * 419a3434a2dSAnthony PERARD * Multi-touch shape event - touch point's shape has changed its shape. 420a3434a2dSAnthony PERARD * Shape is approximated by an ellipse through the major and minor axis 421a3434a2dSAnthony PERARD * lengths: major is the longer diameter of the ellipse and minor is the 422a3434a2dSAnthony PERARD * shorter one. Center of the ellipse is reported via 423a3434a2dSAnthony PERARD * XENKBD_MT_EV_DOWN/XENKBD_MT_EV_MOTION events. 424a3434a2dSAnthony PERARD * 0 1 2 3 octet 425a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 426a3434a2dSAnthony PERARD * | _TYPE_MTOUCH | _MT_EV_SHAPE | contact_id | reserved | 4 427a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 428a3434a2dSAnthony PERARD * | reserved | 8 429a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 430a3434a2dSAnthony PERARD * | major | 12 431a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 432a3434a2dSAnthony PERARD * | minor | 16 433a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 434a3434a2dSAnthony PERARD * | reserved | 20 435a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 436a3434a2dSAnthony PERARD * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/| 437a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 438a3434a2dSAnthony PERARD * | reserved | 40 439a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 440a3434a2dSAnthony PERARD * 441a3434a2dSAnthony PERARD * major - unt32_t, length of the major axis, pixels 442a3434a2dSAnthony PERARD * minor - unt32_t, length of the minor axis, pixels 443a3434a2dSAnthony PERARD * 444a3434a2dSAnthony PERARD * Multi-touch orientation event - touch point's shape has changed 445a3434a2dSAnthony PERARD * its orientation: calculated as a clockwise angle between the major axis 446a3434a2dSAnthony PERARD * of the ellipse and positive Y axis in degrees, [-180; +180]. 447a3434a2dSAnthony PERARD * 0 1 2 3 octet 448a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 449a3434a2dSAnthony PERARD * | _TYPE_MTOUCH | _MT_EV_ORIENT | contact_id | reserved | 4 450a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 451a3434a2dSAnthony PERARD * | reserved | 8 452a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 453a3434a2dSAnthony PERARD * | orientation | reserved | 12 454a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 455a3434a2dSAnthony PERARD * | reserved | 16 456a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 457a3434a2dSAnthony PERARD * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/| 458a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 459a3434a2dSAnthony PERARD * | reserved | 40 460a3434a2dSAnthony PERARD * +----------------+----------------+----------------+----------------+ 461a3434a2dSAnthony PERARD * 462a3434a2dSAnthony PERARD * orientation - int16_t, clockwise angle of the major axis 463a3434a2dSAnthony PERARD */ 464a3434a2dSAnthony PERARD 465a3434a2dSAnthony PERARD struct xenkbd_mtouch { 466a3434a2dSAnthony PERARD uint8_t type; /* XENKBD_TYPE_MTOUCH */ 467a3434a2dSAnthony PERARD uint8_t event_type; /* XENKBD_MT_EV_??? */ 468a3434a2dSAnthony PERARD uint8_t contact_id; 469a3434a2dSAnthony PERARD uint8_t reserved[5]; /* reserved for the future use */ 470a3434a2dSAnthony PERARD union { 471a3434a2dSAnthony PERARD struct { 472a3434a2dSAnthony PERARD int32_t abs_x; /* absolute X position, pixels */ 473a3434a2dSAnthony PERARD int32_t abs_y; /* absolute Y position, pixels */ 474a3434a2dSAnthony PERARD } pos; 475a3434a2dSAnthony PERARD struct { 476a3434a2dSAnthony PERARD uint32_t major; /* length of the major axis, pixels */ 477a3434a2dSAnthony PERARD uint32_t minor; /* length of the minor axis, pixels */ 478a3434a2dSAnthony PERARD } shape; 479a3434a2dSAnthony PERARD int16_t orientation; /* clockwise angle of the major axis */ 480a3434a2dSAnthony PERARD } u; 481a3434a2dSAnthony PERARD }; 482a3434a2dSAnthony PERARD 483a3434a2dSAnthony PERARD #define XENKBD_IN_EVENT_SIZE 40 484a3434a2dSAnthony PERARD 485a3434a2dSAnthony PERARD union xenkbd_in_event 486a3434a2dSAnthony PERARD { 487a3434a2dSAnthony PERARD uint8_t type; 488a3434a2dSAnthony PERARD struct xenkbd_motion motion; 489a3434a2dSAnthony PERARD struct xenkbd_key key; 490a3434a2dSAnthony PERARD struct xenkbd_position pos; 491a3434a2dSAnthony PERARD struct xenkbd_mtouch mtouch; 492a3434a2dSAnthony PERARD char pad[XENKBD_IN_EVENT_SIZE]; 493a3434a2dSAnthony PERARD }; 494a3434a2dSAnthony PERARD 495a3434a2dSAnthony PERARD /* 496a3434a2dSAnthony PERARD ***************************************************************************** 497a3434a2dSAnthony PERARD * Frontend to backend events 498a3434a2dSAnthony PERARD ***************************************************************************** 499a3434a2dSAnthony PERARD * 500a3434a2dSAnthony PERARD * Out events may be sent only when requested by backend, and receipt 501a3434a2dSAnthony PERARD * of an unknown out event is an error. 502a3434a2dSAnthony PERARD * No out events currently defined. 503a3434a2dSAnthony PERARD 504a3434a2dSAnthony PERARD * All event packets have the same length (40 octets) 505a3434a2dSAnthony PERARD * All event packets have common header: 506a3434a2dSAnthony PERARD * 0 octet 507a3434a2dSAnthony PERARD * +-----------------+ 508a3434a2dSAnthony PERARD * | type | 509a3434a2dSAnthony PERARD * +-----------------+ 510a3434a2dSAnthony PERARD * type - uint8_t, event code 511a3434a2dSAnthony PERARD */ 512a3434a2dSAnthony PERARD 513a3434a2dSAnthony PERARD #define XENKBD_OUT_EVENT_SIZE 40 514a3434a2dSAnthony PERARD 515a3434a2dSAnthony PERARD union xenkbd_out_event 516a3434a2dSAnthony PERARD { 517a3434a2dSAnthony PERARD uint8_t type; 518a3434a2dSAnthony PERARD char pad[XENKBD_OUT_EVENT_SIZE]; 519a3434a2dSAnthony PERARD }; 520a3434a2dSAnthony PERARD 521a3434a2dSAnthony PERARD /* 522a3434a2dSAnthony PERARD ***************************************************************************** 523a3434a2dSAnthony PERARD * Shared page 524a3434a2dSAnthony PERARD ***************************************************************************** 525a3434a2dSAnthony PERARD */ 526a3434a2dSAnthony PERARD 527a3434a2dSAnthony PERARD #define XENKBD_IN_RING_SIZE 2048 528a3434a2dSAnthony PERARD #define XENKBD_IN_RING_LEN (XENKBD_IN_RING_SIZE / XENKBD_IN_EVENT_SIZE) 529a3434a2dSAnthony PERARD #define XENKBD_IN_RING_OFFS 1024 530a3434a2dSAnthony PERARD #define XENKBD_IN_RING(page) \ 531a3434a2dSAnthony PERARD ((union xenkbd_in_event *)((char *)(page) + XENKBD_IN_RING_OFFS)) 532a3434a2dSAnthony PERARD #define XENKBD_IN_RING_REF(page, idx) \ 533a3434a2dSAnthony PERARD (XENKBD_IN_RING((page))[(idx) % XENKBD_IN_RING_LEN]) 534a3434a2dSAnthony PERARD 535a3434a2dSAnthony PERARD #define XENKBD_OUT_RING_SIZE 1024 536a3434a2dSAnthony PERARD #define XENKBD_OUT_RING_LEN (XENKBD_OUT_RING_SIZE / XENKBD_OUT_EVENT_SIZE) 537a3434a2dSAnthony PERARD #define XENKBD_OUT_RING_OFFS (XENKBD_IN_RING_OFFS + XENKBD_IN_RING_SIZE) 538a3434a2dSAnthony PERARD #define XENKBD_OUT_RING(page) \ 539a3434a2dSAnthony PERARD ((union xenkbd_out_event *)((char *)(page) + XENKBD_OUT_RING_OFFS)) 540a3434a2dSAnthony PERARD #define XENKBD_OUT_RING_REF(page, idx) \ 541a3434a2dSAnthony PERARD (XENKBD_OUT_RING((page))[(idx) % XENKBD_OUT_RING_LEN]) 542a3434a2dSAnthony PERARD 543a3434a2dSAnthony PERARD struct xenkbd_page 544a3434a2dSAnthony PERARD { 545a3434a2dSAnthony PERARD uint32_t in_cons, in_prod; 546a3434a2dSAnthony PERARD uint32_t out_cons, out_prod; 547a3434a2dSAnthony PERARD }; 548a3434a2dSAnthony PERARD 549a3434a2dSAnthony PERARD #endif /* __XEN_PUBLIC_IO_KBDIF_H__ */ 55050c88402SJoao Martins 55150c88402SJoao Martins /* 55250c88402SJoao Martins * Local variables: 55350c88402SJoao Martins * mode: C 55450c88402SJoao Martins * c-file-style: "BSD" 55550c88402SJoao Martins * c-basic-offset: 4 55650c88402SJoao Martins * tab-width: 4 55750c88402SJoao Martins * indent-tabs-mode: nil 55850c88402SJoao Martins * End: 55950c88402SJoao Martins */ 560