Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

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