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