Commit | Line | Data |
---|---|---|
72a46344 NK |
1 | /* |
2 | * HID driver for Waltop devices not fully compliant with HID standard | |
3 | * | |
4 | * Copyright (c) 2010 Nikolai Kondrashov | |
5 | */ | |
6 | ||
7 | /* | |
8 | * This program is free software; you can redistribute it and/or modify it | |
9 | * under the terms of the GNU General Public License as published by the Free | |
10 | * Software Foundation; either version 2 of the License, or (at your option) | |
11 | * any later version. | |
12 | */ | |
13 | ||
14 | #include <linux/device.h> | |
15 | #include <linux/hid.h> | |
16 | #include <linux/module.h> | |
17 | ||
18 | #include "hid-ids.h" | |
19 | ||
cdd49a85 NK |
20 | /* |
21 | * There exists an official driver on the manufacturer's website, which | |
22 | * wasn't submitted to the kernel, for some reason. The official driver | |
23 | * doesn't seem to support extra features of some tablets, like wheels. | |
24 | * | |
25 | * It shows that the feature report ID 2 could be used to control any waltop | |
26 | * tablet input mode, switching it between "default", "tablet" and "ink". | |
27 | * | |
28 | * This driver only uses "default" mode for all the supported tablets. This | |
29 | * mode tries to be HID-compatible (not very successfully), but cripples the | |
30 | * resolution of some tablets. | |
31 | * | |
32 | * The "tablet" mode uses some proprietary, yet decipherable protocol, which | |
33 | * represents the correct resolution, but is possibly HID-incompatible (i.e. | |
34 | * indescribable by a report descriptor). | |
35 | * | |
36 | * The purpose of the "ink" mode is unknown. | |
37 | * | |
38 | * The feature reports needed for switching to each mode are these: | |
39 | * | |
40 | * 02 16 00 default | |
41 | * 02 16 01 tablet | |
42 | * 02 16 02 ink | |
43 | */ | |
44 | ||
72a46344 NK |
45 | /* |
46 | * Original Slim Tablet 5.8 inch report descriptor. | |
47 | * | |
48 | * All the reports except the report with ID 16 (the stylus) are unused, | |
49 | * possibly because the tablet is not configured to, or because they were | |
cdd49a85 NK |
50 | * just copied from a more capable model. The full purpose of features |
51 | * described for report ID 2 is unknown. | |
72a46344 NK |
52 | * |
53 | * The stylus buttons are described as three bit fields, whereas actually | |
54 | * it's an "array", i.e. they're reported as button numbers (1, 2 and 3). | |
55 | * The "eraser" field is not used. There is also a "push" without a "pop" in | |
56 | * the stylus description. | |
57 | * | |
58 | * Usage Page (Desktop), ; Generic desktop controls (01h) | |
59 | * Usage (Mouse), ; Mouse (02h, application collection) | |
60 | * Collection (Application), | |
61 | * Report ID (1), | |
62 | * Usage (Pointer), ; Pointer (01h, physical collection) | |
63 | * Collection (Physical), | |
64 | * Usage Page (Button), ; Button (09h) | |
65 | * Usage Minimum (01h), | |
66 | * Usage Maximum (05h), | |
67 | * Logical Minimum (0), | |
68 | * Logical Maximum (1), | |
69 | * Report Size (1), | |
70 | * Report Count (5), | |
71 | * Input (Variable), | |
72 | * Report Size (3), | |
73 | * Report Count (1), | |
74 | * Input (Constant, Variable), | |
75 | * Usage Page (Desktop), ; Generic desktop controls (01h) | |
76 | * Usage (X), ; X (30h, dynamic value) | |
77 | * Usage (Y), ; Y (31h, dynamic value) | |
78 | * Usage (Wheel), ; Wheel (38h, dynamic value) | |
79 | * Logical Minimum (-127), | |
80 | * Logical Maximum (127), | |
81 | * Report Size (8), | |
82 | * Report Count (3), | |
83 | * Input (Variable, Relative), | |
84 | * End Collection, | |
85 | * End Collection, | |
86 | * Usage Page (Digitizer), ; Digitizer (0Dh) | |
87 | * Usage (Pen), ; Pen (02h, application collection) | |
88 | * Collection (Application), | |
89 | * Report ID (2), | |
90 | * Usage (Stylus), ; Stylus (20h, logical collection) | |
91 | * Collection (Physical), | |
92 | * Usage (00h), | |
93 | * Logical Minimum (0), | |
94 | * Logical Maximum (255), | |
95 | * Report Size (8), | |
96 | * Report Count (7), | |
97 | * Input (Variable), | |
98 | * Usage (Azimuth), ; Azimuth (3Fh, dynamic value) | |
99 | * Usage (Altitude), ; Altitude (40h, dynamic value) | |
100 | * Logical Minimum (0), | |
101 | * Logical Maximum (255), | |
102 | * Report Size (8), | |
103 | * Report Count (2), | |
104 | * Feature (Variable), | |
105 | * End Collection, | |
106 | * Report ID (5), | |
107 | * Usage Page (Digitizer), ; Digitizer (0Dh) | |
108 | * Usage (Stylus), ; Stylus (20h, logical collection) | |
109 | * Collection (Physical), | |
110 | * Usage (00h), | |
111 | * Logical Minimum (0), | |
112 | * Logical Maximum (255), | |
113 | * Report Size (8), | |
114 | * Report Count (7), | |
115 | * Input (Variable), | |
116 | * End Collection, | |
117 | * Report ID (10), | |
118 | * Usage Page (Digitizer), ; Digitizer (0Dh) | |
119 | * Usage (Stylus), ; Stylus (20h, logical collection) | |
120 | * Collection (Physical), | |
121 | * Usage (00h), | |
122 | * Logical Minimum (0), | |
123 | * Logical Maximum (255), | |
124 | * Report Size (8), | |
125 | * Report Count (3), | |
126 | * Input (Variable), | |
127 | * End Collection, | |
128 | * Report ID (16), | |
129 | * Usage (Stylus), ; Stylus (20h, logical collection) | |
130 | * Collection (Physical), | |
131 | * Usage (Tip Switch), ; Tip switch (42h, momentary control) | |
132 | * Usage (Barrel Switch), ; Barrel switch (44h, momentary control) | |
133 | * Usage (Invert), ; Invert (3Ch, momentary control) | |
134 | * Usage (Eraser), ; Eraser (45h, momentary control) | |
135 | * Usage (In Range), ; In range (32h, momentary control) | |
136 | * Logical Minimum (0), | |
137 | * Logical Maximum (1), | |
138 | * Report Size (1), | |
139 | * Report Count (5), | |
140 | * Input (Variable), | |
141 | * Report Count (3), | |
142 | * Input (Constant, Variable), | |
143 | * Usage Page (Desktop), ; Generic desktop controls (01h) | |
144 | * Usage (X), ; X (30h, dynamic value) | |
145 | * Report Size (16), | |
146 | * Report Count (1), | |
147 | * Push, | |
148 | * Unit Exponent (13), | |
149 | * Unit (Inch^3), | |
150 | * Logical Minimum (0), | |
151 | * Logical Maximum (10000), | |
152 | * Physical Minimum (0), | |
153 | * Physical Maximum (10000), | |
154 | * Input (Variable), | |
155 | * Usage (Y), ; Y (31h, dynamic value) | |
156 | * Logical Maximum (6000), | |
157 | * Physical Maximum (6000), | |
158 | * Input (Variable), | |
159 | * Usage Page (Digitizer), ; Digitizer (0Dh) | |
160 | * Usage (Tip Pressure), ; Tip pressure (30h, dynamic value) | |
161 | * Logical Minimum (0), | |
162 | * Logical Maximum (1023), | |
163 | * Physical Minimum (0), | |
164 | * Physical Maximum (1023), | |
165 | * Input (Variable), | |
166 | * End Collection, | |
167 | * End Collection | |
168 | */ | |
169 | ||
170 | /* Size of the original report descriptor of Slim Tablet 5.8 inch */ | |
171 | #define SLIM_TABLET_5_8_INCH_RDESC_ORIG_SIZE 222 | |
172 | ||
173 | /* | |
174 | * Fixed Slim Tablet 5.8 inch descriptor. | |
175 | * | |
176 | * All the reports except the stylus report (ID 16) were removed as unused. | |
177 | * The stylus buttons description was fixed. | |
178 | */ | |
179 | static __u8 slim_tablet_5_8_inch_rdesc_fixed[] = { | |
180 | 0x05, 0x0D, /* Usage Page (Digitizer), */ | |
181 | 0x09, 0x02, /* Usage (Pen), */ | |
182 | 0xA1, 0x01, /* Collection (Application), */ | |
183 | 0x85, 0x10, /* Report ID (16), */ | |
184 | 0x09, 0x20, /* Usage (Stylus), */ | |
185 | 0xA0, /* Collection (Physical), */ | |
186 | 0x09, 0x42, /* Usage (Tip Switch), */ | |
187 | 0x09, 0x44, /* Usage (Barrel Switch), */ | |
188 | 0x09, 0x46, /* Usage (Tablet Pick), */ | |
189 | 0x15, 0x01, /* Logical Minimum (1), */ | |
190 | 0x25, 0x03, /* Logical Maximum (3), */ | |
191 | 0x75, 0x04, /* Report Size (4), */ | |
192 | 0x95, 0x01, /* Report Count (1), */ | |
193 | 0x80, /* Input, */ | |
194 | 0x09, 0x32, /* Usage (In Range), */ | |
195 | 0x14, /* Logical Minimum (0), */ | |
196 | 0x25, 0x01, /* Logical Maximum (1), */ | |
197 | 0x75, 0x01, /* Report Size (1), */ | |
198 | 0x95, 0x01, /* Report Count (1), */ | |
199 | 0x81, 0x02, /* Input (Variable), */ | |
200 | 0x95, 0x03, /* Report Count (3), */ | |
201 | 0x81, 0x03, /* Input (Constant, Variable), */ | |
202 | 0x75, 0x10, /* Report Size (16), */ | |
203 | 0x95, 0x01, /* Report Count (1), */ | |
204 | 0x14, /* Logical Minimum (0), */ | |
205 | 0xA4, /* Push, */ | |
206 | 0x05, 0x01, /* Usage Page (Desktop), */ | |
207 | 0x65, 0x13, /* Unit (Inch), */ | |
208 | 0x55, 0xFD, /* Unit Exponent (-3), */ | |
209 | 0x34, /* Physical Minimum (0), */ | |
210 | 0x09, 0x30, /* Usage (X), */ | |
211 | 0x46, 0x88, 0x13, /* Physical Maximum (5000), */ | |
212 | 0x26, 0x10, 0x27, /* Logical Maximum (10000), */ | |
213 | 0x81, 0x02, /* Input (Variable), */ | |
214 | 0x09, 0x31, /* Usage (Y), */ | |
215 | 0x46, 0xB8, 0x0B, /* Physical Maximum (3000), */ | |
216 | 0x26, 0x70, 0x17, /* Logical Maximum (6000), */ | |
217 | 0x81, 0x02, /* Input (Variable), */ | |
218 | 0xB4, /* Pop, */ | |
219 | 0x09, 0x30, /* Usage (Tip Pressure), */ | |
220 | 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */ | |
221 | 0x81, 0x02, /* Input (Variable), */ | |
222 | 0xC0, /* End Collection, */ | |
223 | 0xC0 /* End Collection */ | |
224 | }; | |
225 | ||
00e7f964 NK |
226 | /* |
227 | * Original Slim Tablet 12.1 inch report descriptor. | |
228 | * | |
229 | * The descriptor is similar to the Slim Tablet 5.8 inch descriptor with the | |
230 | * addition of a keyboard report, seemingly unused. It may have get here | |
231 | * from a Media Tablet - probably an unimplemented feature. | |
232 | * | |
233 | * Usage Page (Desktop), ; Generic desktop controls (01h) | |
234 | * Usage (Mouse), ; Mouse (02h, application collection) | |
235 | * Collection (Application), | |
236 | * Report ID (1), | |
237 | * Usage (Pointer), ; Pointer (01h, physical collection) | |
238 | * Collection (Physical), | |
239 | * Usage Page (Button), ; Button (09h) | |
240 | * Usage Minimum (01h), | |
241 | * Usage Maximum (05h), | |
242 | * Logical Minimum (0), | |
243 | * Logical Maximum (1), | |
244 | * Report Size (1), | |
245 | * Report Count (5), | |
246 | * Input (Variable), | |
247 | * Report Size (3), | |
248 | * Report Count (1), | |
249 | * Input (Constant, Variable), | |
250 | * Usage Page (Desktop), ; Generic desktop controls (01h) | |
251 | * Usage (X), ; X (30h, dynamic value) | |
252 | * Usage (Y), ; Y (31h, dynamic value) | |
253 | * Usage (Wheel), ; Wheel (38h, dynamic value) | |
254 | * Logical Minimum (-127), | |
255 | * Logical Maximum (127), | |
256 | * Report Size (8), | |
257 | * Report Count (3), | |
258 | * Input (Variable, Relative), | |
259 | * End Collection, | |
260 | * End Collection, | |
261 | * Usage Page (Digitizer), ; Digitizer (0Dh) | |
262 | * Usage (Pen), ; Pen (02h, application collection) | |
263 | * Collection (Application), | |
264 | * Report ID (2), | |
265 | * Usage (Stylus), ; Stylus (20h, logical collection) | |
266 | * Collection (Physical), | |
267 | * Usage (00h), | |
268 | * Logical Minimum (0), | |
269 | * Logical Maximum (255), | |
270 | * Report Size (8), | |
271 | * Report Count (7), | |
272 | * Input (Variable), | |
273 | * Usage (Azimuth), ; Azimuth (3Fh, dynamic value) | |
274 | * Usage (Altitude), ; Altitude (40h, dynamic value) | |
275 | * Logical Minimum (0), | |
276 | * Logical Maximum (255), | |
277 | * Report Size (8), | |
278 | * Report Count (2), | |
279 | * Feature (Variable), | |
280 | * End Collection, | |
281 | * Report ID (5), | |
282 | * Usage Page (Digitizer), ; Digitizer (0Dh) | |
283 | * Usage (Stylus), ; Stylus (20h, logical collection) | |
284 | * Collection (Physical), | |
285 | * Usage (00h), | |
286 | * Logical Minimum (0), | |
287 | * Logical Maximum (255), | |
288 | * Report Size (8), | |
289 | * Report Count (7), | |
290 | * Input (Variable), | |
291 | * End Collection, | |
292 | * Report ID (10), | |
293 | * Usage Page (Digitizer), ; Digitizer (0Dh) | |
294 | * Usage (Stylus), ; Stylus (20h, logical collection) | |
295 | * Collection (Physical), | |
296 | * Usage (00h), | |
297 | * Logical Minimum (0), | |
298 | * Logical Maximum (255), | |
299 | * Report Size (8), | |
300 | * Report Count (3), | |
301 | * Input (Variable), | |
302 | * End Collection, | |
303 | * Report ID (16), | |
304 | * Usage (Stylus), ; Stylus (20h, logical collection) | |
305 | * Collection (Physical), | |
306 | * Usage (Tip Switch), ; Tip switch (42h, momentary control) | |
307 | * Usage (Barrel Switch), ; Barrel switch (44h, momentary control) | |
308 | * Usage (Invert), ; Invert (3Ch, momentary control) | |
309 | * Usage (Eraser), ; Eraser (45h, momentary control) | |
310 | * Usage (In Range), ; In range (32h, momentary control) | |
311 | * Logical Minimum (0), | |
312 | * Logical Maximum (1), | |
313 | * Report Size (1), | |
314 | * Report Count (5), | |
315 | * Input (Variable), | |
316 | * Report Count (3), | |
317 | * Input (Constant, Variable), | |
318 | * Usage Page (Desktop), ; Generic desktop controls (01h) | |
319 | * Usage (X), ; X (30h, dynamic value) | |
320 | * Report Size (16), | |
321 | * Report Count (1), | |
322 | * Push, | |
323 | * Unit Exponent (13), | |
324 | * Unit (Inch^3), | |
325 | * Logical Minimum (0), | |
326 | * Logical Maximum (20000), | |
327 | * Physical Minimum (0), | |
328 | * Physical Maximum (20000), | |
329 | * Input (Variable), | |
330 | * Usage (Y), ; Y (31h, dynamic value) | |
331 | * Logical Maximum (12500), | |
332 | * Physical Maximum (12500), | |
333 | * Input (Variable), | |
334 | * Usage Page (Digitizer), ; Digitizer (0Dh) | |
335 | * Usage (Tip Pressure), ; Tip pressure (30h, dynamic value) | |
336 | * Logical Minimum (0), | |
337 | * Logical Maximum (1023), | |
338 | * Physical Minimum (0), | |
339 | * Physical Maximum (1023), | |
340 | * Input (Variable), | |
341 | * End Collection, | |
342 | * End Collection, | |
343 | * Usage Page (Desktop), ; Generic desktop controls (01h) | |
344 | * Usage (Keyboard), ; Keyboard (06h, application collection) | |
345 | * Collection (Application), | |
346 | * Report ID (13), | |
347 | * Usage Page (Keyboard), ; Keyboard/keypad (07h) | |
348 | * Usage Minimum (KB Leftcontrol), ; Keyboard left control | |
349 | * ; (E0h, dynamic value) | |
350 | * Usage Maximum (KB Right GUI), ; Keyboard right GUI (E7h, dynamic value) | |
351 | * Logical Minimum (0), | |
352 | * Logical Maximum (1), | |
353 | * Report Size (1), | |
354 | * Report Count (8), | |
355 | * Input (Variable), | |
356 | * Report Size (8), | |
357 | * Report Count (1), | |
358 | * Input (Constant), | |
359 | * Usage Page (Keyboard), ; Keyboard/keypad (07h) | |
360 | * Usage Minimum (None), ; No event (00h, selector) | |
361 | * Usage Maximum (KB Application), ; Keyboard Application (65h, selector) | |
362 | * Logical Minimum (0), | |
363 | * Logical Maximum (101), | |
364 | * Report Size (8), | |
365 | * Report Count (5), | |
366 | * Input, | |
367 | * End Collection | |
368 | */ | |
369 | ||
370 | /* Size of the original report descriptor of Slim Tablet 12.1 inch */ | |
371 | #define SLIM_TABLET_12_1_INCH_RDESC_ORIG_SIZE 269 | |
372 | ||
373 | /* | |
374 | * Fixed Slim Tablet 12.1 inch descriptor. | |
375 | * | |
376 | * All the reports except the stylus report (ID 16) were removed as unused. | |
377 | * The stylus buttons description was fixed. | |
378 | */ | |
379 | static __u8 slim_tablet_12_1_inch_rdesc_fixed[] = { | |
380 | 0x05, 0x0D, /* Usage Page (Digitizer), */ | |
381 | 0x09, 0x02, /* Usage (Pen), */ | |
382 | 0xA1, 0x01, /* Collection (Application), */ | |
383 | 0x85, 0x10, /* Report ID (16), */ | |
384 | 0x09, 0x20, /* Usage (Stylus), */ | |
385 | 0xA0, /* Collection (Physical), */ | |
386 | 0x09, 0x42, /* Usage (Tip Switch), */ | |
387 | 0x09, 0x44, /* Usage (Barrel Switch), */ | |
388 | 0x09, 0x46, /* Usage (Tablet Pick), */ | |
389 | 0x15, 0x01, /* Logical Minimum (1), */ | |
390 | 0x25, 0x03, /* Logical Maximum (3), */ | |
391 | 0x75, 0x04, /* Report Size (4), */ | |
392 | 0x95, 0x01, /* Report Count (1), */ | |
393 | 0x80, /* Input, */ | |
394 | 0x09, 0x32, /* Usage (In Range), */ | |
395 | 0x14, /* Logical Minimum (0), */ | |
396 | 0x25, 0x01, /* Logical Maximum (1), */ | |
397 | 0x75, 0x01, /* Report Size (1), */ | |
398 | 0x95, 0x01, /* Report Count (1), */ | |
399 | 0x81, 0x02, /* Input (Variable), */ | |
400 | 0x95, 0x03, /* Report Count (3), */ | |
401 | 0x81, 0x03, /* Input (Constant, Variable), */ | |
402 | 0x75, 0x10, /* Report Size (16), */ | |
403 | 0x95, 0x01, /* Report Count (1), */ | |
404 | 0x14, /* Logical Minimum (0), */ | |
405 | 0xA4, /* Push, */ | |
406 | 0x05, 0x01, /* Usage Page (Desktop), */ | |
407 | 0x65, 0x13, /* Unit (Inch), */ | |
408 | 0x55, 0xFD, /* Unit Exponent (-3), */ | |
409 | 0x34, /* Physical Minimum (0), */ | |
410 | 0x09, 0x30, /* Usage (X), */ | |
411 | 0x46, 0x10, 0x27, /* Physical Maximum (10000), */ | |
412 | 0x26, 0x20, 0x4E, /* Logical Maximum (20000), */ | |
413 | 0x81, 0x02, /* Input (Variable), */ | |
414 | 0x09, 0x31, /* Usage (Y), */ | |
415 | 0x46, 0x6A, 0x18, /* Physical Maximum (6250), */ | |
416 | 0x26, 0xD4, 0x30, /* Logical Maximum (12500), */ | |
417 | 0x81, 0x02, /* Input (Variable), */ | |
418 | 0xB4, /* Pop, */ | |
419 | 0x09, 0x30, /* Usage (Tip Pressure), */ | |
420 | 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */ | |
421 | 0x81, 0x02, /* Input (Variable), */ | |
422 | 0xC0, /* End Collection, */ | |
423 | 0xC0 /* End Collection */ | |
424 | }; | |
425 | ||
4fdc18d1 NK |
426 | /* |
427 | * Original Q Pad report descriptor. | |
428 | * | |
429 | * The descriptor is similar to the Slim Tablet 5.8 inch descriptor with the | |
430 | * addition of consumer AC Pan field to the report ID 1, which seems to be | |
431 | * unused in the default mode. However, this tablet has resolution of 2048 LPI. | |
432 | * | |
433 | * Usage Page (Desktop), ; Generic desktop controls (01h) | |
434 | * Usage (Mouse), ; Mouse (02h, application collection) | |
435 | * Collection (Application), | |
436 | * Report ID (1), | |
437 | * Usage (Pointer), ; Pointer (01h, physical collection) | |
438 | * Collection (Physical), | |
439 | * Usage Page (Button), ; Button (09h) | |
440 | * Usage Minimum (01h), | |
441 | * Usage Maximum (05h), | |
442 | * Logical Minimum (0), | |
443 | * Logical Maximum (1), | |
444 | * Report Size (1), | |
445 | * Report Count (5), | |
446 | * Input (Variable), | |
447 | * Report Size (3), | |
448 | * Report Count (1), | |
449 | * Input (Constant, Variable), | |
450 | * Usage Page (Desktop), ; Generic desktop controls (01h) | |
451 | * Usage (X), ; X (30h, dynamic value) | |
452 | * Usage (Y), ; Y (31h, dynamic value) | |
453 | * Usage (Wheel), ; Wheel (38h, dynamic value) | |
454 | * Logical Minimum (-127), | |
455 | * Logical Maximum (127), | |
456 | * Report Size (8), | |
457 | * Report Count (3), | |
458 | * Input (Variable, Relative), | |
459 | * Usage Page (Consumer), ; Consumer (0Ch) | |
460 | * Logical Minimum (-127), | |
461 | * Logical Maximum (127), | |
462 | * Report Size (8), | |
463 | * Report Count (1), | |
464 | * Usage (AC Pan), ; AC pan (0238h, linear control) | |
465 | * Input (Variable, Relative), | |
466 | * End Collection, | |
467 | * End Collection, | |
468 | * Usage Page (Digitizer), ; Digitizer (0Dh) | |
469 | * Usage (Pen), ; Pen (02h, application collection) | |
470 | * Collection (Application), | |
471 | * Report ID (2), | |
472 | * Usage (Stylus), ; Stylus (20h, logical collection) | |
473 | * Collection (Physical), | |
474 | * Usage (00h), | |
475 | * Logical Minimum (0), | |
476 | * Logical Maximum (255), | |
477 | * Report Size (8), | |
478 | * Report Count (7), | |
479 | * Input (Variable), | |
480 | * Usage (Azimuth), ; Azimuth (3Fh, dynamic value) | |
481 | * Usage (Altitude), ; Altitude (40h, dynamic value) | |
482 | * Logical Minimum (0), | |
483 | * Logical Maximum (255), | |
484 | * Report Size (8), | |
485 | * Report Count (2), | |
486 | * Feature (Variable), | |
487 | * End Collection, | |
488 | * Report ID (5), | |
489 | * Usage Page (Digitizer), ; Digitizer (0Dh) | |
490 | * Usage (Stylus), ; Stylus (20h, logical collection) | |
491 | * Collection (Physical), | |
492 | * Usage (00h), | |
493 | * Logical Minimum (0), | |
494 | * Logical Maximum (255), | |
495 | * Report Size (8), | |
496 | * Report Count (7), | |
497 | * Input (Variable), | |
498 | * End Collection, | |
499 | * Report ID (10), | |
500 | * Usage Page (Digitizer), ; Digitizer (0Dh) | |
501 | * Usage (Stylus), ; Stylus (20h, logical collection) | |
502 | * Collection (Physical), | |
503 | * Usage (00h), | |
504 | * Logical Minimum (0), | |
505 | * Logical Maximum (255), | |
506 | * Report Size (8), | |
507 | * Report Count (7), | |
508 | * Input (Variable), | |
509 | * End Collection, | |
510 | * Report ID (16), | |
511 | * Usage (Stylus), ; Stylus (20h, logical collection) | |
512 | * Collection (Physical), | |
513 | * Usage (Tip Switch), ; Tip switch (42h, momentary control) | |
514 | * Usage (Barrel Switch), ; Barrel switch (44h, momentary control) | |
515 | * Usage (Invert), ; Invert (3Ch, momentary control) | |
516 | * Usage (Eraser), ; Eraser (45h, momentary control) | |
517 | * Usage (In Range), ; In range (32h, momentary control) | |
518 | * Logical Minimum (0), | |
519 | * Logical Maximum (1), | |
520 | * Report Size (1), | |
521 | * Report Count (5), | |
522 | * Input (Variable), | |
523 | * Report Count (3), | |
524 | * Input (Constant, Variable), | |
525 | * Usage Page (Desktop), ; Generic desktop controls (01h) | |
526 | * Usage (X), ; X (30h, dynamic value) | |
527 | * Report Size (16), | |
528 | * Report Count (1), | |
529 | * Push, | |
530 | * Unit Exponent (13), | |
531 | * Unit (Inch^3), | |
532 | * Logical Minimum (0), | |
533 | * Logical Maximum (12288), | |
534 | * Physical Minimum (0), | |
535 | * Physical Maximum (12288), | |
536 | * Input (Variable), | |
537 | * Usage (Y), ; Y (31h, dynamic value) | |
538 | * Logical Minimum (0), | |
539 | * Logical Maximum (9216), | |
540 | * Physical Minimum (0), | |
541 | * Physical Maximum (9216), | |
542 | * Input (Variable), | |
543 | * Usage Page (Digitizer), ; Digitizer (0Dh) | |
544 | * Usage (Tip Pressure), ; Tip pressure (30h, dynamic value) | |
545 | * Logical Minimum (0), | |
546 | * Logical Maximum (1023), | |
547 | * Physical Minimum (0), | |
548 | * Physical Maximum (1023), | |
549 | * Input (Variable), | |
550 | * End Collection, | |
551 | * End Collection | |
552 | */ | |
553 | ||
554 | /* Size of the original report descriptor of Q Pad */ | |
555 | #define Q_PAD_RDESC_ORIG_SIZE 241 | |
556 | ||
557 | /* | |
558 | * Fixed Q Pad descriptor. | |
559 | * | |
560 | * All the reports except the stylus report (ID 16) were removed as unused. | |
561 | * The stylus buttons description was fixed. | |
562 | */ | |
563 | static __u8 q_pad_rdesc_fixed[] = { | |
564 | 0x05, 0x0D, /* Usage Page (Digitizer), */ | |
565 | 0x09, 0x02, /* Usage (Pen), */ | |
566 | 0xA1, 0x01, /* Collection (Application), */ | |
567 | 0x85, 0x10, /* Report ID (16), */ | |
568 | 0x09, 0x20, /* Usage (Stylus), */ | |
569 | 0xA0, /* Collection (Physical), */ | |
570 | 0x09, 0x42, /* Usage (Tip Switch), */ | |
571 | 0x09, 0x44, /* Usage (Barrel Switch), */ | |
572 | 0x09, 0x46, /* Usage (Tablet Pick), */ | |
573 | 0x15, 0x01, /* Logical Minimum (1), */ | |
574 | 0x25, 0x03, /* Logical Maximum (3), */ | |
575 | 0x75, 0x04, /* Report Size (4), */ | |
576 | 0x95, 0x01, /* Report Count (1), */ | |
577 | 0x80, /* Input, */ | |
578 | 0x09, 0x32, /* Usage (In Range), */ | |
579 | 0x14, /* Logical Minimum (0), */ | |
580 | 0x25, 0x01, /* Logical Maximum (1), */ | |
581 | 0x75, 0x01, /* Report Size (1), */ | |
582 | 0x95, 0x01, /* Report Count (1), */ | |
583 | 0x81, 0x02, /* Input (Variable), */ | |
584 | 0x95, 0x03, /* Report Count (3), */ | |
585 | 0x81, 0x03, /* Input (Constant, Variable), */ | |
586 | 0x75, 0x10, /* Report Size (16), */ | |
587 | 0x95, 0x01, /* Report Count (1), */ | |
588 | 0x14, /* Logical Minimum (0), */ | |
589 | 0xA4, /* Push, */ | |
590 | 0x05, 0x01, /* Usage Page (Desktop), */ | |
591 | 0x65, 0x13, /* Unit (Inch), */ | |
592 | 0x55, 0xFD, /* Unit Exponent (-3), */ | |
593 | 0x34, /* Physical Minimum (0), */ | |
594 | 0x09, 0x30, /* Usage (X), */ | |
595 | 0x46, 0x70, 0x17, /* Physical Maximum (6000), */ | |
596 | 0x26, 0x00, 0x30, /* Logical Maximum (12288), */ | |
597 | 0x81, 0x02, /* Input (Variable), */ | |
598 | 0x09, 0x31, /* Usage (Y), */ | |
599 | 0x46, 0x94, 0x11, /* Physical Maximum (4500), */ | |
600 | 0x26, 0x00, 0x24, /* Logical Maximum (9216), */ | |
601 | 0x81, 0x02, /* Input (Variable), */ | |
602 | 0xB4, /* Pop, */ | |
603 | 0x09, 0x30, /* Usage (Tip Pressure), */ | |
604 | 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */ | |
605 | 0x81, 0x02, /* Input (Variable), */ | |
606 | 0xC0, /* End Collection, */ | |
607 | 0xC0 /* End Collection */ | |
608 | }; | |
609 | ||
72a46344 NK |
610 | /* |
611 | * Original Media Tablet 10.6 inch report descriptor. | |
612 | * | |
613 | * There are at least two versions of this model in the wild. They are | |
614 | * represented by Genius G-Pen M609 (older version) and Genius G-Pen M609X | |
615 | * (newer version). | |
616 | * | |
617 | * Both versions have the usual pen with two barrel buttons and two | |
618 | * identical wheels with center buttons in the top corners of the tablet | |
619 | * base. They also have buttons on the top, between the wheels, for | |
620 | * selecting the wheels' functions and wide/standard mode. In the wide mode | |
621 | * the whole working surface is sensed, in the standard mode a narrower area | |
622 | * is sensed, but the logical report extents remain the same. These modes | |
623 | * correspond roughly to 16:9 and 4:3 aspect ratios respectively. | |
624 | * | |
625 | * The older version has three wheel function buttons ("scroll", "zoom" and | |
626 | * "volume") and two separate buttons for wide and standard mode. The newer | |
627 | * version has four wheel function buttons (plus "brush") and only one | |
628 | * button is used for selecting wide/standard mode. So, the total number of | |
629 | * buttons remains the same, but one of the mode buttons is repurposed as a | |
630 | * wheels' function button in the newer version. | |
631 | * | |
632 | * The wheel functions are: | |
4b5b4575 NK |
633 | * scroll - the wheels act as scroll wheels, the center buttons switch |
634 | * between vertical and horizontal scrolling; | |
635 | * zoom - the wheels zoom in/out, the buttons supposedly reset to 100%; | |
636 | * volume - the wheels control the sound volume, the buttons mute; | |
72a46344 NK |
637 | * brush - the wheels are supposed to control brush width in a graphics |
638 | * editor, the buttons do nothing. | |
639 | * | |
640 | * Below is the newer version's report descriptor. It may very well be that | |
641 | * the older version's descriptor is different and thus it won't be | |
642 | * supported. | |
643 | * | |
644 | * The mouse report (ID 1) only uses the wheel field for reporting the tablet | |
645 | * wheels' scroll mode. The keyboard report (ID 13) is used to report the | |
646 | * wheels' zoom and brush control functions as key presses. The report ID 12 | |
647 | * is used to report the wheels' volume control functions. The stylus report | |
648 | * (ID 16) has the same problems as the Slim Tablet 5.8 inch report has. | |
649 | * | |
650 | * The rest of the reports are unused, at least in the default configuration. | |
651 | * The purpose of the features is unknown. | |
652 | * | |
653 | * Usage Page (Desktop), | |
654 | * Usage (Mouse), | |
655 | * Collection (Application), | |
656 | * Report ID (1), | |
657 | * Usage (Pointer), | |
658 | * Collection (Physical), | |
659 | * Usage Page (Button), | |
660 | * Usage Minimum (01h), | |
661 | * Usage Maximum (05h), | |
662 | * Logical Minimum (0), | |
663 | * Logical Maximum (1), | |
664 | * Report Size (1), | |
665 | * Report Count (5), | |
666 | * Input (Variable), | |
667 | * Report Size (3), | |
668 | * Report Count (1), | |
669 | * Input (Constant, Variable), | |
670 | * Usage Page (Desktop), | |
671 | * Usage (X), | |
672 | * Usage (Y), | |
673 | * Usage (Wheel), | |
674 | * Logical Minimum (-127), | |
675 | * Logical Maximum (127), | |
676 | * Report Size (8), | |
677 | * Report Count (3), | |
678 | * Input (Variable, Relative), | |
679 | * End Collection, | |
680 | * End Collection, | |
681 | * Usage Page (Digitizer), | |
682 | * Usage (Pen), | |
683 | * Collection (Application), | |
684 | * Report ID (2), | |
685 | * Usage (Stylus), | |
686 | * Collection (Physical), | |
687 | * Usage (00h), | |
688 | * Logical Minimum (0), | |
689 | * Logical Maximum (255), | |
690 | * Report Size (8), | |
691 | * Report Count (7), | |
692 | * Input (Variable), | |
693 | * Usage (Azimuth), | |
694 | * Usage (Altitude), | |
695 | * Logical Minimum (0), | |
696 | * Logical Maximum (255), | |
697 | * Report Size (8), | |
698 | * Report Count (2), | |
699 | * Feature (Variable), | |
700 | * End Collection, | |
701 | * Report ID (5), | |
702 | * Usage Page (Digitizer), | |
703 | * Usage (Stylus), | |
704 | * Collection (Physical), | |
705 | * Usage (00h), | |
706 | * Logical Minimum (0), | |
707 | * Logical Maximum (255), | |
708 | * Report Size (8), | |
709 | * Report Count (7), | |
710 | * Input (Variable), | |
711 | * End Collection, | |
712 | * Report ID (10), | |
713 | * Usage Page (Digitizer), | |
714 | * Usage (Stylus), | |
715 | * Collection (Physical), | |
716 | * Usage (00h), | |
717 | * Logical Minimum (0), | |
718 | * Logical Maximum (255), | |
719 | * Report Size (8), | |
720 | * Report Count (7), | |
721 | * Input (Variable), | |
722 | * End Collection, | |
723 | * Report ID (16), | |
724 | * Usage (Stylus), | |
725 | * Collection (Physical), | |
726 | * Usage (Tip Switch), | |
727 | * Usage (Barrel Switch), | |
728 | * Usage (Invert), | |
729 | * Usage (Eraser), | |
730 | * Usage (In Range), | |
731 | * Logical Minimum (0), | |
732 | * Logical Maximum (1), | |
733 | * Report Size (1), | |
734 | * Report Count (5), | |
735 | * Input (Variable), | |
736 | * Report Count (3), | |
737 | * Input (Constant, Variable), | |
738 | * Usage Page (Desktop), | |
739 | * Usage (X), | |
740 | * Report Size (16), | |
741 | * Report Count (1), | |
742 | * Push, | |
743 | * Unit Exponent (13), | |
744 | * Unit (Inch^3), | |
745 | * Logical Minimum (0), | |
746 | * Logical Maximum (18000), | |
747 | * Physical Minimum (0), | |
748 | * Physical Maximum (18000), | |
749 | * Input (Variable), | |
750 | * Usage (Y), | |
751 | * Logical Maximum (11000), | |
752 | * Physical Maximum (11000), | |
753 | * Input (Variable), | |
754 | * Usage Page (Digitizer), | |
755 | * Usage (Tip Pressure), | |
756 | * Logical Minimum (0), | |
757 | * Logical Maximum (1023), | |
758 | * Physical Minimum (0), | |
759 | * Physical Maximum (1023), | |
760 | * Input (Variable), | |
761 | * End Collection, | |
762 | * End Collection, | |
763 | * Usage Page (Desktop), | |
764 | * Usage (Keyboard), | |
765 | * Collection (Application), | |
766 | * Report ID (13), | |
767 | * Usage Page (Keyboard), | |
768 | * Usage Minimum (KB Leftcontrol), | |
769 | * Usage Maximum (KB Right GUI), | |
770 | * Logical Minimum (0), | |
771 | * Logical Maximum (1), | |
772 | * Report Size (1), | |
773 | * Report Count (8), | |
774 | * Input (Variable), | |
775 | * Report Size (8), | |
776 | * Report Count (1), | |
777 | * Input (Constant), | |
778 | * Usage Page (Keyboard), | |
779 | * Usage Minimum (None), | |
780 | * Usage Maximum (KB Application), | |
781 | * Logical Minimum (0), | |
782 | * Logical Maximum (101), | |
783 | * Report Size (8), | |
784 | * Report Count (5), | |
785 | * Input, | |
786 | * End Collection, | |
787 | * Usage Page (Consumer), | |
788 | * Usage (Consumer Control), | |
789 | * Collection (Application), | |
790 | * Report ID (12), | |
791 | * Usage (Volume Inc), | |
792 | * Usage (Volume Dec), | |
793 | * Usage (Mute), | |
794 | * Logical Minimum (0), | |
795 | * Logical Maximum (1), | |
796 | * Report Size (1), | |
797 | * Report Count (3), | |
798 | * Input (Variable, Relative), | |
799 | * Report Size (5), | |
800 | * Report Count (1), | |
801 | * Input (Constant, Variable, Relative), | |
802 | * End Collection | |
803 | */ | |
804 | ||
805 | /* Size of the original report descriptor of Media Tablet 10.6 inch */ | |
806 | #define MEDIA_TABLET_10_6_INCH_RDESC_ORIG_SIZE 300 | |
807 | ||
808 | /* | |
809 | * Fixed Media Tablet 10.6 inch descriptor. | |
810 | * | |
811 | * The descriptions of reports unused in the default configuration are | |
812 | * removed. The stylus report (ID 16) is fixed similarly to Slim Tablet 5.8 | |
813 | * inch. The unused mouse report (ID 1) fields are replaced with constant | |
814 | * padding. | |
815 | * | |
816 | * The keyboard report (ID 13) is hacked to instead have an "array" field | |
817 | * reporting consumer page controls, and all the unused bits are masked out | |
818 | * with constant padding. The "brush" wheels' function is represented as "Scan | |
819 | * Previous/Next Track" controls due to the lack of brush controls in the | |
820 | * usage tables specification. | |
821 | */ | |
822 | static __u8 media_tablet_10_6_inch_rdesc_fixed[] = { | |
823 | 0x05, 0x0D, /* Usage Page (Digitizer), */ | |
824 | 0x09, 0x02, /* Usage (Pen), */ | |
825 | 0xA1, 0x01, /* Collection (Application), */ | |
826 | 0x85, 0x10, /* Report ID (16), */ | |
827 | 0x09, 0x20, /* Usage (Stylus), */ | |
828 | 0xA0, /* Collection (Physical), */ | |
829 | 0x09, 0x42, /* Usage (Tip Switch), */ | |
830 | 0x09, 0x44, /* Usage (Barrel Switch), */ | |
831 | 0x09, 0x46, /* Usage (Tablet Pick), */ | |
832 | 0x15, 0x01, /* Logical Minimum (1), */ | |
833 | 0x25, 0x03, /* Logical Maximum (3), */ | |
834 | 0x75, 0x04, /* Report Size (4), */ | |
835 | 0x95, 0x01, /* Report Count (1), */ | |
836 | 0x80, /* Input, */ | |
837 | 0x75, 0x01, /* Report Size (1), */ | |
838 | 0x09, 0x32, /* Usage (In Range), */ | |
839 | 0x14, /* Logical Minimum (0), */ | |
840 | 0x25, 0x01, /* Logical Maximum (1), */ | |
841 | 0x95, 0x01, /* Report Count (1), */ | |
842 | 0x81, 0x02, /* Input (Variable), */ | |
843 | 0x95, 0x03, /* Report Count (3), */ | |
844 | 0x81, 0x03, /* Input (Constant, Variable), */ | |
845 | 0x75, 0x10, /* Report Size (16), */ | |
846 | 0x95, 0x01, /* Report Count (1), */ | |
847 | 0x14, /* Logical Minimum (0), */ | |
848 | 0xA4, /* Push, */ | |
849 | 0x05, 0x01, /* Usage Page (Desktop), */ | |
850 | 0x65, 0x13, /* Unit (Inch), */ | |
851 | 0x55, 0xFD, /* Unit Exponent (-3), */ | |
852 | 0x34, /* Physical Minimum (0), */ | |
853 | 0x09, 0x30, /* Usage (X), */ | |
854 | 0x46, 0x28, 0x23, /* Physical Maximum (9000), */ | |
855 | 0x26, 0x50, 0x46, /* Logical Maximum (18000), */ | |
856 | 0x81, 0x02, /* Input (Variable), */ | |
857 | 0x09, 0x31, /* Usage (Y), */ | |
858 | 0x46, 0x7C, 0x15, /* Physical Maximum (5500), */ | |
859 | 0x26, 0xF8, 0x2A, /* Logical Maximum (11000), */ | |
860 | 0x81, 0x02, /* Input (Variable), */ | |
861 | 0xB4, /* Pop, */ | |
862 | 0x09, 0x30, /* Usage (Tip Pressure), */ | |
863 | 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */ | |
864 | 0x81, 0x02, /* Input (Variable), */ | |
865 | 0xC0, /* End Collection, */ | |
866 | 0xC0, /* End Collection, */ | |
867 | 0x05, 0x01, /* Usage Page (Desktop), */ | |
868 | 0x09, 0x02, /* Usage (Mouse), */ | |
869 | 0xA1, 0x01, /* Collection (Application), */ | |
870 | 0x85, 0x01, /* Report ID (1), */ | |
871 | 0x09, 0x01, /* Usage (Pointer), */ | |
872 | 0xA0, /* Collection (Physical), */ | |
4b5b4575 NK |
873 | 0x75, 0x08, /* Report Size (8), */ |
874 | 0x95, 0x03, /* Report Count (3), */ | |
72a46344 | 875 | 0x81, 0x03, /* Input (Constant, Variable), */ |
4b5b4575 | 876 | 0x95, 0x02, /* Report Count (2), */ |
72a46344 NK |
877 | 0x15, 0xFF, /* Logical Minimum (-1), */ |
878 | 0x25, 0x01, /* Logical Maximum (1), */ | |
4b5b4575 NK |
879 | 0x09, 0x38, /* Usage (Wheel), */ |
880 | 0x0B, 0x38, 0x02, /* Usage (Consumer AC Pan), */ | |
881 | 0x0C, 0x00, | |
72a46344 | 882 | 0x81, 0x06, /* Input (Variable, Relative), */ |
4b5b4575 | 883 | 0x95, 0x02, /* Report Count (2), */ |
72a46344 NK |
884 | 0x81, 0x03, /* Input (Constant, Variable), */ |
885 | 0xC0, /* End Collection, */ | |
886 | 0xC0, /* End Collection, */ | |
887 | 0x05, 0x0C, /* Usage Page (Consumer), */ | |
888 | 0x09, 0x01, /* Usage (Consumer Control), */ | |
889 | 0xA1, 0x01, /* Collection (Application), */ | |
890 | 0x85, 0x0D, /* Report ID (13), */ | |
891 | 0x95, 0x01, /* Report Count (1), */ | |
892 | 0x75, 0x10, /* Report Size (16), */ | |
893 | 0x81, 0x03, /* Input (Constant, Variable), */ | |
894 | 0x0A, 0x2F, 0x02, /* Usage (AC Zoom), */ | |
895 | 0x0A, 0x2E, 0x02, /* Usage (AC Zoom Out), */ | |
896 | 0x0A, 0x2D, 0x02, /* Usage (AC Zoom In), */ | |
897 | 0x09, 0xB6, /* Usage (Scan Previous Track), */ | |
898 | 0x09, 0xB5, /* Usage (Scan Next Track), */ | |
30311549 NK |
899 | 0x08, /* Usage (00h), */ |
900 | 0x08, /* Usage (00h), */ | |
901 | 0x08, /* Usage (00h), */ | |
902 | 0x08, /* Usage (00h), */ | |
903 | 0x08, /* Usage (00h), */ | |
904 | 0x0A, 0x2E, 0x02, /* Usage (AC Zoom Out), */ | |
905 | 0x0A, 0x2D, 0x02, /* Usage (AC Zoom In), */ | |
906 | 0x15, 0x0C, /* Logical Minimum (12), */ | |
907 | 0x25, 0x17, /* Logical Maximum (23), */ | |
908 | 0x75, 0x05, /* Report Size (5), */ | |
72a46344 | 909 | 0x80, /* Input, */ |
30311549 NK |
910 | 0x75, 0x03, /* Report Size (3), */ |
911 | 0x81, 0x03, /* Input (Constant, Variable), */ | |
72a46344 NK |
912 | 0x75, 0x20, /* Report Size (32), */ |
913 | 0x81, 0x03, /* Input (Constant, Variable), */ | |
914 | 0xC0, /* End Collection, */ | |
915 | 0x09, 0x01, /* Usage (Consumer Control), */ | |
916 | 0xA1, 0x01, /* Collection (Application), */ | |
917 | 0x85, 0x0C, /* Report ID (12), */ | |
918 | 0x75, 0x01, /* Report Size (1), */ | |
919 | 0x09, 0xE9, /* Usage (Volume Inc), */ | |
920 | 0x09, 0xEA, /* Usage (Volume Dec), */ | |
921 | 0x09, 0xE2, /* Usage (Mute), */ | |
922 | 0x14, /* Logical Minimum (0), */ | |
923 | 0x25, 0x01, /* Logical Maximum (1), */ | |
924 | 0x95, 0x03, /* Report Count (3), */ | |
925 | 0x81, 0x06, /* Input (Variable, Relative), */ | |
926 | 0x95, 0x35, /* Report Count (53), */ | |
927 | 0x81, 0x03, /* Input (Constant, Variable), */ | |
928 | 0xC0 /* End Collection */ | |
929 | }; | |
930 | ||
8f1acc32 NK |
931 | /* |
932 | * Original Media Tablet 14.1 inch report descriptor. | |
933 | * | |
934 | * There are at least two versions of this model in the wild. They are | |
935 | * represented by Genius G-Pen M712 (older version) and Genius G-Pen M712X | |
936 | * (newer version). The hardware difference between these versions is the same | |
937 | * as between older and newer versions of Media Tablet 10.6 inch. The report | |
938 | * descriptors are identical for both versions. | |
939 | * | |
940 | * The function, behavior and report descriptor of this tablet is similar to | |
941 | * that of Media Tablet 10.6 inch. However, there is one more field (with | |
942 | * Consumer AC Pan usage) in the mouse description. Then the tablet X and Y | |
943 | * logical extents both get scaled to 0..16383 range (a hardware limit?), | |
944 | * which kind of defeats the advertised 4000 LPI resolution, considering the | |
945 | * physical extents of 12x7.25 inches. Plus, reports 5, 10 and 255 are used | |
946 | * sometimes (while moving the pen) with unknown purpose. Also, the key codes | |
947 | * generated for zoom in/out are different. | |
948 | * | |
949 | * Usage Page (Desktop), | |
950 | * Usage (Mouse), | |
951 | * Collection (Application), | |
952 | * Report ID (1), | |
953 | * Usage (Pointer), | |
954 | * Collection (Physical), | |
955 | * Usage Page (Button), | |
956 | * Usage Minimum (01h), | |
957 | * Usage Maximum (05h), | |
958 | * Logical Minimum (0), | |
959 | * Logical Maximum (1), | |
960 | * Report Size (1), | |
961 | * Report Count (5), | |
962 | * Input (Variable), | |
963 | * Report Size (3), | |
964 | * Report Count (1), | |
965 | * Input (Constant, Variable), | |
966 | * Usage Page (Desktop), | |
967 | * Usage (X), | |
968 | * Usage (Y), | |
969 | * Usage (Wheel), | |
970 | * Logical Minimum (-127), | |
971 | * Logical Maximum (127), | |
972 | * Report Size (8), | |
973 | * Report Count (3), | |
974 | * Input (Variable, Relative), | |
975 | * Usage Page (Consumer), | |
976 | * Logical Minimum (-127), | |
977 | * Logical Maximum (127), | |
978 | * Report Size (8), | |
979 | * Report Count (1), | |
980 | * Usage (AC Pan), | |
981 | * Input (Variable, Relative), | |
982 | * End Collection, | |
983 | * End Collection, | |
984 | * Usage Page (Digitizer), | |
985 | * Usage (Pen), | |
986 | * Collection (Application), | |
987 | * Report ID (2), | |
988 | * Usage (Stylus), | |
989 | * Collection (Physical), | |
990 | * Usage (00h), | |
991 | * Logical Minimum (0), | |
992 | * Logical Maximum (255), | |
993 | * Report Size (8), | |
994 | * Report Count (7), | |
995 | * Input (Variable), | |
996 | * Usage (Azimuth), | |
997 | * Usage (Altitude), | |
998 | * Logical Minimum (0), | |
999 | * Logical Maximum (255), | |
1000 | * Report Size (8), | |
1001 | * Report Count (2), | |
1002 | * Feature (Variable), | |
1003 | * End Collection, | |
1004 | * Report ID (5), | |
1005 | * Usage Page (Digitizer), | |
1006 | * Usage (Stylus), | |
1007 | * Collection (Physical), | |
1008 | * Usage (00h), | |
1009 | * Logical Minimum (0), | |
1010 | * Logical Maximum (255), | |
1011 | * Report Size (8), | |
1012 | * Report Count (7), | |
1013 | * Input (Variable), | |
1014 | * End Collection, | |
1015 | * Report ID (10), | |
1016 | * Usage Page (Digitizer), | |
1017 | * Usage (Stylus), | |
1018 | * Collection (Physical), | |
1019 | * Usage (00h), | |
1020 | * Logical Minimum (0), | |
1021 | * Logical Maximum (255), | |
1022 | * Report Size (8), | |
1023 | * Report Count (7), | |
1024 | * Input (Variable), | |
1025 | * End Collection, | |
1026 | * Report ID (16), | |
1027 | * Usage (Stylus), | |
1028 | * Collection (Physical), | |
1029 | * Usage (Tip Switch), | |
1030 | * Usage (Barrel Switch), | |
1031 | * Usage (Invert), | |
1032 | * Usage (Eraser), | |
1033 | * Usage (In Range), | |
1034 | * Logical Minimum (0), | |
1035 | * Logical Maximum (1), | |
1036 | * Report Size (1), | |
1037 | * Report Count (5), | |
1038 | * Input (Variable), | |
1039 | * Report Count (3), | |
1040 | * Input (Constant, Variable), | |
1041 | * Usage Page (Desktop), | |
1042 | * Usage (X), | |
1043 | * Report Size (16), | |
1044 | * Report Count (1), | |
1045 | * Push, | |
1046 | * Unit Exponent (13), | |
1047 | * Unit (Inch^3), | |
1048 | * Logical Minimum (0), | |
1049 | * Logical Maximum (16383), | |
1050 | * Physical Minimum (0), | |
1051 | * Physical Maximum (16383), | |
1052 | * Input (Variable), | |
1053 | * Usage (Y), | |
1054 | * Input (Variable), | |
1055 | * Usage Page (Digitizer), | |
1056 | * Usage (Tip Pressure), | |
1057 | * Logical Minimum (0), | |
1058 | * Logical Maximum (1023), | |
1059 | * Physical Minimum (0), | |
1060 | * Physical Maximum (1023), | |
1061 | * Input (Variable), | |
1062 | * End Collection, | |
1063 | * End Collection, | |
1064 | * Usage Page (Desktop), | |
1065 | * Usage (Keyboard), | |
1066 | * Collection (Application), | |
1067 | * Report ID (13), | |
1068 | * Usage Page (Keyboard), | |
1069 | * Usage Minimum (KB Leftcontrol), | |
1070 | * Usage Maximum (KB Right GUI), | |
1071 | * Logical Minimum (0), | |
1072 | * Logical Maximum (1), | |
1073 | * Report Size (1), | |
1074 | * Report Count (8), | |
1075 | * Input (Variable), | |
1076 | * Report Size (8), | |
1077 | * Report Count (1), | |
1078 | * Input (Constant), | |
1079 | * Usage Page (Keyboard), | |
1080 | * Usage Minimum (None), | |
1081 | * Usage Maximum (KB Application), | |
1082 | * Logical Minimum (0), | |
1083 | * Logical Maximum (101), | |
1084 | * Report Size (8), | |
1085 | * Report Count (5), | |
1086 | * Input, | |
1087 | * End Collection, | |
1088 | * Usage Page (Consumer), | |
1089 | * Usage (Consumer Control), | |
1090 | * Collection (Application), | |
1091 | * Report ID (12), | |
1092 | * Usage (Volume Inc), | |
1093 | * Usage (Volume Dec), | |
1094 | * Usage (Mute), | |
1095 | * Logical Minimum (0), | |
1096 | * Logical Maximum (1), | |
1097 | * Report Size (1), | |
1098 | * Report Count (3), | |
1099 | * Input (Variable, Relative), | |
1100 | * Report Size (5), | |
1101 | * Report Count (1), | |
1102 | * Input (Constant, Variable, Relative), | |
1103 | * End Collection | |
1104 | */ | |
1105 | ||
1106 | /* Size of the original report descriptor of Media Tablet 14.1 inch */ | |
1107 | #define MEDIA_TABLET_14_1_INCH_RDESC_ORIG_SIZE 309 | |
1108 | ||
1109 | /* | |
1110 | * Fixed Media Tablet 14.1 inch descriptor. | |
1111 | * It is fixed similarly to the Media Tablet 10.6 inch descriptor. | |
1112 | */ | |
1113 | static __u8 media_tablet_14_1_inch_rdesc_fixed[] = { | |
1114 | 0x05, 0x0D, /* Usage Page (Digitizer), */ | |
1115 | 0x09, 0x02, /* Usage (Pen), */ | |
1116 | 0xA1, 0x01, /* Collection (Application), */ | |
1117 | 0x85, 0x10, /* Report ID (16), */ | |
1118 | 0x09, 0x20, /* Usage (Stylus), */ | |
1119 | 0xA0, /* Collection (Physical), */ | |
1120 | 0x09, 0x42, /* Usage (Tip Switch), */ | |
1121 | 0x09, 0x44, /* Usage (Barrel Switch), */ | |
1122 | 0x09, 0x46, /* Usage (Tablet Pick), */ | |
1123 | 0x15, 0x01, /* Logical Minimum (1), */ | |
1124 | 0x25, 0x03, /* Logical Maximum (3), */ | |
1125 | 0x75, 0x04, /* Report Size (4), */ | |
1126 | 0x95, 0x01, /* Report Count (1), */ | |
1127 | 0x80, /* Input, */ | |
1128 | 0x75, 0x01, /* Report Size (1), */ | |
1129 | 0x09, 0x32, /* Usage (In Range), */ | |
1130 | 0x14, /* Logical Minimum (0), */ | |
1131 | 0x25, 0x01, /* Logical Maximum (1), */ | |
1132 | 0x95, 0x01, /* Report Count (1), */ | |
1133 | 0x81, 0x02, /* Input (Variable), */ | |
1134 | 0x95, 0x03, /* Report Count (3), */ | |
1135 | 0x81, 0x03, /* Input (Constant, Variable), */ | |
1136 | 0x75, 0x10, /* Report Size (16), */ | |
1137 | 0x95, 0x01, /* Report Count (1), */ | |
1138 | 0x14, /* Logical Minimum (0), */ | |
1139 | 0xA4, /* Push, */ | |
1140 | 0x05, 0x01, /* Usage Page (Desktop), */ | |
1141 | 0x65, 0x13, /* Unit (Inch), */ | |
1142 | 0x55, 0xFD, /* Unit Exponent (-3), */ | |
1143 | 0x34, /* Physical Minimum (0), */ | |
1144 | 0x09, 0x30, /* Usage (X), */ | |
1145 | 0x46, 0xE0, 0x2E, /* Physical Maximum (12000), */ | |
1146 | 0x26, 0xFF, 0x3F, /* Logical Maximum (16383), */ | |
1147 | 0x81, 0x02, /* Input (Variable), */ | |
1148 | 0x09, 0x31, /* Usage (Y), */ | |
1149 | 0x46, 0x52, 0x1C, /* Physical Maximum (7250), */ | |
1150 | 0x26, 0xFF, 0x3F, /* Logical Maximum (16383), */ | |
1151 | 0x81, 0x02, /* Input (Variable), */ | |
1152 | 0xB4, /* Pop, */ | |
1153 | 0x09, 0x30, /* Usage (Tip Pressure), */ | |
1154 | 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */ | |
1155 | 0x81, 0x02, /* Input (Variable), */ | |
1156 | 0xC0, /* End Collection, */ | |
1157 | 0xC0, /* End Collection, */ | |
1158 | 0x05, 0x01, /* Usage Page (Desktop), */ | |
1159 | 0x09, 0x02, /* Usage (Mouse), */ | |
1160 | 0xA1, 0x01, /* Collection (Application), */ | |
1161 | 0x85, 0x01, /* Report ID (1), */ | |
1162 | 0x09, 0x01, /* Usage (Pointer), */ | |
1163 | 0xA0, /* Collection (Physical), */ | |
1164 | 0x75, 0x08, /* Report Size (8), */ | |
1165 | 0x95, 0x03, /* Report Count (3), */ | |
1166 | 0x81, 0x03, /* Input (Constant, Variable), */ | |
1167 | 0x95, 0x02, /* Report Count (2), */ | |
1168 | 0x15, 0xFF, /* Logical Minimum (-1), */ | |
1169 | 0x25, 0x01, /* Logical Maximum (1), */ | |
1170 | 0x09, 0x38, /* Usage (Wheel), */ | |
1171 | 0x0B, 0x38, 0x02, /* Usage (Consumer AC Pan), */ | |
1172 | 0x0C, 0x00, | |
1173 | 0x81, 0x06, /* Input (Variable, Relative), */ | |
1174 | 0xC0, /* End Collection, */ | |
1175 | 0xC0, /* End Collection, */ | |
1176 | 0x05, 0x0C, /* Usage Page (Consumer), */ | |
1177 | 0x09, 0x01, /* Usage (Consumer Control), */ | |
1178 | 0xA1, 0x01, /* Collection (Application), */ | |
1179 | 0x85, 0x0D, /* Report ID (13), */ | |
1180 | 0x95, 0x01, /* Report Count (1), */ | |
1181 | 0x75, 0x10, /* Report Size (16), */ | |
1182 | 0x81, 0x03, /* Input (Constant, Variable), */ | |
1183 | 0x0A, 0x2F, 0x02, /* Usage (AC Zoom), */ | |
1184 | 0x0A, 0x2E, 0x02, /* Usage (AC Zoom Out), */ | |
1185 | 0x0A, 0x2D, 0x02, /* Usage (AC Zoom In), */ | |
1186 | 0x09, 0xB6, /* Usage (Scan Previous Track), */ | |
1187 | 0x09, 0xB5, /* Usage (Scan Next Track), */ | |
1188 | 0x08, /* Usage (00h), */ | |
1189 | 0x08, /* Usage (00h), */ | |
1190 | 0x08, /* Usage (00h), */ | |
1191 | 0x08, /* Usage (00h), */ | |
1192 | 0x08, /* Usage (00h), */ | |
1193 | 0x0A, 0x2E, 0x02, /* Usage (AC Zoom Out), */ | |
1194 | 0x0A, 0x2D, 0x02, /* Usage (AC Zoom In), */ | |
1195 | 0x15, 0x0C, /* Logical Minimum (12), */ | |
1196 | 0x25, 0x17, /* Logical Maximum (23), */ | |
1197 | 0x75, 0x05, /* Report Size (5), */ | |
1198 | 0x80, /* Input, */ | |
1199 | 0x75, 0x03, /* Report Size (3), */ | |
1200 | 0x81, 0x03, /* Input (Constant, Variable), */ | |
1201 | 0x75, 0x20, /* Report Size (32), */ | |
1202 | 0x81, 0x03, /* Input (Constant, Variable), */ | |
1203 | 0xC0, /* End Collection, */ | |
1204 | 0x09, 0x01, /* Usage (Consumer Control), */ | |
1205 | 0xA1, 0x01, /* Collection (Application), */ | |
1206 | 0x85, 0x0C, /* Report ID (12), */ | |
1207 | 0x75, 0x01, /* Report Size (1), */ | |
1208 | 0x09, 0xE9, /* Usage (Volume Inc), */ | |
1209 | 0x09, 0xEA, /* Usage (Volume Dec), */ | |
1210 | 0x09, 0xE2, /* Usage (Mute), */ | |
1211 | 0x14, /* Logical Minimum (0), */ | |
1212 | 0x25, 0x01, /* Logical Maximum (1), */ | |
1213 | 0x95, 0x03, /* Report Count (3), */ | |
1214 | 0x81, 0x06, /* Input (Variable, Relative), */ | |
1215 | 0x75, 0x05, /* Report Size (5), */ | |
1216 | 0x81, 0x03, /* Input (Constant, Variable), */ | |
1217 | 0xC0 /* End Collection */ | |
1218 | }; | |
1219 | ||
72a46344 NK |
1220 | static __u8 *waltop_report_fixup(struct hid_device *hdev, __u8 *rdesc, |
1221 | unsigned int *rsize) | |
1222 | { | |
1223 | switch (hdev->product) { | |
1224 | case USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH: | |
1225 | if (*rsize == SLIM_TABLET_5_8_INCH_RDESC_ORIG_SIZE) { | |
1226 | rdesc = slim_tablet_5_8_inch_rdesc_fixed; | |
1227 | *rsize = sizeof(slim_tablet_5_8_inch_rdesc_fixed); | |
1228 | } | |
1229 | break; | |
00e7f964 NK |
1230 | case USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH: |
1231 | if (*rsize == SLIM_TABLET_12_1_INCH_RDESC_ORIG_SIZE) { | |
1232 | rdesc = slim_tablet_12_1_inch_rdesc_fixed; | |
1233 | *rsize = sizeof(slim_tablet_12_1_inch_rdesc_fixed); | |
1234 | } | |
1235 | break; | |
4fdc18d1 NK |
1236 | case USB_DEVICE_ID_WALTOP_Q_PAD: |
1237 | if (*rsize == Q_PAD_RDESC_ORIG_SIZE) { | |
1238 | rdesc = q_pad_rdesc_fixed; | |
1239 | *rsize = sizeof(q_pad_rdesc_fixed); | |
1240 | } | |
1241 | break; | |
72a46344 NK |
1242 | case USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH: |
1243 | if (*rsize == MEDIA_TABLET_10_6_INCH_RDESC_ORIG_SIZE) { | |
1244 | rdesc = media_tablet_10_6_inch_rdesc_fixed; | |
1245 | *rsize = sizeof(media_tablet_10_6_inch_rdesc_fixed); | |
1246 | } | |
1247 | break; | |
8f1acc32 NK |
1248 | case USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH: |
1249 | if (*rsize == MEDIA_TABLET_14_1_INCH_RDESC_ORIG_SIZE) { | |
1250 | rdesc = media_tablet_14_1_inch_rdesc_fixed; | |
1251 | *rsize = sizeof(media_tablet_14_1_inch_rdesc_fixed); | |
1252 | } | |
1253 | break; | |
72a46344 NK |
1254 | } |
1255 | return rdesc; | |
1256 | } | |
1257 | ||
1258 | static const struct hid_device_id waltop_devices[] = { | |
1259 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, | |
1260 | USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH) }, | |
00e7f964 NK |
1261 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, |
1262 | USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH) }, | |
4fdc18d1 NK |
1263 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, |
1264 | USB_DEVICE_ID_WALTOP_Q_PAD) }, | |
72a46344 NK |
1265 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, |
1266 | USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH) }, | |
8f1acc32 NK |
1267 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, |
1268 | USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH) }, | |
72a46344 NK |
1269 | { } |
1270 | }; | |
1271 | MODULE_DEVICE_TABLE(hid, waltop_devices); | |
1272 | ||
1273 | static struct hid_driver waltop_driver = { | |
1274 | .name = "waltop", | |
1275 | .id_table = waltop_devices, | |
1276 | .report_fixup = waltop_report_fixup, | |
1277 | }; | |
1278 | ||
1279 | static int __init waltop_init(void) | |
1280 | { | |
1281 | return hid_register_driver(&waltop_driver); | |
1282 | } | |
1283 | ||
1284 | static void __exit waltop_exit(void) | |
1285 | { | |
1286 | hid_unregister_driver(&waltop_driver); | |
1287 | } | |
1288 | ||
1289 | module_init(waltop_init); | |
1290 | module_exit(waltop_exit); | |
1291 | MODULE_LICENSE("GPL"); |