FreeBSD/Linux Kernel Cross Reference
sys/dev/hid/hidrdesc.h
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 HID_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 HID_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 HID_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 HID_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
308 /* HID mouse boot protocol descriptor */
309 #define HID_MOUSE_BOOTPROTO_DESCR(...) \
310 0x05, 0x01, /* Usage Page (Generic Desktop Ctrls) */\
311 0x09, 0x02, /* Usage (Mouse) */\
312 0xA1, 0x01, /* Collection (Application) */\
313 0x09, 0x01, /* Usage (Pointer) */\
314 0xA1, 0x00, /* Collection (Physical) */\
315 0x95, 0x03, /* Report Count (3) */\
316 0x75, 0x01, /* Report Size (1) */\
317 0x05, 0x09, /* Usage Page (Button) */\
318 0x19, 0x01, /* Usage Minimum (0x01) */\
319 0x29, 0x03, /* Usage Maximum (0x03) */\
320 0x15, 0x00, /* Logical Minimum (0) */\
321 0x25, 0x01, /* Logical Maximum (1) */\
322 0x81, 0x02, /* Input (Data,Var,Abs) */\
323 0x95, 0x01, /* Report Count (1) */\
324 0x75, 0x05, /* Report Size (5) */\
325 0x81, 0x03, /* Input (Const) */\
326 0x75, 0x08, /* Report Size (8) */\
327 0x95, 0x02, /* Report Count (2) */\
328 0x05, 0x01, /* Usage Page (Generic Desktop Ctrls) */\
329 0x09, 0x30, /* Usage (X) */\
330 0x09, 0x31, /* Usage (Y) */\
331 0x15, 0x81, /* Logical Minimum (-127) */\
332 0x25, 0x7F, /* Logical Maximum (127) */\
333 0x81, 0x06, /* Input (Data,Var,Rel) */\
334 0xC0, /* End Collection */\
335 0xC0, /* End Collection */
336
337 /* HID keyboard boot protocol descriptor */
338 #define HID_KBD_BOOTPROTO_DESCR(...) \
339 0x05, 0x01, /* Usage Page (Generic Desktop Ctrls) */\
340 0x09, 0x06, /* Usage (Keyboard) */\
341 0xA1, 0x01, /* Collection (Application) */\
342 0x05, 0x07, /* Usage Page (Kbrd/Keypad) */\
343 0x19, 0xE0, /* Usage Minimum (0xE0) */\
344 0x29, 0xE7, /* Usage Maximum (0xE7) */\
345 0x15, 0x00, /* Logical Minimum (0) */\
346 0x25, 0x01, /* Logical Maximum (1) */\
347 0x75, 0x01, /* Report Size (1) */\
348 0x95, 0x08, /* Report Count (8) */\
349 0x81, 0x02, /* Input (Data,Var,Abs) */\
350 0x95, 0x01, /* Report Count (1) */\
351 0x75, 0x08, /* Report Size (8) */\
352 0x81, 0x01, /* Input (Const,Array,Abs) */\
353 0x95, 0x03, /* Report Count (3) */\
354 0x75, 0x01, /* Report Size (1) */\
355 0x05, 0x08, /* Usage Page (LEDs) */\
356 0x19, 0x01, /* Usage Minimum (Num Lock) */\
357 0x29, 0x03, /* Usage Maximum (Scroll Lock) */\
358 0x91, 0x02, /* Output (Data,Var,Abs) */\
359 0x95, 0x05, /* Report Count (5) */\
360 0x75, 0x01, /* Report Size (1) */\
361 0x91, 0x01, /* Output (Const,Array,Abs) */\
362 0x95, 0x06, /* Report Count (6) */\
363 0x75, 0x08, /* Report Size (8) */\
364 0x15, 0x00, /* Logical Minimum (0) */\
365 0x26, 0xFF, 0x00, /* Logical Maximum (255) */\
366 0x05, 0x07, /* Usage Page (Kbrd/Keypad) */\
367 0x19, 0x00, /* Usage Minimum (0x00) */\
368 0x2A, 0xFF, 0x00, /* Usage Maximum (0xFF) */\
369 0x81, 0x00, /* Input (Data,Array,Abs) */\
370 0xC0, /* End Collection */
Cache object: a2ff40522f2b1e51391433604975583d
|