1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
/* $NetBSD: xinput_rdesc.h,v 1.2 2016/04/23 10:15:32 skrll Exp $ */
/*-
* Copyright (c) 2011 Jared D. McNeill <jmcneill@invisible.ca>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Descriptor from http://euc.jp/periphs/xbox-pad-report-desc.txt
*/
#define USBIF_IS_XINPUT(uiaa) \
((uiaa)->uiaa_class == UICLASS_VENDOR && \
(uiaa)->uiaa_subclass == 0x5d && \
(uiaa)->uiaa_proto == 0x01)
static const uByte uhid_xinput_report_descr[] = {
0x05, 0x01, /* Usage Page (Generic Desktop) */
0x09, 0x05, /* Usage (Game Pad) */
0xa1, 0x01, /* Collection (Application) */
0x05, 0x01, /* Usage Page (Generic Desktop) */
0x09, 0x3a, /* Usage (Counted Buffer) */
0xa1, 0x02, /* Collection (Logical) */
0x75, 0x08, /* Report Size (8) */
0x95, 0x01, /* Report Count (1) */
0x81, 0x01, /* Input (Constant) */
0x75, 0x08, /* Report Size (8) */
0x95, 0x01, /* Report Count (1) */
0x05, 0x01, /* Usage Page (Generic Desktop) */
0x09, 0x3b, /* Usage (Byte Count) */
0x81, 0x01, /* Input (Constant) */
0x05, 0x01, /* Usage Page (Generic Desktop) */
0x09, 0x01, /* Usage (Pointer) */
0xa1, 0x00, /* Collection (Physical) */
0x75, 0x01, /* Report Size (1) */
0x15, 0x00, /* Logical Minimum (0) */
0x25, 0x01, /* Logical Maximum (1) */
0x35, 0x00, /* Physical Minimum (0) */
0x45, 0x01, /* Physical Maximum (1) */
0x95, 0x04, /* Report Count (4) */
0x05, 0x01, /* Usage Page (Generic Desktop) */
0x09, 0x90, /* Usage (D-pad Up) */
0x09, 0x91, /* Usage (D-pad Down) */
0x09, 0x93, /* Usage (D-pad Left) */
0x09, 0x92, /* Usage (D-pad Right) */
0x81, 0x02, /* Input (Data,Variable,Absolute) */
0xc0, /* End Collection */
0x75, 0x01, /* Report Size (1) */
0x15, 0x00, /* Logical Minimum (0) */
0x25, 0x01, /* Logical Maximum (1) */
0x35, 0x00, /* Physical Minimum (0) */
0x45, 0x01, /* Physical Maximum (1) */
0x95, 0x04, /* Report Count (4) */
0x05, 0x09, /* Usage Page (Button) */
0x19, 0x07, /* Usage Minimum (Button 7) */
0x29, 0x0a, /* Usage Maximum (Button 10) */
0x81, 0x02, /* Input (Data,Variable,Absolute) */
0x75, 0x01, /* Report Size (1) */
0x95, 0x08, /* Report Count (8) */
0x81, 0x01, /* Input (Constant) */
0x75, 0x08, /* Report Size (8) */
0x15, 0x00, /* Logical Minimum (0) */
0x26, 0xff, 0x00, /* Logical Maximum (255) */
0x35, 0x00, /* Physical Minimum (0) */
0x46, 0xff, 0x00, /* Physical Maximum (255) */
0x95, 0x06, /* Report Count (6) */
0x05, 0x09, /* Usage Page (Button) */
0x19, 0x01, /* Usage Minimum (Button 1) */
0x29, 0x06, /* Usage Minimum (Button 6) */
0x81, 0x02, /* Input (Data,Variable,Absolute) */
0x75, 0x08, /* Report Size (8) */
0x15, 0x00, /* Logical Minimum (0) */
0x26, 0xff, 0x00, /* Logical Maximum (255) */
0x35, 0x00, /* Physical Minimum (0) */
0x46, 0xff, 0x00, /* Physical Maximum (255) */
0x95, 0x02, /* Report Count (2) */
0x05, 0x01, /* Usage Page (Generic Desktop) */
0x09, 0x32, /* Usage (Z) */
0x09, 0x35, /* Usage (Rz) */
0x81, 0x02, /* Input (Data,Variable,Absolute) */
0x75, 0x10, /* Report Size (16) */
0x16, 0x00, 0x80, /* Logical Minimum (-32768) */
0x26, 0xff, 0x7f, /* Logical Maximum (32767) */
0x36, 0x00, 0x80, /* Physical Minimum (-32768) */
0x46, 0xff, 0x7f, /* Physical Maximum (32767) */
0x05, 0x01, /* Usage Page (Generic Desktop) */
0x09, 0x01, /* Usage (Pointer) */
0xa1, 0x00, /* Collection (Physical) */
0x95, 0x02, /* Report Count (2) */
0x05, 0x01, /* Usage Page (Generic Desktop) */
0x09, 0x30, /* Usage (X) */
0x09, 0x31, /* Usage (Y) */
0x81, 0x02, /* Input (Data,Variable,Absolute) */
0xc0, /* End Collection */
0x05, 0x01, /* Usage Page (Generic Desktop) */
0x09, 0x01, /* Usage (Pointer) */
0xa1, 0x00, /* Collection (Physical) */
0x95, 0x02, /* Report Count (2) */
0x05, 0x01, /* Usage Page (Generic Desktop) */
0x09, 0x33, /* Usage (Rx) */
0x09, 0x34, /* Usage (Ry) */
0x81, 0x02, /* Input (Data,Variable,Absolute) */
0xc0, /* End Collection */
0xc0, /* End Collection */
0x05, 0x01, /* Usage Page (Generic Desktop) */
0x09, 0x3a, /* Usage (Counted Buffer) */
0xa1, 0x02, /* Collection (Logical) */
0x75, 0x08, /* Report Size (8) */
0x95, 0x01, /* Report Count (1) */
0x91, 0x01, /* Output (Constant) */
0x75, 0x08, /* Report Size (8) */
0x95, 0x01, /* Report Count (1) */
0x05, 0x01, /* Usage Page (Generic Desktop) */
0x09, 0x3b, /* Usage (Byte Count) */
0x91, 0x01, /* Output (Constant) */
0x75, 0x08, /* Report Size (8) */
0x95, 0x01, /* Report Count (1) */
0x91, 0x01, /* Output (Constant) */
0x75, 0x08, /* Report Size (8) */
0x15, 0x00, /* Logical Minimum (0) */
0x26, 0xff, 0x00, /* Logical Maximum (255) */
0x35, 0x00, /* Physical Minimum (0) */
0x46, 0xff, 0x00, /* Physical Maximum (255) */
0x95, 0x01, /* Report Count (1) */
0x06, 0x00, 0xff, /* Usage Page (vendor-defined) */
0x09, 0x01, /* Usage (1) */
0x91, 0x02, /* Output (Data,Variable,Absolute) */
0x75, 0x08, /* Report Size (8) */
0x95, 0x01, /* Report Count (1) */
0x91, 0x01, /* Output (Constant) */
0x75, 0x08, /* Report Size (8) */
0x15, 0x00, /* Logical Minimum (0) */
0x26, 0xff, 0x00, /* Logical Maximum (255) */
0x35, 0x00, /* Physical Minimum (0) */
0x46, 0xff, 0x00, /* Physical Maximum (255) */
0x95, 0x01, /* Report Count (1) */
0x06, 0x00, 0xff, /* Usage Page (vendor-defined) */
0x09, 0x02, /* Usage (2) */
0x91, 0x02, /* Output (Data,Variable,Absolute) */
0xc0, /* End Collection */
0xc0, /* End Collection */
};
|