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