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