1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3 * 4 * Copyright (c) 2000 Nick Hibma <n_hibma@FreeBSD.org> 5 * All rights reserved. 6 * 7 * Copyright (c) 2005 Ed Schouten <ed@FreeBSD.org> 8 * All rights reserved. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 * SUCH DAMAGE. 30 * 31 * $FreeBSD$ 32 * 33 * This file contains replacements for broken HID report descriptors. 34 */ 35 36 #define UHID_GRAPHIRE_REPORT_DESCR(...) \ 37 0x05, 0x0d, /* USAGE_PAGE (Digitizers) */\ 38 0x09, 0x01, /* USAGE (Digitizer) */\ 39 0xa1, 0x01, /* COLLECTION (Application) */\ 40 0x85, 0x02, /* REPORT_ID (2) */\ 41 0x05, 0x0d, /* USAGE_PAGE (Digitizers) */\ 42 0x09, 0x01, /* USAGE (Digitizer) */\ 43 0xa1, 0x00, /* COLLECTION (Physical) */\ 44 0x15, 0x00, /* LOGICAL_MINIMUM (0) */\ 45 0x25, 0x01, /* LOGICAL_MAXIMUM (1) */\ 46 0x09, 0x33, /* USAGE (Touch) */\ 47 0x95, 0x01, /* REPORT_COUNT (1) */\ 48 0x75, 0x01, /* REPORT_SIZE (1) */\ 49 0x81, 0x02, /* INPUT (Data,Var,Abs) */\ 50 0x09, 0x44, /* USAGE (Barrel Switch) */\ 51 0x95, 0x02, /* REPORT_COUNT (2) */\ 52 0x75, 0x01, /* REPORT_SIZE (1) */\ 53 0x81, 0x02, /* INPUT (Data,Var,Abs) */\ 54 0x09, 0x00, /* USAGE (Undefined) */\ 55 0x95, 0x02, /* REPORT_COUNT (2) */\ 56 0x75, 0x01, /* REPORT_SIZE (1) */\ 57 0x81, 0x03, /* INPUT (Cnst,Var,Abs) */\ 58 0x09, 0x3c, /* USAGE (Invert) */\ 59 0x95, 0x01, /* REPORT_COUNT (1) */\ 60 0x75, 0x01, /* REPORT_SIZE (1) */\ 61 0x81, 0x02, /* INPUT (Data,Var,Abs) */\ 62 0x09, 0x38, /* USAGE (Transducer Index) */\ 63 0x95, 0x01, /* REPORT_COUNT (1) */\ 64 0x75, 0x01, /* REPORT_SIZE (1) */\ 65 0x81, 0x02, /* INPUT (Data,Var,Abs) */\ 66 0x09, 0x32, /* USAGE (In Range) */\ 67 0x95, 0x01, /* REPORT_COUNT (1) */\ 68 0x75, 0x01, /* REPORT_SIZE (1) */\ 69 0x81, 0x02, /* INPUT (Data,Var,Abs) */\ 70 0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */\ 71 0x09, 0x30, /* USAGE (X) */\ 72 0x15, 0x00, /* LOGICAL_MINIMUM (0) */\ 73 0x26, 0xde, 0x27, /* LOGICAL_MAXIMUM (10206) */\ 74 0x95, 0x01, /* REPORT_COUNT (1) */\ 75 0x75, 0x10, /* REPORT_SIZE (16) */\ 76 0x81, 0x02, /* INPUT (Data,Var,Abs) */\ 77 0x09, 0x31, /* USAGE (Y) */\ 78 0x26, 0xfe, 0x1c, /* LOGICAL_MAXIMUM (7422) */\ 79 0x95, 0x01, /* REPORT_COUNT (1) */\ 80 0x75, 0x10, /* REPORT_SIZE (16) */\ 81 0x81, 0x02, /* INPUT (Data,Var,Abs) */\ 82 0x05, 0x0d, /* USAGE_PAGE (Digitizers) */\ 83 0x09, 0x30, /* USAGE (Tip Pressure) */\ 84 0x26, 0xff, 0x01, /* LOGICAL_MAXIMUM (511) */\ 85 0x95, 0x01, /* REPORT_COUNT (1) */\ 86 0x75, 0x10, /* REPORT_SIZE (16) */\ 87 0x81, 0x02, /* INPUT (Data,Var,Abs) */\ 88 0xc0, /* END_COLLECTION */\ 89 0x05, 0x0d, /* USAGE_PAGE (Digitizers) */\ 90 0x09, 0x00, /* USAGE (Undefined) */\ 91 0x85, 0x02, /* REPORT_ID (2) */\ 92 0x95, 0x01, /* REPORT_COUNT (1) */\ 93 0xb1, 0x02, /* FEATURE (Data,Var,Abs) */\ 94 0x09, 0x00, /* USAGE (Undefined) */\ 95 0x85, 0x03, /* REPORT_ID (3) */\ 96 0x95, 0x01, /* REPORT_COUNT (1) */\ 97 0xb1, 0x02, /* FEATURE (Data,Var,Abs) */\ 98 0xc0, /* END_COLLECTION */\ 99 100 #define UHID_GRAPHIRE3_4X5_REPORT_DESCR(...) \ 101 0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */\ 102 0x09, 0x02, /* USAGE (Mouse) */\ 103 0xa1, 0x01, /* COLLECTION (Application) */\ 104 0x85, 0x01, /* REPORT_ID (1) */\ 105 0x09, 0x01, /* USAGE (Pointer) */\ 106 0xa1, 0x00, /* COLLECTION (Physical) */\ 107 0x05, 0x09, /* USAGE_PAGE (Button) */\ 108 0x19, 0x01, /* USAGE_MINIMUM (Button 1) */\ 109 0x29, 0x03, /* USAGE_MAXIMUM (Button 3) */\ 110 0x15, 0x00, /* LOGICAL_MINIMUM (0) */\ 111 0x25, 0x01, /* LOGICAL_MAXIMUM (1) */\ 112 0x95, 0x03, /* REPORT_COUNT (3) */\ 113 0x75, 0x01, /* REPORT_SIZE (1) */\ 114 0x81, 0x02, /* INPUT (Data,Var,Abs) */\ 115 0x95, 0x01, /* REPORT_COUNT (1) */\ 116 0x75, 0x05, /* REPORT_SIZE (5) */\ 117 0x81, 0x01, /* INPUT (Cnst,Ary,Abs) */\ 118 0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */\ 119 0x09, 0x30, /* USAGE (X) */\ 120 0x09, 0x31, /* USAGE (Y) */\ 121 0x09, 0x38, /* USAGE (Wheel) */\ 122 0x15, 0x81, /* LOGICAL_MINIMUM (-127) */\ 123 0x25, 0x7f, /* LOGICAL_MAXIMUM (127) */\ 124 0x75, 0x08, /* REPORT_SIZE (8) */\ 125 0x95, 0x03, /* REPORT_COUNT (3) */\ 126 0x81, 0x06, /* INPUT (Data,Var,Rel) */\ 127 0xc0, /* END_COLLECTION */\ 128 0xc0, /* END_COLLECTION */\ 129 0x05, 0x0d, /* USAGE_PAGE (Digitizers) */\ 130 0x09, 0x01, /* USAGE (Pointer) */\ 131 0xa1, 0x01, /* COLLECTION (Applicaption) */\ 132 0x85, 0x02, /* REPORT_ID (2) */\ 133 0x05, 0x0d, /* USAGE_PAGE (Digitizers) */\ 134 0x09, 0x01, /* USAGE (Digitizer) */\ 135 0xa1, 0x00, /* COLLECTION (Physical) */\ 136 0x09, 0x33, /* USAGE (Touch) */\ 137 0x09, 0x44, /* USAGE (Barrel Switch) */\ 138 0x09, 0x44, /* USAGE (Barrel Switch) */\ 139 0x15, 0x00, /* LOGICAL_MINIMUM (0) */\ 140 0x25, 0x01, /* LOGICAL_MAXIMUM (1) */\ 141 0x75, 0x01, /* REPORT_SIZE (1) */\ 142 0x95, 0x03, /* REPORT_COUNT (3) */\ 143 0x81, 0x02, /* INPUT (Data,Var,Abs) */\ 144 0x75, 0x01, /* REPORT_SIZE (1) */\ 145 0x95, 0x02, /* REPORT_COUNT (2) */\ 146 0x81, 0x01, /* INPUT (Cnst,Ary,Abs) */\ 147 0x09, 0x3c, /* USAGE (Invert) */\ 148 0x09, 0x38, /* USAGE (Transducer Index) */\ 149 0x09, 0x32, /* USAGE (In Range) */\ 150 0x75, 0x01, /* REPORT_SIZE (1) */\ 151 0x95, 0x03, /* REPORT_COUNT (3) */\ 152 0x81, 0x02, /* INPUT (Data,Var,Abs) */\ 153 0x05, 0x01, /* USAGE_PAGE (Generic Desktop) */\ 154 0x09, 0x30, /* USAGE (X) */\ 155 0x15, 0x00, /* LOGICAL_MINIMUM (0) */\ 156 0x26, 0xde, 0x27, /* LOGICAL_MAXIMUM (10206) */\ 157 0x75, 0x10, /* REPORT_SIZE (16) */\ 158 0x95, 0x01, /* REPORT_COUNT (1) */\ 159 0x81, 0x02, /* INPUT (Data,Var,Abs) */\ 160 0x09, 0x31, /* USAGE (Y) */\ 161 0x26, 0xfe, 0x1c, /* LOGICAL_MAXIMUM (7422) */\ 162 0x75, 0x10, /* REPORT_SIZE (16) */\ 163 0x95, 0x01, /* REPORT_COUNT (1) */\ 164 0x81, 0x02, /* INPUT (Data,Var,Abs) */\ 165 0x05, 0x0d, /* USAGE_PAGE (Digitizers) */\ 166 0x09, 0x30, /* USAGE (Tip Pressure) */\ 167 0x26, 0xff, 0x01, /* LOGICAL_MAXIMUM (511) */\ 168 0x75, 0x10, /* REPORT_SIZE (16) */\ 169 0x95, 0x01, /* REPORT_COUNT (1) */\ 170 0x81, 0x02, /* INPUT (Data,Var,Abs) */\ 171 0xc0, /* END_COLLECTION */\ 172 0x05, 0x0d, /* USAGE_PAGE (Digitizers) */\ 173 0x09, 0x00, /* USAGE (Undefined) */\ 174 0x85, 0x02, /* REPORT_ID (2) */\ 175 0x95, 0x01, /* REPORT_COUNT (1) */\ 176 0xb1, 0x02, /* FEATURE (Data,Var,Abs) */\ 177 0x09, 0x00, /* USAGE (Undefined) */\ 178 0x85, 0x03, /* REPORT_ID (3) */\ 179 0x95, 0x01, /* REPORT_COUNT (1) */\ 180 0xb1, 0x02, /* FEATURE (Data,Var,Abs) */\ 181 0xc0 /* END_COLLECTION */\ 182 183 /* 184 * The descriptor has no output report format, thus preventing you from 185 * controlling the LEDs and the built-in rumblers. 186 */ 187 #define UHID_XB360GP_REPORT_DESCR(...) \ 188 0x05, 0x01, /* USAGE PAGE (Generic Desktop) */\ 189 0x09, 0x05, /* USAGE (Gamepad) */\ 190 0xa1, 0x01, /* COLLECTION (Application) */\ 191 /* Unused */\ 192 0x75, 0x08, /* REPORT SIZE (8) */\ 193 0x95, 0x01, /* REPORT COUNT (1) */\ 194 0x81, 0x01, /* INPUT (Constant) */\ 195 /* Byte count */\ 196 0x75, 0x08, /* REPORT SIZE (8) */\ 197 0x95, 0x01, /* REPORT COUNT (1) */\ 198 0x05, 0x01, /* USAGE PAGE (Generic Desktop) */\ 199 0x09, 0x3b, /* USAGE (Byte Count) */\ 200 0x81, 0x01, /* INPUT (Constant) */\ 201 /* D-Pad */\ 202 0x05, 0x01, /* USAGE PAGE (Generic Desktop) */\ 203 0x09, 0x01, /* USAGE (Pointer) */\ 204 0xa1, 0x00, /* COLLECTION (Physical) */\ 205 0x75, 0x01, /* REPORT SIZE (1) */\ 206 0x15, 0x00, /* LOGICAL MINIMUM (0) */\ 207 0x25, 0x01, /* LOGICAL MAXIMUM (1) */\ 208 0x35, 0x00, /* PHYSICAL MINIMUM (0) */\ 209 0x45, 0x01, /* PHYSICAL MAXIMUM (1) */\ 210 0x95, 0x04, /* REPORT COUNT (4) */\ 211 0x05, 0x01, /* USAGE PAGE (Generic Desktop) */\ 212 0x09, 0x90, /* USAGE (D-Pad Up) */\ 213 0x09, 0x91, /* USAGE (D-Pad Down) */\ 214 0x09, 0x93, /* USAGE (D-Pad Left) */\ 215 0x09, 0x92, /* USAGE (D-Pad Right) */\ 216 0x81, 0x02, /* INPUT (Data, Variable, Absolute) */\ 217 0xc0, /* END COLLECTION */\ 218 /* Buttons 5-11 */\ 219 0x75, 0x01, /* REPORT SIZE (1) */\ 220 0x15, 0x00, /* LOGICAL MINIMUM (0) */\ 221 0x25, 0x01, /* LOGICAL MAXIMUM (1) */\ 222 0x35, 0x00, /* PHYSICAL MINIMUM (0) */\ 223 0x45, 0x01, /* PHYSICAL MAXIMUM (1) */\ 224 0x95, 0x07, /* REPORT COUNT (7) */\ 225 0x05, 0x09, /* USAGE PAGE (Button) */\ 226 0x09, 0x08, /* USAGE (Button 8) */\ 227 0x09, 0x07, /* USAGE (Button 7) */\ 228 0x09, 0x09, /* USAGE (Button 9) */\ 229 0x09, 0x0a, /* USAGE (Button 10) */\ 230 0x09, 0x05, /* USAGE (Button 5) */\ 231 0x09, 0x06, /* USAGE (Button 6) */\ 232 0x09, 0x0b, /* USAGE (Button 11) */\ 233 0x81, 0x02, /* INPUT (Data, Variable, Absolute) */\ 234 /* Unused */\ 235 0x75, 0x01, /* REPORT SIZE (1) */\ 236 0x95, 0x01, /* REPORT COUNT (1) */\ 237 0x81, 0x01, /* INPUT (Constant) */\ 238 /* Buttons 1-4 */\ 239 0x75, 0x01, /* REPORT SIZE (1) */\ 240 0x15, 0x00, /* LOGICAL MINIMUM (0) */\ 241 0x25, 0x01, /* LOGICAL MAXIMUM (1) */\ 242 0x35, 0x00, /* PHYSICAL MINIMUM (0) */\ 243 0x45, 0x01, /* PHYSICAL MAXIMUM (1) */\ 244 0x95, 0x04, /* REPORT COUNT (4) */\ 245 0x05, 0x09, /* USAGE PAGE (Button) */\ 246 0x19, 0x01, /* USAGE MINIMUM (Button 1) */\ 247 0x29, 0x04, /* USAGE MAXIMUM (Button 4) */\ 248 0x81, 0x02, /* INPUT (Data, Variable, Absolute) */\ 249 /* Triggers */\ 250 0x75, 0x08, /* REPORT SIZE (8) */\ 251 0x15, 0x00, /* LOGICAL MINIMUM (0) */\ 252 0x26, 0xff, 0x00, /* LOGICAL MAXIMUM (255) */\ 253 0x35, 0x00, /* PHYSICAL MINIMUM (0) */\ 254 0x46, 0xff, 0x00, /* PHYSICAL MAXIMUM (255) */\ 255 0x95, 0x02, /* REPORT SIZE (2) */\ 256 0x05, 0x01, /* USAGE PAGE (Generic Desktop) */\ 257 0x09, 0x32, /* USAGE (Z) */\ 258 0x09, 0x35, /* USAGE (Rz) */\ 259 0x81, 0x02, /* INPUT (Data, Variable, Absolute) */\ 260 /* Sticks */\ 261 0x75, 0x10, /* REPORT SIZE (16) */\ 262 0x16, 0x00, 0x80, /* LOGICAL MINIMUM (-32768) */\ 263 0x26, 0xff, 0x7f, /* LOGICAL MAXIMUM (32767) */\ 264 0x36, 0x00, 0x80, /* PHYSICAL MINIMUM (-32768) */\ 265 0x46, 0xff, 0x7f, /* PHYSICAL MAXIMUM (32767) */\ 266 0x95, 0x04, /* REPORT COUNT (4) */\ 267 0x05, 0x01, /* USAGE PAGE (Generic Desktop) */\ 268 0x09, 0x30, /* USAGE (X) */\ 269 0x09, 0x31, /* USAGE (Y) */\ 270 0x09, 0x33, /* USAGE (Rx) */\ 271 0x09, 0x34, /* USAGE (Ry) */\ 272 0x81, 0x02, /* INPUT (Data, Variable, Absolute) */\ 273 /* Unused */\ 274 0x75, 0x30, /* REPORT SIZE (48) */\ 275 0x95, 0x01, /* REPORT COUNT (1) */\ 276 0x81, 0x01, /* INPUT (Constant) */\ 277 0xc0 /* END COLLECTION */\ 278 279 /* Fixed report descriptor for Super Nintendo gamepads */ 280 #define UHID_SNES_REPORT_DESCR(...) \ 281 0x05, 0x01, /* Usage Page (Desktop), */\ 282 0x09, 0x04, /* Usage (Joystik), */\ 283 0xA1, 0x01, /* Collection (Application), */\ 284 0xA1, 0x02, /* Collection (Logical), */\ 285 0x14, /* Logical Minimum (0), */\ 286 0x75, 0x08, /* Report Size (8), */\ 287 0x95, 0x03, /* Report Count (3), */\ 288 0x81, 0x01, /* Input (Constant), */\ 289 0x26, 0xFF, 0x00, /* Logical Maximum (255), */\ 290 0x95, 0x02, /* Report Count (2), */\ 291 0x09, 0x30, /* Usage (X), */\ 292 0x09, 0x31, /* Usage (Y), */\ 293 0x81, 0x02, /* Input (Variable), */\ 294 0x75, 0x01, /* Report Size (1), */\ 295 0x95, 0x04, /* Report Count (4), */\ 296 0x81, 0x01, /* Input (Constant), */\ 297 0x25, 0x01, /* Logical Maximum (1), */\ 298 0x95, 0x0A, /* Report Count (10), */\ 299 0x05, 0x09, /* Usage Page (Button), */\ 300 0x19, 0x01, /* Usage Minimum (01h), */\ 301 0x29, 0x0A, /* Usage Maximum (0Ah), */\ 302 0x81, 0x02, /* Input (Variable), */\ 303 0x95, 0x0A, /* Report Count (10), */\ 304 0x81, 0x01, /* Input (Constant), */\ 305 0xC0, /* End Collection, */\ 306 0xC0 /* End Collection */ 307