1<?xml version="1.0" encoding="UTF-8"?> 2<protocol name="gaming_input_unstable_v2"> 3 4 <copyright> 5 Copyright 2016 The Chromium Authors. 6 7 Permission is hereby granted, free of charge, to any person obtaining a 8 copy of this software and associated documentation files (the "Software"), 9 to deal in the Software without restriction, including without limitation 10 the rights to use, copy, modify, merge, publish, distribute, sublicense, 11 and/or sell copies of the Software, and to permit persons to whom the 12 Software is furnished to do so, subject to the following conditions: 13 14 The above copyright notice and this permission notice (including the next 15 paragraph) shall be included in all copies or substantial portions of the 16 Software. 17 18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 DEALINGS IN THE SOFTWARE. 25 </copyright> 26 27 <interface name="zcr_gaming_input_v2" version="2"> 28 <description summary="extends wl_seat with gaming input devices"> 29 A global interface to provide gaming input devices for a given seat. 30 31 Currently only gamepad devices are supported. 32 33 Warning! The protocol described in this file is experimental and 34 backward incompatible changes may be made. Backward compatible changes 35 may be added together with the corresponding uinterface version bump. 36 Backward incompatible changes are done by bumping the version number in 37 the protocol and uinterface names and resetting the interface version. 38 Once the protocol is to be declared stable, the 'z' prefix and the 39 version number in the protocol and interface names are removed and the 40 interface version number is reset. 41 </description> 42 43 <request name="get_gaming_seat"> 44 <description summary="get a gaming seat"> 45 Get a gaming seat object for a given seat. Gaming seat provides access 46 to gaming devices 47 </description> 48 <arg name="gaming_seat" type="new_id" interface="zcr_gaming_seat_v2"/> 49 <arg name="seat" type="object" interface="wl_seat"/> 50 </request> 51 52 <request name="destroy" type="destructor"> 53 <description summary="release the memory for the gaming input object"> 54 Destroy gaming_input object. Objects created from this object are 55 unaffected and should be destroyed separately. 56 </description> 57 </request> 58 </interface> 59 60 <interface name="zcr_gaming_seat_v2" version="1"> 61 <description summary="controller object for all gaming devices of a seat"> 62 An object that provides access to all the gaming devices of a seat. 63 When a gamepad is connected, the compositor will send gamepad_added event. 64 </description> 65 66 <request name="destroy" type="destructor"> 67 <description summary="release the memory for the gaming seat object"> 68 Destroy gaming_seat object. Objects created from this object are 69 unaffected and should be destroyed separately. 70 </description> 71 </request> 72 73 <event name="gamepad_added"> 74 <description summary="gamepad added event"> 75 Notification that there is gamepad connected at this seat. 76 </description> 77 <arg name="gamepad" type="new_id" interface="zcr_gamepad_v2" summary="new connected gamepad"/> 78 </event> 79 80 <enum name="bus_type"> 81 <description summary="gamepad device bus type"> 82 Device connection type e.g. Bluetooth 83 </description> 84 <entry name="usb" value="0" summary="Universal Serial Bus" /> 85 <entry name="bluetooth" value="1" summary="Bluetooth" /> 86 </enum> 87 88 <event name="gamepad_added_with_device_info"> 89 <description summary="gamepad added event"> 90 Notification that there is gamepad connected at this seat. 91 </description> 92 <arg name="gamepad" type="new_id" interface="zcr_gamepad_v2" summary="new connected gamepad"/> 93 <arg name="name" type="string" summary="name of the gamepad device" /> 94 <arg name="bus" type="uint" enum="bus_type" summary="type of the device connection e.g. Bluetooth" /> 95 <arg name="vendor_id" type="uint" summary="vendor ID of the gamepad device" /> 96 <arg name="product_id" type="uint" summary="product ID of the gamepad device" /> 97 <arg name="version" type="uint" summary="product version of the gamepad device" /> 98 </event> 99 </interface> 100 101 <interface name="zcr_gamepad_v2" version="2"> 102 <description summary="gamepad input device"> 103 The zcr_gamepad_v2 interface represents one or more gamepad input devices, 104 which are reported as a normalized 'Standard Gamepad' as it is specified 105 by the W3C Gamepad API at: https://w3c.github.io/gamepad/#remapping 106 </description> 107 108 <request name="destroy" type="destructor"> 109 <description summary="destroy gamepad"> 110 Destroy gamepad. Instances created from this gamepad are unaffected 111 and should be destroyed separately. 112 </description> 113 </request> 114 115 <event name="removed"> 116 <description summary="gamepad removed"> 117 Removed event is send when the gamepad is disconnected. The client should 118 expect no more event and call destroy. 119 120 This event cannot be used as destructor as requests (e.g. vibration) might 121 be added to this interface. 122 </description> 123 </event> 124 125 <event name="axis"> 126 <description summary="axis change event"> 127 Notification of axis change. 128 129 The axis id specifies which axis has changed as defined by the W3C 130 'Standard Gamepad'. 131 132 The value is calibrated and normalized to the -1 to 1 range. 133 </description> 134 <arg name="time" type="uint" summary="timestamp with millisecond granularity"/> 135 <arg name="axis" type="uint" summary="axis that produced this event"/> 136 <arg name="value" type="fixed" summary="new value of axis"/> 137 </event> 138 139 <enum name="button_state"> 140 <description summary="physical button state"> 141 Describes the physical state of a button that produced the button 142 event. 143 </description> 144 <entry name="released" value="0" summary="the button is not pressed"/> 145 <entry name="pressed" value="1" summary="the button is pressed"/> 146 </enum> 147 148 <event name="button"> 149 <description summary="Gamepad button changed"> 150 Notification of button change. 151 152 The button id specifies which button has changed as defined by the W3C 153 'Standard Gamepad'. 154 155 A button can have a digital and an analog value. The analog value is 156 normalized to a 0 to 1 range. 157 If a button does not provide an analog value, it will be derived from 158 the digital state. 159 </description> 160 <arg name="time" type="uint" summary="timestamp with millisecond granularity"/> 161 <arg name="button" type="uint" summary="id of button"/> 162 <arg name="state" type="uint" enum="button_state" summary="digital state of the button"/> 163 <arg name="analog" type="fixed" summary="analog value of the button"/> 164 </event> 165 166 <event name="frame"> 167 <description summary="Notifies end of a series of gamepad changes."> 168 Indicates the end of a set of events that logically belong together. 169 A client is expected to accumulate the data in all events within the 170 frame before proceeding. 171 </description> 172 <arg name="time" type="uint" summary="timestamp with millisecond granularity"/> 173 </event> 174 175 <event name="axis_added"> 176 <description summary="an axis is added"> 177 Adds an axis to the gamepad. Only called when the gamepad was created by 178 gamepad_added_with_device_info. The values are compatible with 179 input_absinfo. 180 </description> 181 <arg name="index" type="uint" summary="An index of the axis" /> 182 <arg name="min_value" type="int" summary="minimum value of the axis" /> 183 <arg name="max_value" type="int" summary="maximum value of the axis" /> 184 <arg name="flat" type="int" summary="input within this value are ignored" /> 185 <arg name="fuzz" type="int" summary="used to filter noise" /> 186 <arg name="resolution" type="int" summary="resolution of input in units per millimeter, or units per radian for rotational axes." /> 187 </event> 188 189 <event name="activated"> 190 <description summary="Gamepad activated"> 191 Activates the gamepad i.e. the gamepad will be visible to applications 192 after this event is fired. All axis_added events should be sent before 193 this event. Only called when the gamepad was created by 194 gamepad_added_with_device_info. 195 </description> 196 </event> 197 198 <!-- added since v2 --> 199 <event name="vibrator_added" since="2"> 200 <description summary="a vibrator is added"> 201 Adds a vibrator to the gamepad. Only called if server has verified 202 that gamepad has a vibrator. The vibrator(s) for a gamepad are expected 203 to be added before the "activated" event is called. 204 </description> 205 <arg name="vibrator" type="new_id" interface="zcr_gamepad_vibrator_v2" summary="the gamepad vibrator"/> 206 </event> 207 </interface> 208 209 <interface name="zcr_gamepad_vibrator_v2" version="2"> 210 <description summary="vibrator interface for a gamepad"> 211 An interface that provides access to the vibrator of a gamepad. Requests can be 212 sent to make the gamepad vibrate and to stop an ongoing vibration. 213 </description> 214 215 <request name="vibrate" since="2"> 216 <description summary="triggers the vibration event"> 217 Triggers the vibration event on the gamepad vibrator. The gamepad is only allowed to 218 vibrate while the window is in focus. The values in the timings array are 64-bit integers 219 and the values in the amplitudes array are unsigned 8-bit integers. 220 The timings array and the amplitudes array are of the same length. 221 For each timing/amplitude pair, the amplitude determines the strength of 222 the vibration and the timing determines the length of the vibration in milliseconds. 223 Amplitude values must be between 0 and 255. An amplitude of 0 implies no vibration 224 and any timing/amplitude pair with a timing value of 0 is ignored. 225 The repeat argument determines the index at which the vibration pattern to repeat begins. 226 A repeat value of -1 disables repetition. If repetition is enabled, the vibration 227 pattern will repeat indefinitely until stopped, or when focus is lost. 228 </description> 229 <arg name="timings" type="array" summary="array of timing values" /> 230 <arg name="amplitudes" type="array" summary="array of amplitude values" /> 231 <arg name="repeat" type="int" summary="index into the timings array at which to repeat" /> 232 </request> 233 234 <request name="cancel_vibration" since="2"> 235 <description summary="cancels the existing vibration event"> 236 Cancels the currently ongoing vibration event on the gamepad vibrator. 237 </description> 238 </request> 239 240 <request name="destroy" type="destructor" since="2"> 241 <description summary="destroy gamepad vibrator"/> 242 </request> 243 </interface> 244</protocol> 245