1/* $NetBSD: gcpad_rdesc.h,v 1.1 2025/12/08 23:00:22 jmcneill Exp $ */
2
3/*-
4 * Copyright (c) 2025 Jared McNeill <jmcneill@invisible.ca>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 *    notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 *    notice, this list of conditions and the following disclaimer in the
14 *    documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29static uint8_t gcpad_report_descr[] = {
30    0x05, 0x01,          // UsagePage(Generic Desktop[0x0001])
31    0x09, 0x05,          // UsageId(Gamepad[0x0005])
32    0xA1, 0x01,          // Collection(Application)
33    0x85, 0x01,          //     ReportId(1)
34    0x05, 0x09,          //     UsagePage(Button[0x0009])
35    0x09, 0x03,          //     UsageId(Button 3[0x0003])
36    0x09, 0x01,          //     UsageId(Button 1[0x0001])
37    0x09, 0x02,          //     UsageId(Button 2[0x0002])
38    0x09, 0x04,          //     UsageId(Button 4[0x0004])
39    0x09, 0x0B,          //     UsageId(Button 11[0x000B])
40    0x09, 0x0C,          //     UsageId(Button 12[0x000C])
41    0x15, 0x00,          //     LogicalMinimum(0)
42    0x25, 0x01,          //     LogicalMaximum(1)
43    0x95, 0x06,          //     ReportCount(6)
44    0x75, 0x01,          //     ReportSize(1)
45    0x81, 0x02,          //     Input(Data, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
46    0x95, 0x01,          //     ReportCount(1)
47    0x81, 0x03,          //     Input(Constant, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
48    0x09, 0x0A,          //     UsageId(Button 10[0x000A])
49    0x81, 0x02,          //     Input(Data, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
50    0x81, 0x03,          //     Input(Constant, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
51    0x09, 0x09,          //     UsageId(Button 9[0x0009])
52    0x81, 0x02,          //     Input(Data, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
53    0x75, 0x02,          //     ReportSize(2)
54    0x81, 0x03,          //     Input(Constant, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
55    0x09, 0x08,          //     UsageId(Button 8[0x0008])
56    0x09, 0x06,          //     UsageId(Button 6[0x0006])
57    0x09, 0x07,          //     UsageId(Button 7[0x0007])
58    0x09, 0x05,          //     UsageId(Button 5[0x0005])
59    0x95, 0x04,          //     ReportCount(4)
60    0x75, 0x01,          //     ReportSize(1)
61    0x81, 0x02,          //     Input(Data, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
62    0x05, 0x01,          //     UsagePage(Generic Desktop[0x0001])
63    0x09, 0x01,          //     UsageId(Pointer[0x0001])
64    0xA1, 0x00,          //     Collection(Physical)
65    0x09, 0x30,          //         UsageId(X[0x0030])
66    0x09, 0x31,          //         UsageId(Y[0x0031])
67    0x26, 0xFF, 0x00,    //         LogicalMaximum(255)
68    0x95, 0x02,          //         ReportCount(2)
69    0x75, 0x08,          //         ReportSize(8)
70    0x81, 0x02,          //         Input(Data, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
71    0xC0,                //     EndCollection()
72    0x09, 0x01,          //     UsageId(Pointer[0x0001])
73    0xA1, 0x00,          //     Collection(Physical)
74    0x09, 0x32,          //         UsageId(Z[0x0032])
75    0x09, 0x35,          //         UsageId(Rz[0x0035])
76    0x81, 0x02,          //         Input(Data, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
77    0xC0,                //     EndCollection()
78    0x09, 0x33,          //     UsageId(Rx[0x0033])
79    0x09, 0x34,          //     UsageId(Ry[0x0034])
80    0x81, 0x02,          //     Input(Data, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
81    0x95, 0x01,          //     ReportCount(1)
82    0x81, 0x03,          //     Input(Constant, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
83    0x85, 0x02,          //     ReportId(2)
84    0x05, 0x09,          //     UsagePage(Button[0x0009])
85    0x09, 0x03,          //     UsageId(Button 3[0x0003])
86    0x09, 0x01,          //     UsageId(Button 1[0x0001])
87    0x09, 0x02,          //     UsageId(Button 2[0x0002])
88    0x09, 0x04,          //     UsageId(Button 4[0x0004])
89    0x09, 0x0B,          //     UsageId(Button 11[0x000B])
90    0x09, 0x0C,          //     UsageId(Button 12[0x000C])
91    0x25, 0x01,          //     LogicalMaximum(1)
92    0x95, 0x06,          //     ReportCount(6)
93    0x75, 0x01,          //     ReportSize(1)
94    0x81, 0x02,          //     Input(Data, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
95    0x95, 0x01,          //     ReportCount(1)
96    0x81, 0x03,          //     Input(Constant, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
97    0x09, 0x0A,          //     UsageId(Button 10[0x000A])
98    0x81, 0x02,          //     Input(Data, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
99    0x81, 0x03,          //     Input(Constant, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
100    0x09, 0x09,          //     UsageId(Button 9[0x0009])
101    0x81, 0x02,          //     Input(Data, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
102    0x75, 0x02,          //     ReportSize(2)
103    0x81, 0x03,          //     Input(Constant, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
104    0x09, 0x08,          //     UsageId(Button 8[0x0008])
105    0x09, 0x06,          //     UsageId(Button 6[0x0006])
106    0x09, 0x07,          //     UsageId(Button 7[0x0007])
107    0x09, 0x05,          //     UsageId(Button 5[0x0005])
108    0x95, 0x04,          //     ReportCount(4)
109    0x75, 0x01,          //     ReportSize(1)
110    0x81, 0x02,          //     Input(Data, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
111    0x05, 0x01,          //     UsagePage(Generic Desktop[0x0001])
112    0x09, 0x01,          //     UsageId(Pointer[0x0001])
113    0xA1, 0x00,          //     Collection(Physical)
114    0x09, 0x30,          //         UsageId(X[0x0030])
115    0x09, 0x31,          //         UsageId(Y[0x0031])
116    0x26, 0xFF, 0x00,    //         LogicalMaximum(255)
117    0x95, 0x02,          //         ReportCount(2)
118    0x75, 0x08,          //         ReportSize(8)
119    0x81, 0x02,          //         Input(Data, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
120    0xC0,                //     EndCollection()
121    0x09, 0x01,          //     UsageId(Pointer[0x0001])
122    0xA1, 0x00,          //     Collection(Physical)
123    0x09, 0x32,          //         UsageId(Z[0x0032])
124    0x09, 0x35,          //         UsageId(Rz[0x0035])
125    0x81, 0x02,          //         Input(Data, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
126    0xC0,                //     EndCollection()
127    0x09, 0x33,          //     UsageId(Rx[0x0033])
128    0x09, 0x34,          //     UsageId(Ry[0x0034])
129    0x81, 0x02,          //     Input(Data, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
130    0x95, 0x01,          //     ReportCount(1)
131    0x81, 0x03,          //     Input(Constant, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
132    0x85, 0x03,          //     ReportId(3)
133    0x05, 0x09,          //     UsagePage(Button[0x0009])
134    0x09, 0x03,          //     UsageId(Button 3[0x0003])
135    0x09, 0x01,          //     UsageId(Button 1[0x0001])
136    0x09, 0x02,          //     UsageId(Button 2[0x0002])
137    0x09, 0x04,          //     UsageId(Button 4[0x0004])
138    0x09, 0x0B,          //     UsageId(Button 11[0x000B])
139    0x09, 0x0C,          //     UsageId(Button 12[0x000C])
140    0x25, 0x01,          //     LogicalMaximum(1)
141    0x95, 0x06,          //     ReportCount(6)
142    0x75, 0x01,          //     ReportSize(1)
143    0x81, 0x02,          //     Input(Data, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
144    0x95, 0x01,          //     ReportCount(1)
145    0x81, 0x03,          //     Input(Constant, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
146    0x09, 0x0A,          //     UsageId(Button 10[0x000A])
147    0x81, 0x02,          //     Input(Data, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
148    0x81, 0x03,          //     Input(Constant, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
149    0x09, 0x09,          //     UsageId(Button 9[0x0009])
150    0x81, 0x02,          //     Input(Data, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
151    0x75, 0x02,          //     ReportSize(2)
152    0x81, 0x03,          //     Input(Constant, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
153    0x09, 0x08,          //     UsageId(Button 8[0x0008])
154    0x09, 0x06,          //     UsageId(Button 6[0x0006])
155    0x09, 0x07,          //     UsageId(Button 7[0x0007])
156    0x09, 0x05,          //     UsageId(Button 5[0x0005])
157    0x95, 0x04,          //     ReportCount(4)
158    0x75, 0x01,          //     ReportSize(1)
159    0x81, 0x02,          //     Input(Data, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
160    0x05, 0x01,          //     UsagePage(Generic Desktop[0x0001])
161    0x09, 0x01,          //     UsageId(Pointer[0x0001])
162    0xA1, 0x00,          //     Collection(Physical)
163    0x09, 0x30,          //         UsageId(X[0x0030])
164    0x09, 0x31,          //         UsageId(Y[0x0031])
165    0x26, 0xFF, 0x00,    //         LogicalMaximum(255)
166    0x95, 0x02,          //         ReportCount(2)
167    0x75, 0x08,          //         ReportSize(8)
168    0x81, 0x02,          //         Input(Data, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
169    0xC0,                //     EndCollection()
170    0x09, 0x01,          //     UsageId(Pointer[0x0001])
171    0xA1, 0x00,          //     Collection(Physical)
172    0x09, 0x32,          //         UsageId(Z[0x0032])
173    0x09, 0x35,          //         UsageId(Rz[0x0035])
174    0x81, 0x02,          //         Input(Data, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
175    0xC0,                //     EndCollection()
176    0x09, 0x33,          //     UsageId(Rx[0x0033])
177    0x09, 0x34,          //     UsageId(Ry[0x0034])
178    0x81, 0x02,          //     Input(Data, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
179    0x95, 0x01,          //     ReportCount(1)
180    0x81, 0x03,          //     Input(Constant, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
181    0x85, 0x04,          //     ReportId(4)
182    0x05, 0x09,          //     UsagePage(Button[0x0009])
183    0x09, 0x03,          //     UsageId(Button 3[0x0003])
184    0x09, 0x01,          //     UsageId(Button 1[0x0001])
185    0x09, 0x02,          //     UsageId(Button 2[0x0002])
186    0x09, 0x04,          //     UsageId(Button 4[0x0004])
187    0x09, 0x0B,          //     UsageId(Button 11[0x000B])
188    0x09, 0x0C,          //     UsageId(Button 12[0x000C])
189    0x25, 0x01,          //     LogicalMaximum(1)
190    0x95, 0x06,          //     ReportCount(6)
191    0x75, 0x01,          //     ReportSize(1)
192    0x81, 0x02,          //     Input(Data, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
193    0x95, 0x01,          //     ReportCount(1)
194    0x81, 0x03,          //     Input(Constant, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
195    0x09, 0x0A,          //     UsageId(Button 10[0x000A])
196    0x81, 0x02,          //     Input(Data, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
197    0x81, 0x03,          //     Input(Constant, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
198    0x09, 0x09,          //     UsageId(Button 9[0x0009])
199    0x81, 0x02,          //     Input(Data, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
200    0x75, 0x02,          //     ReportSize(2)
201    0x81, 0x03,          //     Input(Constant, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
202    0x09, 0x08,          //     UsageId(Button 8[0x0008])
203    0x09, 0x06,          //     UsageId(Button 6[0x0006])
204    0x09, 0x07,          //     UsageId(Button 7[0x0007])
205    0x09, 0x05,          //     UsageId(Button 5[0x0005])
206    0x95, 0x04,          //     ReportCount(4)
207    0x75, 0x01,          //     ReportSize(1)
208    0x81, 0x02,          //     Input(Data, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
209    0x05, 0x01,          //     UsagePage(Generic Desktop[0x0001])
210    0x09, 0x01,          //     UsageId(Pointer[0x0001])
211    0xA1, 0x00,          //     Collection(Physical)
212    0x09, 0x30,          //         UsageId(X[0x0030])
213    0x09, 0x31,          //         UsageId(Y[0x0031])
214    0x26, 0xFF, 0x00,    //         LogicalMaximum(255)
215    0x95, 0x02,          //         ReportCount(2)
216    0x75, 0x08,          //         ReportSize(8)
217    0x81, 0x02,          //         Input(Data, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
218    0xC0,                //     EndCollection()
219    0x09, 0x01,          //     UsageId(Pointer[0x0001])
220    0xA1, 0x00,          //     Collection(Physical)
221    0x09, 0x32,          //         UsageId(Z[0x0032])
222    0x09, 0x35,          //         UsageId(Rz[0x0035])
223    0x81, 0x02,          //         Input(Data, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
224    0xC0,                //     EndCollection()
225    0x09, 0x33,          //     UsageId(Rx[0x0033])
226    0x09, 0x34,          //     UsageId(Ry[0x0034])
227    0x81, 0x02,          //     Input(Data, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
228    0x95, 0x01,          //     ReportCount(1)
229    0x81, 0x03,          //     Input(Constant, Variable, Absolute, NoWrap, Linear, PreferredState, NoNullPosition, BitField)
230    0xC0,                // EndCollection()
231};
232