1 // Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 #pragma once 15 16 const unsigned char hidReportMap[] = { 17 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 18 0x09, 0x02, // Usage (Mouse) 19 0xA1, 0x01, // Collection (Application) 20 0x85, 0x01, // Report ID (1) 21 0x09, 0x01, // Usage (Pointer) 22 0xA1, 0x00, // Collection (Physical) 23 0x05, 0x09, // Usage Page (Button) 24 0x19, 0x01, // Usage Minimum (0x01) 25 0x29, 0x03, // Usage Maximum (0x03) 26 0x15, 0x00, // Logical Minimum (0) 27 0x25, 0x01, // Logical Maximum (1) 28 0x75, 0x01, // Report Size (1) 29 0x95, 0x03, // Report Count (3) 30 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 31 0x75, 0x05, // Report Size (5) 32 0x95, 0x01, // Report Count (1) 33 0x81, 0x01, // Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) 34 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 35 0x09, 0x30, // Usage (X) 36 0x09, 0x31, // Usage (Y) 37 0x09, 0x38, // Usage (Wheel) 38 0x15, 0x81, // Logical Minimum (-127) 39 0x25, 0x7F, // Logical Maximum (127) 40 0x75, 0x08, // Report Size (8) 41 0x95, 0x03, // Report Count (3) 42 0x81, 0x06, // Input (Data,Var,Rel,No Wrap,Linear,Preferred State,No Null Position) 43 0xC0, // End Collection 44 0xC0, // End Collection 45 46 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 47 0x09, 0x06, // Usage (Keyboard) 48 0xA1, 0x01, // Collection (Application) 49 0x85, 0x02, // Report ID (2) 50 0x05, 0x07, // Usage Page (Kbrd/Keypad) 51 0x19, 0xE0, // Usage Minimum (0xE0) 52 0x29, 0xE7, // Usage Maximum (0xE7) 53 0x15, 0x00, // Logical Minimum (0) 54 0x25, 0x01, // Logical Maximum (1) 55 0x75, 0x01, // Report Size (1) 56 0x95, 0x08, // Report Count (8) 57 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 58 0x95, 0x01, // Report Count (1) 59 0x75, 0x08, // Report Size (8) 60 0x81, 0x01, // Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) 61 0x95, 0x05, // Report Count (5) 62 0x75, 0x01, // Report Size (1) 63 0x05, 0x08, // Usage Page (LEDs) 64 0x19, 0x01, // Usage Minimum (Num Lock) 65 0x29, 0x05, // Usage Maximum (Kana) 66 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 67 0x95, 0x01, // Report Count (1) 68 0x75, 0x03, // Report Size (3) 69 0x91, 0x01, // Output (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 70 0x95, 0x06, // Report Count (6) 71 0x75, 0x08, // Report Size (8) 72 0x15, 0x00, // Logical Minimum (0) 73 0x25, 0x65, // Logical Maximum (101) 74 0x05, 0x07, // Usage Page (Kbrd/Keypad) 75 0x19, 0x00, // Usage Minimum (0x00) 76 0x29, 0x65, // Usage Maximum (0x65) 77 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) 78 0xC0, // End Collection 79 80 0x05, 0x0C, // Usage Page (Consumer) 81 0x09, 0x01, // Usage (Consumer Control) 82 0xA1, 0x01, // Collection (Application) 83 0x85, 0x03, // Report ID (3) 84 0x09, 0x02, // Usage (Numeric Key Pad) 85 0xA1, 0x02, // Collection (Logical) 86 0x05, 0x09, // Usage Page (Button) 87 0x19, 0x01, // Usage Minimum (0x01) 88 0x29, 0x0A, // Usage Maximum (0x0A) 89 0x15, 0x01, // Logical Minimum (1) 90 0x25, 0x0A, // Logical Maximum (10) 91 0x75, 0x04, // Report Size (4) 92 0x95, 0x01, // Report Count (1) 93 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) 94 0xC0, // End Collection 95 0x05, 0x0C, // Usage Page (Consumer) 96 0x09, 0x86, // Usage (Channel) 97 0x15, 0xFF, // Logical Minimum (-1) 98 0x25, 0x01, // Logical Maximum (1) 99 0x75, 0x02, // Report Size (2) 100 0x95, 0x01, // Report Count (1) 101 0x81, 0x46, // Input (Data,Var,Rel,No Wrap,Linear,Preferred State,Null State) 102 0x09, 0xE9, // Usage (Volume Increment) 103 0x09, 0xEA, // Usage (Volume Decrement) 104 0x15, 0x00, // Logical Minimum (0) 105 0x75, 0x01, // Report Size (1) 106 0x95, 0x02, // Report Count (2) 107 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 108 0x09, 0xE2, // Usage (Mute) 109 0x09, 0x30, // Usage (Power) 110 0x09, 0x83, // Usage (Recall Last) 111 0x09, 0x81, // Usage (Assign Selection) 112 0x09, 0xB0, // Usage (Play) 113 0x09, 0xB1, // Usage (Pause) 114 0x09, 0xB2, // Usage (Record) 115 0x09, 0xB3, // Usage (Fast Forward) 116 0x09, 0xB4, // Usage (Rewind) 117 0x09, 0xB5, // Usage (Scan Next Track) 118 0x09, 0xB6, // Usage (Scan Previous Track) 119 0x09, 0xB7, // Usage (Stop) 120 0x15, 0x01, // Logical Minimum (1) 121 0x25, 0x0C, // Logical Maximum (12) 122 0x75, 0x04, // Report Size (4) 123 0x95, 0x01, // Report Count (1) 124 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) 125 0x09, 0x80, // Usage (Selection) 126 0xA1, 0x02, // Collection (Logical) 127 0x05, 0x09, // Usage Page (Button) 128 0x19, 0x01, // Usage Minimum (0x01) 129 0x29, 0x03, // Usage Maximum (0x03) 130 0x15, 0x01, // Logical Minimum (1) 131 0x25, 0x03, // Logical Maximum (3) 132 0x75, 0x02, // Report Size (2) 133 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) 134 0xC0, // End Collection 135 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 136 0xC0, // End Collection 137 138 0x06, 0xFF, 0xFF, // Usage Page (Vendor Defined 0xFFFF) 139 0x09, 0xA5, // Usage (0xA5) 140 0xA1, 0x01, // Collection (Application) 141 0x85, 0x04, // Report ID (4) 142 0x09, 0xA6, // Usage (0xA6) 143 0x09, 0xA9, // Usage (0xA9) 144 0x75, 0x08, // Report Size (8) 145 0x95, 0x7F, // Report Count (127) 146 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 147 0xC0, // End Collection 148 149 // 250 bytes 150 }; 151 152 const unsigned char relMouseReportMap[] = { //4 bytes (btns,x,y,wheel) 153 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 154 0x09, 0x02, // Usage (Mouse) 155 0xA1, 0x01, // Collection (Application) 156 0x09, 0x01, // Usage (Pointer) 157 0xA1, 0x00, // Collection (Physical) 158 0x85, 0x01, // Report ID (1) 159 0x05, 0x09, // Usage Page (Button) 160 0x19, 0x01, // Usage Minimum (0x01) 161 0x29, 0x05, // Usage Maximum (0x05) 162 0x15, 0x00, // Logical Minimum (0) 163 0x25, 0x01, // Logical Maximum (1) 164 0x95, 0x05, // Report Count (5) 165 0x75, 0x01, // Report Size (1) 166 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 167 0x95, 0x01, // Report Count (1) 168 0x75, 0x03, // Report Size (3) 169 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 170 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 171 0x09, 0x30, // Usage (X) 172 0x09, 0x31, // Usage (Y) 173 0x09, 0x38, // Usage (Wheel) 174 0x15, 0x81, // Logical Minimum (-127) 175 0x25, 0x7F, // Logical Maximum (127) 176 0x75, 0x08, // Report Size (8) 177 0x95, 0x03, // Report Count (3) 178 0x81, 0x06, // Input (Data,Var,Rel,No Wrap,Linear,Preferred State,No Null Position) 179 0xC0, // End Collection 180 0xC0, // End Collection 181 182 // 54 bytes 183 }; 184 185 const unsigned char absMouseReportMap[] = { //6 bytes (btns,x*2,y*2,wheel) 186 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 187 0x09, 0x02, // Usage (Mouse) 188 0xA1, 0x01, // Collection (Application) 189 0x09, 0x01, // Usage (Pointer) 190 0xA1, 0x00, // Collection (Physical) 191 0x85, 0x01, // Report ID (1) 192 0x05, 0x09, // Usage Page (Button) 193 0x19, 0x01, // Usage Minimum (0x01) 194 0x29, 0x05, // Usage Maximum (0x05) 195 0x15, 0x00, // Logical Minimum (0) 196 0x25, 0x01, // Logical Maximum (1) 197 0x95, 0x05, // Report Count (5) 198 0x75, 0x01, // Report Size (1) 199 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 200 0x95, 0x01, // Report Count (1) 201 0x75, 0x03, // Report Size (3) 202 0x81, 0x01, // Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) 203 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 204 0x09, 0x30, // Usage (X) 205 0x09, 0x31, // Usage (Y) 206 0x15, 0x00, // Logical Minimum (0) 207 0x26, 0xFF, 0x7F, // Logical Maximum (32767) 208 0x75, 0x10, // Report Size (16) 209 0x95, 0x02, // Report Count (2) 210 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 211 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 212 0x09, 0x38, // Usage (Wheel) 213 0x15, 0x81, // Logical Minimum (-127) 214 0x25, 0x7F, // Logical Maximum (127) 215 0x75, 0x08, // Report Size (8) 216 0x95, 0x01, // Report Count (1) 217 0x81, 0x06, // Input (Data,Var,Rel,No Wrap,Linear,Preferred State,No Null Position) 218 0xC0, // End Collection 219 0xC0, // End Collection 220 221 // 67 bytes 222 }; 223 224 const unsigned char keyboardReportMap[] = { //7 bytes input (modifiers, resrvd, keys*5), 1 byte output 225 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 226 0x09, 0x06, // Usage (Keyboard) 227 0xA1, 0x01, // Collection (Application) 228 0x85, 0x01, // Report ID (1) 229 0x05, 0x07, // Usage Page (Kbrd/Keypad) 230 0x19, 0xE0, // Usage Minimum (0xE0) 231 0x29, 0xE7, // Usage Maximum (0xE7) 232 0x15, 0x00, // Logical Minimum (0) 233 0x25, 0x01, // Logical Maximum (1) 234 0x75, 0x01, // Report Size (1) 235 0x95, 0x08, // Report Count (8) 236 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 237 0x95, 0x01, // Report Count (1) 238 0x75, 0x08, // Report Size (8) 239 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 240 0x95, 0x05, // Report Count (5) 241 0x75, 0x01, // Report Size (1) 242 0x05, 0x08, // Usage Page (LEDs) 243 0x19, 0x01, // Usage Minimum (Num Lock) 244 0x29, 0x05, // Usage Maximum (Kana) 245 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 246 0x95, 0x01, // Report Count (1) 247 0x75, 0x03, // Report Size (3) 248 0x91, 0x03, // Output (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 249 0x95, 0x05, // Report Count (5) 250 0x75, 0x08, // Report Size (8) 251 0x15, 0x00, // Logical Minimum (0) 252 0x25, 0x65, // Logical Maximum (101) 253 0x05, 0x07, // Usage Page (Kbrd/Keypad) 254 0x19, 0x00, // Usage Minimum (0x00) 255 0x29, 0x65, // Usage Maximum (0x65) 256 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) 257 0xC0, // End Collection 258 259 // 65 bytes 260 }; 261 262 const unsigned char joystickReportMap[] = { // 8bytes (8but, 4but+hat, r, y, rx, ry, z, rz) 263 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 264 0x09, 0x04, // Usage (Joystick) 265 0xA1, 0x01, // Collection (Application) 266 0x85, 0x01, // Report ID (1) 267 0x05, 0x09, // Usage Page (Button) 268 0x19, 0x01, // Usage Minimum (0x01) 269 0x29, 0x0C, // Usage Maximum (0x0C) 270 0x15, 0x00, // Logical Minimum (0) 271 0x25, 0x01, // Logical Maximum (1) 272 0x75, 0x01, // Report Size (1) 273 0x95, 0x0C, // Report Count (12) 274 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 275 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 276 0x09, 0x39, // Usage (Hat switch) 277 0x15, 0x01, // Logical Minimum (1) 278 0x25, 0x08, // Logical Maximum (8) 279 0x95, 0x01, // Report Count (1) 280 0x75, 0x04, // Report Size (4) 281 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 282 0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 283 0xA1, 0x00, // Collection (Physical) 284 0x09, 0x30, // Usage (X) 285 0x09, 0x31, // Usage (Y) 286 0x09, 0x33, // Usage (Rx) 287 0x09, 0x34, // Usage (Ry) 288 0x15, 0x80, // Logical Minimum (-128) 289 0x25, 0x7F, // Logical Maximum (127) 290 0x75, 0x08, // Report Size (8) 291 0x95, 0x04, // Report Count (4) 292 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 293 0x09, 0x32, // Usage (Z) 294 0x09, 0x35, // Usage (Rz) 295 0x15, 0x80, // Logical Minimum (-128) 296 0x25, 0x7F, // Logical Maximum (127) 297 0x75, 0x08, // Report Size (8) 298 0x95, 0x02, // Report Count (2) 299 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 300 0xC0, // End Collection 301 0xC0, // End Collection 302 303 // 76 bytes 304 }; 305 306 const unsigned char mediaReportMap[] = { //6 bytes (3 x 16bit) 307 0x05, 0x0C, // Usage Page (Consumer) 308 0x09, 0x01, // Usage (Consumer Control) 309 0xA1, 0x01, // Collection (Application) 310 0x85, 0x03, // Report ID (3) 311 0x19, 0x00, // Usage Minimum (Unassigned) 312 0x2A, 0xFF, 0x03, // Usage Maximum (0x03FF) 313 0x15, 0x00, // Logical Minimum (0) 314 0x26, 0xFF, 0x03, // Logical Maximum (1023) 315 0x95, 0x03, // Report Count (3) 316 0x75, 0x10, // Report Size (16) 317 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) 318 0xC0, // End Collection 319 320 // 25 bytes 321 }; 322 323 const unsigned char mediaReportMap2[] = { 324 0x05, 0x0C, // Usage Page (Consumer) 325 0x09, 0x01, // Usage (Consumer Control) 326 0xA1, 0x01, // Collection (Application) 327 0x85, 0x03, // Report ID (3) 328 0x09, 0x02, // Usage (Numeric Key Pad) 329 0xA1, 0x02, // Collection (Logical) 330 0x05, 0x09, // Usage Page (Button) 331 0x19, 0x01, // Usage Minimum (0x01) 332 0x29, 0x0A, // Usage Maximum (0x0A) 333 0x15, 0x01, // Logical Minimum (1) 334 0x25, 0x0A, // Logical Maximum (10) 335 0x75, 0x04, // Report Size (4) 336 0x95, 0x01, // Report Count (1) 337 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) 338 0xC0, // End Collection 339 0x05, 0x0C, // Usage Page (Consumer) 340 0x09, 0x86, // Usage (Channel) 341 0x15, 0xFF, // Logical Minimum (-1) 342 0x25, 0x01, // Logical Maximum (1) 343 0x75, 0x02, // Report Size (2) 344 0x95, 0x01, // Report Count (1) 345 0x81, 0x46, // Input (Data,Var,Rel,No Wrap,Linear,Preferred State,Null State) 346 0x09, 0xE9, // Usage (Volume Increment) 347 0x09, 0xEA, // Usage (Volume Decrement) 348 0x15, 0x00, // Logical Minimum (0) 349 0x75, 0x01, // Report Size (1) 350 0x95, 0x02, // Report Count (2) 351 0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 352 0x09, 0xE2, // Usage (Mute) 353 0x09, 0x30, // Usage (Power) 354 0x09, 0x83, // Usage (Recall Last) 355 0x09, 0x81, // Usage (Assign Selection) 356 0x09, 0xB0, // Usage (Play) 357 0x09, 0xB1, // Usage (Pause) 358 0x09, 0xB2, // Usage (Record) 359 0x09, 0xB3, // Usage (Fast Forward) 360 0x09, 0xB4, // Usage (Rewind) 361 0x09, 0xB5, // Usage (Scan Next Track) 362 0x09, 0xB6, // Usage (Scan Previous Track) 363 0x09, 0xB7, // Usage (Stop) 364 0x15, 0x01, // Logical Minimum (1) 365 0x25, 0x0C, // Logical Maximum (12) 366 0x75, 0x04, // Report Size (4) 367 0x95, 0x01, // Report Count (1) 368 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) 369 0x09, 0x80, // Usage (Selection) 370 0xA1, 0x02, // Collection (Logical) 371 0x05, 0x09, // Usage Page (Button) 372 0x19, 0x01, // Usage Minimum (0x01) 373 0x29, 0x03, // Usage Maximum (0x03) 374 0x15, 0x01, // Logical Minimum (1) 375 0x25, 0x03, // Logical Maximum (3) 376 0x75, 0x02, // Report Size (2) 377 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) 378 0xC0, // End Collection 379 0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 380 0xC0, // End Collection 381 }; 382 383 const unsigned char hidapiReportMap[] = { //8 bytes input, 8 bytes feature 384 0x06, 0x00, 0xFF, // Usage Page (Vendor Defined 0xFF00) 385 0x0A, 0x00, 0x01, // Usage (0x0100) 386 0xA1, 0x01, // Collection (Application) 387 0x85, 0x01, // Report ID (1) 388 0x15, 0x00, // Logical Minimum (0) 389 0x26, 0xFF, 0x00, // Logical Maximum (255) 390 0x75, 0x08, // Report Size (8) 391 0x95, 0x08, // Report Count (8) 392 0x09, 0x01, // Usage (0x01) 393 0x82, 0x02, 0x01, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Buffered Bytes) 394 0x95, 0x08, // Report Count (8) 395 0x09, 0x02, // Usage (0x02) 396 0xB2, 0x02, 0x01, // Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile,Buffered Bytes) 397 0x95, 0x08, // Report Count (8) 398 0x09, 0x03, // Usage (0x03) 399 0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) 400 0xC0, // End Collection 401 402 // 38 bytes 403 }; 404