aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-sony.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hid/hid-sony.c')
-rw-r--r--drivers/hid/hid-sony.c320
1 files changed, 256 insertions, 64 deletions
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 9013005a9f35..62765c76c56a 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -73,71 +73,263 @@ static const u8 sixaxis_rdesc_fixup2[] = {
73 0xb1, 0x02, 0xc0, 0xc0, 73 0xb1, 0x02, 0xc0, 0xc0,
74}; 74};
75 75
76/* The default descriptor doesn't provide mapping for the accelerometers
77 * or orientation sensors. This fixed descriptor maps the accelerometers
78 * to usage values 0x40, 0x41 and 0x42 and maps the orientation sensors
79 * to usage values 0x43, 0x44 and 0x45.
80 */
76static u8 dualshock4_usb_rdesc[] = { 81static u8 dualshock4_usb_rdesc[] = {
77 0x05, 0x01, 0x09, 0x05, 0xa1, 0x01, 0x85, 0x01, 82 0x05, 0x01, /* Usage Page (Desktop), */
78 0x09, 0x30, 0x09, 0x31, 0x09, 0x32, 0x09, 0x35, 83 0x09, 0x05, /* Usage (Gamepad), */
79 0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 0x08, 0x95, 84 0xA1, 0x01, /* Collection (Application), */
80 0x04, 0x81, 0x02, 0x09, 0x39, 0x15, 0x00, 0x25, 85 0x85, 0x01, /* Report ID (1), */
81 0x07, 0x35, 0x00, 0x46, 0x3b, 0x01, 0x65, 0x14, 86 0x09, 0x30, /* Usage (X), */
82 0x75, 0x04, 0x95, 0x01, 0x81, 0x42, 0x65, 0x00, 87 0x09, 0x31, /* Usage (Y), */
83 0x05, 0x09, 0x19, 0x01, 0x29, 0x0e, 0x15, 0x00, 88 0x09, 0x32, /* Usage (Z), */
84 0x25, 0x01, 0x75, 0x01, 0x95, 0x0e, 0x81, 0x02, 89 0x09, 0x35, /* Usage (Rz), */
85 0x06, 0x00, 0xff, 0x09, 0x20, 0x75, 0x06, 0x95, 90 0x15, 0x00, /* Logical Minimum (0), */
86 0x01, 0x15, 0x00, 0x25, 0x7f, 0x81, 0x02, 0x05, 91 0x26, 0xFF, 0x00, /* Logical Maximum (255), */
87 0x01, 0x09, 0x33, 0x09, 0x34, 0x15, 0x00, 0x26, 92 0x75, 0x08, /* Report Size (8), */
88 0xff, 0x00, 0x75, 0x08, 0x95, 0x02, 0x81, 0x02, 93 0x95, 0x04, /* Report Count (4), */
89 0x06, 0x00, 0xff, 0x09, 0x21, 0x95, 0x03, 0x81, 94 0x81, 0x02, /* Input (Variable), */
90 0x02, 0x05, 0x01, 0x19, 0x40, 0x29, 0x42, 0x16, 95 0x09, 0x39, /* Usage (Hat Switch), */
91 0x00, 0x80, 0x26, 0x00, 0x7f, 0x75, 0x10, 0x95, 96 0x15, 0x00, /* Logical Minimum (0), */
92 0x03, 0x81, 0x02, 0x05, 0x01, 0x19, 0x43, 0x29, 97 0x25, 0x07, /* Logical Maximum (7), */
93 0x45, 0x16, 0xff, 0xbf, 0x26, 0x00, 0x40, 0x95, 98 0x35, 0x00, /* Physical Minimum (0), */
94 0x03, 0x81, 0x02, 0x06, 0x00, 0xff, 0x09, 0x21, 99 0x46, 0x3B, 0x01, /* Physical Maximum (315), */
95 0x75, 0x08, 0x95, 0x27, 0x81, 0x02, 0x85, 0x05, 100 0x65, 0x14, /* Unit (Degrees), */
96 0x09, 0x22, 0x95, 0x1f, 0x91, 0x02, 0x85, 0x04, 101 0x75, 0x04, /* Report Size (4), */
97 0x09, 0x23, 0x95, 0x24, 0xb1, 0x02, 0x85, 0x02, 102 0x95, 0x01, /* Report Count (1), */
98 0x09, 0x24, 0x95, 0x24, 0xb1, 0x02, 0x85, 0x08, 103 0x81, 0x42, /* Input (Variable, Null State), */
99 0x09, 0x25, 0x95, 0x03, 0xb1, 0x02, 0x85, 0x10, 104 0x65, 0x00, /* Unit, */
100 0x09, 0x26, 0x95, 0x04, 0xb1, 0x02, 0x85, 0x11, 105 0x05, 0x09, /* Usage Page (Button), */
101 0x09, 0x27, 0x95, 0x02, 0xb1, 0x02, 0x85, 0x12, 106 0x19, 0x01, /* Usage Minimum (01h), */
102 0x06, 0x02, 0xff, 0x09, 0x21, 0x95, 0x0f, 0xb1, 107 0x29, 0x0E, /* Usage Maximum (0Eh), */
103 0x02, 0x85, 0x13, 0x09, 0x22, 0x95, 0x16, 0xb1, 108 0x15, 0x00, /* Logical Minimum (0), */
104 0x02, 0x85, 0x14, 0x06, 0x05, 0xff, 0x09, 0x20, 109 0x25, 0x01, /* Logical Maximum (1), */
105 0x95, 0x10, 0xb1, 0x02, 0x85, 0x15, 0x09, 0x21, 110 0x75, 0x01, /* Report Size (1), */
106 0x95, 0x2c, 0xb1, 0x02, 0x06, 0x80, 0xff, 0x85, 111 0x95, 0x0E, /* Report Count (14), */
107 0x80, 0x09, 0x20, 0x95, 0x06, 0xb1, 0x02, 0x85, 112 0x81, 0x02, /* Input (Variable), */
108 0x81, 0x09, 0x21, 0x95, 0x06, 0xb1, 0x02, 0x85, 113 0x06, 0x00, 0xFF, /* Usage Page (FF00h), */
109 0x82, 0x09, 0x22, 0x95, 0x05, 0xb1, 0x02, 0x85, 114 0x09, 0x20, /* Usage (20h), */
110 0x83, 0x09, 0x23, 0x95, 0x01, 0xb1, 0x02, 0x85, 115 0x75, 0x06, /* Report Size (6), */
111 0x84, 0x09, 0x24, 0x95, 0x04, 0xb1, 0x02, 0x85, 116 0x95, 0x01, /* Report Count (1), */
112 0x85, 0x09, 0x25, 0x95, 0x06, 0xb1, 0x02, 0x85, 117 0x15, 0x00, /* Logical Minimum (0), */
113 0x86, 0x09, 0x26, 0x95, 0x06, 0xb1, 0x02, 0x85, 118 0x25, 0x7F, /* Logical Maximum (127), */
114 0x87, 0x09, 0x27, 0x95, 0x23, 0xb1, 0x02, 0x85, 119 0x81, 0x02, /* Input (Variable), */
115 0x88, 0x09, 0x28, 0x95, 0x22, 0xb1, 0x02, 0x85, 120 0x05, 0x01, /* Usage Page (Desktop), */
116 0x89, 0x09, 0x29, 0x95, 0x02, 0xb1, 0x02, 0x85, 121 0x09, 0x33, /* Usage (Rx), */
117 0x90, 0x09, 0x30, 0x95, 0x05, 0xb1, 0x02, 0x85, 122 0x09, 0x34, /* Usage (Ry), */
118 0x91, 0x09, 0x31, 0x95, 0x03, 0xb1, 0x02, 0x85, 123 0x15, 0x00, /* Logical Minimum (0), */
119 0x92, 0x09, 0x32, 0x95, 0x03, 0xb1, 0x02, 0x85, 124 0x26, 0xFF, 0x00, /* Logical Maximum (255), */
120 0x93, 0x09, 0x33, 0x95, 0x0c, 0xb1, 0x02, 0x85, 125 0x75, 0x08, /* Report Size (8), */
121 0xa0, 0x09, 0x40, 0x95, 0x06, 0xb1, 0x02, 0x85, 126 0x95, 0x02, /* Report Count (2), */
122 0xa1, 0x09, 0x41, 0x95, 0x01, 0xb1, 0x02, 0x85, 127 0x81, 0x02, /* Input (Variable), */
123 0xa2, 0x09, 0x42, 0x95, 0x01, 0xb1, 0x02, 0x85, 128 0x06, 0x00, 0xFF, /* Usage Page (FF00h), */
124 0xa3, 0x09, 0x43, 0x95, 0x30, 0xb1, 0x02, 0x85, 129 0x09, 0x21, /* Usage (21h), */
125 0xa4, 0x09, 0x44, 0x95, 0x0d, 0xb1, 0x02, 0x85, 130 0x95, 0x03, /* Report Count (3), */
126 0xa5, 0x09, 0x45, 0x95, 0x15, 0xb1, 0x02, 0x85, 131 0x81, 0x02, /* Input (Variable), */
127 0xa6, 0x09, 0x46, 0x95, 0x15, 0xb1, 0x02, 0x85, 132 0x05, 0x01, /* Usage Page (Desktop), */
128 0xf0, 0x09, 0x47, 0x95, 0x3f, 0xb1, 0x02, 0x85, 133 0x19, 0x40, /* Usage Minimum (40h), */
129 0xf1, 0x09, 0x48, 0x95, 0x3f, 0xb1, 0x02, 0x85, 134 0x29, 0x42, /* Usage Maximum (42h), */
130 0xf2, 0x09, 0x49, 0x95, 0x0f, 0xb1, 0x02, 0x85, 135 0x16, 0x00, 0x80, /* Logical Minimum (-32768), */
131 0xa7, 0x09, 0x4a, 0x95, 0x01, 0xb1, 0x02, 0x85, 136 0x26, 0x00, 0x7F, /* Logical Maximum (32767), */
132 0xa8, 0x09, 0x4b, 0x95, 0x01, 0xb1, 0x02, 0x85, 137 0x75, 0x10, /* Report Size (16), */
133 0xa9, 0x09, 0x4c, 0x95, 0x08, 0xb1, 0x02, 0x85, 138 0x95, 0x03, /* Report Count (3), */
134 0xaa, 0x09, 0x4e, 0x95, 0x01, 0xb1, 0x02, 0x85, 139 0x81, 0x02, /* Input (Variable), */
135 0xab, 0x09, 0x4f, 0x95, 0x39, 0xb1, 0x02, 0x85, 140 0x19, 0x43, /* Usage Minimum (43h), */
136 0xac, 0x09, 0x50, 0x95, 0x39, 0xb1, 0x02, 0x85, 141 0x29, 0x45, /* Usage Maximum (45h), */
137 0xad, 0x09, 0x51, 0x95, 0x0b, 0xb1, 0x02, 0x85, 142 0x16, 0xFF, 0xBF, /* Logical Minimum (-16385), */
138 0xae, 0x09, 0x52, 0x95, 0x01, 0xb1, 0x02, 0x85, 143 0x26, 0x00, 0x40, /* Logical Maximum (16384), */
139 0xaf, 0x09, 0x53, 0x95, 0x02, 0xb1, 0x02, 0x85, 144 0x95, 0x03, /* Report Count (3), */
140 0xb0, 0x09, 0x54, 0x95, 0x3f, 0xb1, 0x02, 0xc0, 145 0x81, 0x02, /* Input (Variable), */
146 0x06, 0x00, 0xFF, /* Usage Page (FF00h), */
147 0x09, 0x21, /* Usage (21h), */
148 0x15, 0x00, /* Logical Minimum (0), */
149 0x25, 0xFF, /* Logical Maximum (255), */
150 0x75, 0x08, /* Report Size (8), */
151 0x95, 0x27, /* Report Count (39), */
152 0x81, 0x02, /* Input (Variable), */
153 0x85, 0x05, /* Report ID (5), */
154 0x09, 0x22, /* Usage (22h), */
155 0x95, 0x1F, /* Report Count (31), */
156 0x91, 0x02, /* Output (Variable), */
157 0x85, 0x04, /* Report ID (4), */
158 0x09, 0x23, /* Usage (23h), */
159 0x95, 0x24, /* Report Count (36), */
160 0xB1, 0x02, /* Feature (Variable), */
161 0x85, 0x02, /* Report ID (2), */
162 0x09, 0x24, /* Usage (24h), */
163 0x95, 0x24, /* Report Count (36), */
164 0xB1, 0x02, /* Feature (Variable), */
165 0x85, 0x08, /* Report ID (8), */
166 0x09, 0x25, /* Usage (25h), */
167 0x95, 0x03, /* Report Count (3), */
168 0xB1, 0x02, /* Feature (Variable), */
169 0x85, 0x10, /* Report ID (16), */
170 0x09, 0x26, /* Usage (26h), */
171 0x95, 0x04, /* Report Count (4), */
172 0xB1, 0x02, /* Feature (Variable), */
173 0x85, 0x11, /* Report ID (17), */
174 0x09, 0x27, /* Usage (27h), */
175 0x95, 0x02, /* Report Count (2), */
176 0xB1, 0x02, /* Feature (Variable), */
177 0x85, 0x12, /* Report ID (18), */
178 0x06, 0x02, 0xFF, /* Usage Page (FF02h), */
179 0x09, 0x21, /* Usage (21h), */
180 0x95, 0x0F, /* Report Count (15), */
181 0xB1, 0x02, /* Feature (Variable), */
182 0x85, 0x13, /* Report ID (19), */
183 0x09, 0x22, /* Usage (22h), */
184 0x95, 0x16, /* Report Count (22), */
185 0xB1, 0x02, /* Feature (Variable), */
186 0x85, 0x14, /* Report ID (20), */
187 0x06, 0x05, 0xFF, /* Usage Page (FF05h), */
188 0x09, 0x20, /* Usage (20h), */
189 0x95, 0x10, /* Report Count (16), */
190 0xB1, 0x02, /* Feature (Variable), */
191 0x85, 0x15, /* Report ID (21), */
192 0x09, 0x21, /* Usage (21h), */
193 0x95, 0x2C, /* Report Count (44), */
194 0xB1, 0x02, /* Feature (Variable), */
195 0x06, 0x80, 0xFF, /* Usage Page (FF80h), */
196 0x85, 0x80, /* Report ID (128), */
197 0x09, 0x20, /* Usage (20h), */
198 0x95, 0x06, /* Report Count (6), */
199 0xB1, 0x02, /* Feature (Variable), */
200 0x85, 0x81, /* Report ID (129), */
201 0x09, 0x21, /* Usage (21h), */
202 0x95, 0x06, /* Report Count (6), */
203 0xB1, 0x02, /* Feature (Variable), */
204 0x85, 0x82, /* Report ID (130), */
205 0x09, 0x22, /* Usage (22h), */
206 0x95, 0x05, /* Report Count (5), */
207 0xB1, 0x02, /* Feature (Variable), */
208 0x85, 0x83, /* Report ID (131), */
209 0x09, 0x23, /* Usage (23h), */
210 0x95, 0x01, /* Report Count (1), */
211 0xB1, 0x02, /* Feature (Variable), */
212 0x85, 0x84, /* Report ID (132), */
213 0x09, 0x24, /* Usage (24h), */
214 0x95, 0x04, /* Report Count (4), */
215 0xB1, 0x02, /* Feature (Variable), */
216 0x85, 0x85, /* Report ID (133), */
217 0x09, 0x25, /* Usage (25h), */
218 0x95, 0x06, /* Report Count (6), */
219 0xB1, 0x02, /* Feature (Variable), */
220 0x85, 0x86, /* Report ID (134), */
221 0x09, 0x26, /* Usage (26h), */
222 0x95, 0x06, /* Report Count (6), */
223 0xB1, 0x02, /* Feature (Variable), */
224 0x85, 0x87, /* Report ID (135), */
225 0x09, 0x27, /* Usage (27h), */
226 0x95, 0x23, /* Report Count (35), */
227 0xB1, 0x02, /* Feature (Variable), */
228 0x85, 0x88, /* Report ID (136), */
229 0x09, 0x28, /* Usage (28h), */
230 0x95, 0x22, /* Report Count (34), */
231 0xB1, 0x02, /* Feature (Variable), */
232 0x85, 0x89, /* Report ID (137), */
233 0x09, 0x29, /* Usage (29h), */
234 0x95, 0x02, /* Report Count (2), */
235 0xB1, 0x02, /* Feature (Variable), */
236 0x85, 0x90, /* Report ID (144), */
237 0x09, 0x30, /* Usage (30h), */
238 0x95, 0x05, /* Report Count (5), */
239 0xB1, 0x02, /* Feature (Variable), */
240 0x85, 0x91, /* Report ID (145), */
241 0x09, 0x31, /* Usage (31h), */
242 0x95, 0x03, /* Report Count (3), */
243 0xB1, 0x02, /* Feature (Variable), */
244 0x85, 0x92, /* Report ID (146), */
245 0x09, 0x32, /* Usage (32h), */
246 0x95, 0x03, /* Report Count (3), */
247 0xB1, 0x02, /* Feature (Variable), */
248 0x85, 0x93, /* Report ID (147), */
249 0x09, 0x33, /* Usage (33h), */
250 0x95, 0x0C, /* Report Count (12), */
251 0xB1, 0x02, /* Feature (Variable), */
252 0x85, 0xA0, /* Report ID (160), */
253 0x09, 0x40, /* Usage (40h), */
254 0x95, 0x06, /* Report Count (6), */
255 0xB1, 0x02, /* Feature (Variable), */
256 0x85, 0xA1, /* Report ID (161), */
257 0x09, 0x41, /* Usage (41h), */
258 0x95, 0x01, /* Report Count (1), */
259 0xB1, 0x02, /* Feature (Variable), */
260 0x85, 0xA2, /* Report ID (162), */
261 0x09, 0x42, /* Usage (42h), */
262 0x95, 0x01, /* Report Count (1), */
263 0xB1, 0x02, /* Feature (Variable), */
264 0x85, 0xA3, /* Report ID (163), */
265 0x09, 0x43, /* Usage (43h), */
266 0x95, 0x30, /* Report Count (48), */
267 0xB1, 0x02, /* Feature (Variable), */
268 0x85, 0xA4, /* Report ID (164), */
269 0x09, 0x44, /* Usage (44h), */
270 0x95, 0x0D, /* Report Count (13), */
271 0xB1, 0x02, /* Feature (Variable), */
272 0x85, 0xA5, /* Report ID (165), */
273 0x09, 0x45, /* Usage (45h), */
274 0x95, 0x15, /* Report Count (21), */
275 0xB1, 0x02, /* Feature (Variable), */
276 0x85, 0xA6, /* Report ID (166), */
277 0x09, 0x46, /* Usage (46h), */
278 0x95, 0x15, /* Report Count (21), */
279 0xB1, 0x02, /* Feature (Variable), */
280 0x85, 0xF0, /* Report ID (240), */
281 0x09, 0x47, /* Usage (47h), */
282 0x95, 0x3F, /* Report Count (63), */
283 0xB1, 0x02, /* Feature (Variable), */
284 0x85, 0xF1, /* Report ID (241), */
285 0x09, 0x48, /* Usage (48h), */
286 0x95, 0x3F, /* Report Count (63), */
287 0xB1, 0x02, /* Feature (Variable), */
288 0x85, 0xF2, /* Report ID (242), */
289 0x09, 0x49, /* Usage (49h), */
290 0x95, 0x0F, /* Report Count (15), */
291 0xB1, 0x02, /* Feature (Variable), */
292 0x85, 0xA7, /* Report ID (167), */
293 0x09, 0x4A, /* Usage (4Ah), */
294 0x95, 0x01, /* Report Count (1), */
295 0xB1, 0x02, /* Feature (Variable), */
296 0x85, 0xA8, /* Report ID (168), */
297 0x09, 0x4B, /* Usage (4Bh), */
298 0x95, 0x01, /* Report Count (1), */
299 0xB1, 0x02, /* Feature (Variable), */
300 0x85, 0xA9, /* Report ID (169), */
301 0x09, 0x4C, /* Usage (4Ch), */
302 0x95, 0x08, /* Report Count (8), */
303 0xB1, 0x02, /* Feature (Variable), */
304 0x85, 0xAA, /* Report ID (170), */
305 0x09, 0x4E, /* Usage (4Eh), */
306 0x95, 0x01, /* Report Count (1), */
307 0xB1, 0x02, /* Feature (Variable), */
308 0x85, 0xAB, /* Report ID (171), */
309 0x09, 0x4F, /* Usage (4Fh), */
310 0x95, 0x39, /* Report Count (57), */
311 0xB1, 0x02, /* Feature (Variable), */
312 0x85, 0xAC, /* Report ID (172), */
313 0x09, 0x50, /* Usage (50h), */
314 0x95, 0x39, /* Report Count (57), */
315 0xB1, 0x02, /* Feature (Variable), */
316 0x85, 0xAD, /* Report ID (173), */
317 0x09, 0x51, /* Usage (51h), */
318 0x95, 0x0B, /* Report Count (11), */
319 0xB1, 0x02, /* Feature (Variable), */
320 0x85, 0xAE, /* Report ID (174), */
321 0x09, 0x52, /* Usage (52h), */
322 0x95, 0x01, /* Report Count (1), */
323 0xB1, 0x02, /* Feature (Variable), */
324 0x85, 0xAF, /* Report ID (175), */
325 0x09, 0x53, /* Usage (53h), */
326 0x95, 0x02, /* Report Count (2), */
327 0xB1, 0x02, /* Feature (Variable), */
328 0x85, 0xB0, /* Report ID (176), */
329 0x09, 0x54, /* Usage (54h), */
330 0x95, 0x3F, /* Report Count (63), */
331 0xB1, 0x02, /* Feature (Variable), */
332 0xC0 /* End Collection */
141}; 333};
142 334
143static __u8 ps3remote_rdesc[] = { 335static __u8 ps3remote_rdesc[] = {