blob: 246160a9fb894fa93fc1a20cce227fb0572a192d [file] [log] [blame]
Nikolai Kondrashov72a46342010-08-20 19:21:11 +04001/*
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
20/*
21 * Original Slim Tablet 5.8 inch report descriptor.
22 *
23 * All the reports except the report with ID 16 (the stylus) are unused,
24 * possibly because the tablet is not configured to, or because they were
25 * just copied from a more capable model. The purpose of features described
26 * for report ID 2 is unknown.
27 *
28 * The stylus buttons are described as three bit fields, whereas actually
29 * it's an "array", i.e. they're reported as button numbers (1, 2 and 3).
30 * The "eraser" field is not used. There is also a "push" without a "pop" in
31 * the stylus description.
32 *
33 * Usage Page (Desktop), ; Generic desktop controls (01h)
34 * Usage (Mouse), ; Mouse (02h, application collection)
35 * Collection (Application),
36 * Report ID (1),
37 * Usage (Pointer), ; Pointer (01h, physical collection)
38 * Collection (Physical),
39 * Usage Page (Button), ; Button (09h)
40 * Usage Minimum (01h),
41 * Usage Maximum (05h),
42 * Logical Minimum (0),
43 * Logical Maximum (1),
44 * Report Size (1),
45 * Report Count (5),
46 * Input (Variable),
47 * Report Size (3),
48 * Report Count (1),
49 * Input (Constant, Variable),
50 * Usage Page (Desktop), ; Generic desktop controls (01h)
51 * Usage (X), ; X (30h, dynamic value)
52 * Usage (Y), ; Y (31h, dynamic value)
53 * Usage (Wheel), ; Wheel (38h, dynamic value)
54 * Logical Minimum (-127),
55 * Logical Maximum (127),
56 * Report Size (8),
57 * Report Count (3),
58 * Input (Variable, Relative),
59 * End Collection,
60 * End Collection,
61 * Usage Page (Digitizer), ; Digitizer (0Dh)
62 * Usage (Pen), ; Pen (02h, application collection)
63 * Collection (Application),
64 * Report ID (2),
65 * Usage (Stylus), ; Stylus (20h, logical collection)
66 * Collection (Physical),
67 * Usage (00h),
68 * Logical Minimum (0),
69 * Logical Maximum (255),
70 * Report Size (8),
71 * Report Count (7),
72 * Input (Variable),
73 * Usage (Azimuth), ; Azimuth (3Fh, dynamic value)
74 * Usage (Altitude), ; Altitude (40h, dynamic value)
75 * Logical Minimum (0),
76 * Logical Maximum (255),
77 * Report Size (8),
78 * Report Count (2),
79 * Feature (Variable),
80 * End Collection,
81 * Report ID (5),
82 * Usage Page (Digitizer), ; Digitizer (0Dh)
83 * Usage (Stylus), ; Stylus (20h, logical collection)
84 * Collection (Physical),
85 * Usage (00h),
86 * Logical Minimum (0),
87 * Logical Maximum (255),
88 * Report Size (8),
89 * Report Count (7),
90 * Input (Variable),
91 * End Collection,
92 * Report ID (10),
93 * Usage Page (Digitizer), ; Digitizer (0Dh)
94 * Usage (Stylus), ; Stylus (20h, logical collection)
95 * Collection (Physical),
96 * Usage (00h),
97 * Logical Minimum (0),
98 * Logical Maximum (255),
99 * Report Size (8),
100 * Report Count (3),
101 * Input (Variable),
102 * End Collection,
103 * Report ID (16),
104 * Usage (Stylus), ; Stylus (20h, logical collection)
105 * Collection (Physical),
106 * Usage (Tip Switch), ; Tip switch (42h, momentary control)
107 * Usage (Barrel Switch), ; Barrel switch (44h, momentary control)
108 * Usage (Invert), ; Invert (3Ch, momentary control)
109 * Usage (Eraser), ; Eraser (45h, momentary control)
110 * Usage (In Range), ; In range (32h, momentary control)
111 * Logical Minimum (0),
112 * Logical Maximum (1),
113 * Report Size (1),
114 * Report Count (5),
115 * Input (Variable),
116 * Report Count (3),
117 * Input (Constant, Variable),
118 * Usage Page (Desktop), ; Generic desktop controls (01h)
119 * Usage (X), ; X (30h, dynamic value)
120 * Report Size (16),
121 * Report Count (1),
122 * Push,
123 * Unit Exponent (13),
124 * Unit (Inch^3),
125 * Logical Minimum (0),
126 * Logical Maximum (10000),
127 * Physical Minimum (0),
128 * Physical Maximum (10000),
129 * Input (Variable),
130 * Usage (Y), ; Y (31h, dynamic value)
131 * Logical Maximum (6000),
132 * Physical Maximum (6000),
133 * Input (Variable),
134 * Usage Page (Digitizer), ; Digitizer (0Dh)
135 * Usage (Tip Pressure), ; Tip pressure (30h, dynamic value)
136 * Logical Minimum (0),
137 * Logical Maximum (1023),
138 * Physical Minimum (0),
139 * Physical Maximum (1023),
140 * Input (Variable),
141 * End Collection,
142 * End Collection
143 */
144
145/* Size of the original report descriptor of Slim Tablet 5.8 inch */
146#define SLIM_TABLET_5_8_INCH_RDESC_ORIG_SIZE 222
147
148/*
149 * Fixed Slim Tablet 5.8 inch descriptor.
150 *
151 * All the reports except the stylus report (ID 16) were removed as unused.
152 * The stylus buttons description was fixed.
153 */
154static __u8 slim_tablet_5_8_inch_rdesc_fixed[] = {
155 0x05, 0x0D, /* Usage Page (Digitizer), */
156 0x09, 0x02, /* Usage (Pen), */
157 0xA1, 0x01, /* Collection (Application), */
158 0x85, 0x10, /* Report ID (16), */
159 0x09, 0x20, /* Usage (Stylus), */
160 0xA0, /* Collection (Physical), */
161 0x09, 0x42, /* Usage (Tip Switch), */
162 0x09, 0x44, /* Usage (Barrel Switch), */
163 0x09, 0x46, /* Usage (Tablet Pick), */
164 0x15, 0x01, /* Logical Minimum (1), */
165 0x25, 0x03, /* Logical Maximum (3), */
166 0x75, 0x04, /* Report Size (4), */
167 0x95, 0x01, /* Report Count (1), */
168 0x80, /* Input, */
169 0x09, 0x32, /* Usage (In Range), */
170 0x14, /* Logical Minimum (0), */
171 0x25, 0x01, /* Logical Maximum (1), */
172 0x75, 0x01, /* Report Size (1), */
173 0x95, 0x01, /* Report Count (1), */
174 0x81, 0x02, /* Input (Variable), */
175 0x95, 0x03, /* Report Count (3), */
176 0x81, 0x03, /* Input (Constant, Variable), */
177 0x75, 0x10, /* Report Size (16), */
178 0x95, 0x01, /* Report Count (1), */
179 0x14, /* Logical Minimum (0), */
180 0xA4, /* Push, */
181 0x05, 0x01, /* Usage Page (Desktop), */
182 0x65, 0x13, /* Unit (Inch), */
183 0x55, 0xFD, /* Unit Exponent (-3), */
184 0x34, /* Physical Minimum (0), */
185 0x09, 0x30, /* Usage (X), */
186 0x46, 0x88, 0x13, /* Physical Maximum (5000), */
187 0x26, 0x10, 0x27, /* Logical Maximum (10000), */
188 0x81, 0x02, /* Input (Variable), */
189 0x09, 0x31, /* Usage (Y), */
190 0x46, 0xB8, 0x0B, /* Physical Maximum (3000), */
191 0x26, 0x70, 0x17, /* Logical Maximum (6000), */
192 0x81, 0x02, /* Input (Variable), */
193 0xB4, /* Pop, */
194 0x09, 0x30, /* Usage (Tip Pressure), */
195 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */
196 0x81, 0x02, /* Input (Variable), */
197 0xC0, /* End Collection, */
198 0xC0 /* End Collection */
199};
200
201/*
202 * Original Media Tablet 10.6 inch report descriptor.
203 *
204 * There are at least two versions of this model in the wild. They are
205 * represented by Genius G-Pen M609 (older version) and Genius G-Pen M609X
206 * (newer version).
207 *
208 * Both versions have the usual pen with two barrel buttons and two
209 * identical wheels with center buttons in the top corners of the tablet
210 * base. They also have buttons on the top, between the wheels, for
211 * selecting the wheels' functions and wide/standard mode. In the wide mode
212 * the whole working surface is sensed, in the standard mode a narrower area
213 * is sensed, but the logical report extents remain the same. These modes
214 * correspond roughly to 16:9 and 4:3 aspect ratios respectively.
215 *
216 * The older version has three wheel function buttons ("scroll", "zoom" and
217 * "volume") and two separate buttons for wide and standard mode. The newer
218 * version has four wheel function buttons (plus "brush") and only one
219 * button is used for selecting wide/standard mode. So, the total number of
220 * buttons remains the same, but one of the mode buttons is repurposed as a
221 * wheels' function button in the newer version.
222 *
223 * The wheel functions are:
Nikolai Kondrashov4b5b45752010-08-30 14:06:35 +0400224 * scroll - the wheels act as scroll wheels, the center buttons switch
225 * between vertical and horizontal scrolling;
226 * zoom - the wheels zoom in/out, the buttons supposedly reset to 100%;
227 * volume - the wheels control the sound volume, the buttons mute;
Nikolai Kondrashov72a46342010-08-20 19:21:11 +0400228 * brush - the wheels are supposed to control brush width in a graphics
229 * editor, the buttons do nothing.
230 *
231 * Below is the newer version's report descriptor. It may very well be that
232 * the older version's descriptor is different and thus it won't be
233 * supported.
234 *
235 * The mouse report (ID 1) only uses the wheel field for reporting the tablet
236 * wheels' scroll mode. The keyboard report (ID 13) is used to report the
237 * wheels' zoom and brush control functions as key presses. The report ID 12
238 * is used to report the wheels' volume control functions. The stylus report
239 * (ID 16) has the same problems as the Slim Tablet 5.8 inch report has.
240 *
241 * The rest of the reports are unused, at least in the default configuration.
242 * The purpose of the features is unknown.
243 *
244 * Usage Page (Desktop),
245 * Usage (Mouse),
246 * Collection (Application),
247 * Report ID (1),
248 * Usage (Pointer),
249 * Collection (Physical),
250 * Usage Page (Button),
251 * Usage Minimum (01h),
252 * Usage Maximum (05h),
253 * Logical Minimum (0),
254 * Logical Maximum (1),
255 * Report Size (1),
256 * Report Count (5),
257 * Input (Variable),
258 * Report Size (3),
259 * Report Count (1),
260 * Input (Constant, Variable),
261 * Usage Page (Desktop),
262 * Usage (X),
263 * Usage (Y),
264 * Usage (Wheel),
265 * Logical Minimum (-127),
266 * Logical Maximum (127),
267 * Report Size (8),
268 * Report Count (3),
269 * Input (Variable, Relative),
270 * End Collection,
271 * End Collection,
272 * Usage Page (Digitizer),
273 * Usage (Pen),
274 * Collection (Application),
275 * Report ID (2),
276 * Usage (Stylus),
277 * Collection (Physical),
278 * Usage (00h),
279 * Logical Minimum (0),
280 * Logical Maximum (255),
281 * Report Size (8),
282 * Report Count (7),
283 * Input (Variable),
284 * Usage (Azimuth),
285 * Usage (Altitude),
286 * Logical Minimum (0),
287 * Logical Maximum (255),
288 * Report Size (8),
289 * Report Count (2),
290 * Feature (Variable),
291 * End Collection,
292 * Report ID (5),
293 * Usage Page (Digitizer),
294 * Usage (Stylus),
295 * Collection (Physical),
296 * Usage (00h),
297 * Logical Minimum (0),
298 * Logical Maximum (255),
299 * Report Size (8),
300 * Report Count (7),
301 * Input (Variable),
302 * End Collection,
303 * Report ID (10),
304 * Usage Page (Digitizer),
305 * Usage (Stylus),
306 * Collection (Physical),
307 * Usage (00h),
308 * Logical Minimum (0),
309 * Logical Maximum (255),
310 * Report Size (8),
311 * Report Count (7),
312 * Input (Variable),
313 * End Collection,
314 * Report ID (16),
315 * Usage (Stylus),
316 * Collection (Physical),
317 * Usage (Tip Switch),
318 * Usage (Barrel Switch),
319 * Usage (Invert),
320 * Usage (Eraser),
321 * Usage (In Range),
322 * Logical Minimum (0),
323 * Logical Maximum (1),
324 * Report Size (1),
325 * Report Count (5),
326 * Input (Variable),
327 * Report Count (3),
328 * Input (Constant, Variable),
329 * Usage Page (Desktop),
330 * Usage (X),
331 * Report Size (16),
332 * Report Count (1),
333 * Push,
334 * Unit Exponent (13),
335 * Unit (Inch^3),
336 * Logical Minimum (0),
337 * Logical Maximum (18000),
338 * Physical Minimum (0),
339 * Physical Maximum (18000),
340 * Input (Variable),
341 * Usage (Y),
342 * Logical Maximum (11000),
343 * Physical Maximum (11000),
344 * Input (Variable),
345 * Usage Page (Digitizer),
346 * Usage (Tip Pressure),
347 * Logical Minimum (0),
348 * Logical Maximum (1023),
349 * Physical Minimum (0),
350 * Physical Maximum (1023),
351 * Input (Variable),
352 * End Collection,
353 * End Collection,
354 * Usage Page (Desktop),
355 * Usage (Keyboard),
356 * Collection (Application),
357 * Report ID (13),
358 * Usage Page (Keyboard),
359 * Usage Minimum (KB Leftcontrol),
360 * Usage Maximum (KB Right GUI),
361 * Logical Minimum (0),
362 * Logical Maximum (1),
363 * Report Size (1),
364 * Report Count (8),
365 * Input (Variable),
366 * Report Size (8),
367 * Report Count (1),
368 * Input (Constant),
369 * Usage Page (Keyboard),
370 * Usage Minimum (None),
371 * Usage Maximum (KB Application),
372 * Logical Minimum (0),
373 * Logical Maximum (101),
374 * Report Size (8),
375 * Report Count (5),
376 * Input,
377 * End Collection,
378 * Usage Page (Consumer),
379 * Usage (Consumer Control),
380 * Collection (Application),
381 * Report ID (12),
382 * Usage (Volume Inc),
383 * Usage (Volume Dec),
384 * Usage (Mute),
385 * Logical Minimum (0),
386 * Logical Maximum (1),
387 * Report Size (1),
388 * Report Count (3),
389 * Input (Variable, Relative),
390 * Report Size (5),
391 * Report Count (1),
392 * Input (Constant, Variable, Relative),
393 * End Collection
394 */
395
396/* Size of the original report descriptor of Media Tablet 10.6 inch */
397#define MEDIA_TABLET_10_6_INCH_RDESC_ORIG_SIZE 300
398
399/*
400 * Fixed Media Tablet 10.6 inch descriptor.
401 *
402 * The descriptions of reports unused in the default configuration are
403 * removed. The stylus report (ID 16) is fixed similarly to Slim Tablet 5.8
404 * inch. The unused mouse report (ID 1) fields are replaced with constant
405 * padding.
406 *
407 * The keyboard report (ID 13) is hacked to instead have an "array" field
408 * reporting consumer page controls, and all the unused bits are masked out
409 * with constant padding. The "brush" wheels' function is represented as "Scan
410 * Previous/Next Track" controls due to the lack of brush controls in the
411 * usage tables specification.
412 */
413static __u8 media_tablet_10_6_inch_rdesc_fixed[] = {
414 0x05, 0x0D, /* Usage Page (Digitizer), */
415 0x09, 0x02, /* Usage (Pen), */
416 0xA1, 0x01, /* Collection (Application), */
417 0x85, 0x10, /* Report ID (16), */
418 0x09, 0x20, /* Usage (Stylus), */
419 0xA0, /* Collection (Physical), */
420 0x09, 0x42, /* Usage (Tip Switch), */
421 0x09, 0x44, /* Usage (Barrel Switch), */
422 0x09, 0x46, /* Usage (Tablet Pick), */
423 0x15, 0x01, /* Logical Minimum (1), */
424 0x25, 0x03, /* Logical Maximum (3), */
425 0x75, 0x04, /* Report Size (4), */
426 0x95, 0x01, /* Report Count (1), */
427 0x80, /* Input, */
428 0x75, 0x01, /* Report Size (1), */
429 0x09, 0x32, /* Usage (In Range), */
430 0x14, /* Logical Minimum (0), */
431 0x25, 0x01, /* Logical Maximum (1), */
432 0x95, 0x01, /* Report Count (1), */
433 0x81, 0x02, /* Input (Variable), */
434 0x95, 0x03, /* Report Count (3), */
435 0x81, 0x03, /* Input (Constant, Variable), */
436 0x75, 0x10, /* Report Size (16), */
437 0x95, 0x01, /* Report Count (1), */
438 0x14, /* Logical Minimum (0), */
439 0xA4, /* Push, */
440 0x05, 0x01, /* Usage Page (Desktop), */
441 0x65, 0x13, /* Unit (Inch), */
442 0x55, 0xFD, /* Unit Exponent (-3), */
443 0x34, /* Physical Minimum (0), */
444 0x09, 0x30, /* Usage (X), */
445 0x46, 0x28, 0x23, /* Physical Maximum (9000), */
446 0x26, 0x50, 0x46, /* Logical Maximum (18000), */
447 0x81, 0x02, /* Input (Variable), */
448 0x09, 0x31, /* Usage (Y), */
449 0x46, 0x7C, 0x15, /* Physical Maximum (5500), */
450 0x26, 0xF8, 0x2A, /* Logical Maximum (11000), */
451 0x81, 0x02, /* Input (Variable), */
452 0xB4, /* Pop, */
453 0x09, 0x30, /* Usage (Tip Pressure), */
454 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */
455 0x81, 0x02, /* Input (Variable), */
456 0xC0, /* End Collection, */
457 0xC0, /* End Collection, */
458 0x05, 0x01, /* Usage Page (Desktop), */
459 0x09, 0x02, /* Usage (Mouse), */
460 0xA1, 0x01, /* Collection (Application), */
461 0x85, 0x01, /* Report ID (1), */
462 0x09, 0x01, /* Usage (Pointer), */
463 0xA0, /* Collection (Physical), */
Nikolai Kondrashov4b5b45752010-08-30 14:06:35 +0400464 0x75, 0x08, /* Report Size (8), */
465 0x95, 0x03, /* Report Count (3), */
Nikolai Kondrashov72a46342010-08-20 19:21:11 +0400466 0x81, 0x03, /* Input (Constant, Variable), */
Nikolai Kondrashov4b5b45752010-08-30 14:06:35 +0400467 0x95, 0x02, /* Report Count (2), */
Nikolai Kondrashov72a46342010-08-20 19:21:11 +0400468 0x15, 0xFF, /* Logical Minimum (-1), */
469 0x25, 0x01, /* Logical Maximum (1), */
Nikolai Kondrashov4b5b45752010-08-30 14:06:35 +0400470 0x09, 0x38, /* Usage (Wheel), */
471 0x0B, 0x38, 0x02, /* Usage (Consumer AC Pan), */
472 0x0C, 0x00,
Nikolai Kondrashov72a46342010-08-20 19:21:11 +0400473 0x81, 0x06, /* Input (Variable, Relative), */
Nikolai Kondrashov4b5b45752010-08-30 14:06:35 +0400474 0x95, 0x02, /* Report Count (2), */
Nikolai Kondrashov72a46342010-08-20 19:21:11 +0400475 0x81, 0x03, /* Input (Constant, Variable), */
476 0xC0, /* End Collection, */
477 0xC0, /* End Collection, */
478 0x05, 0x0C, /* Usage Page (Consumer), */
479 0x09, 0x01, /* Usage (Consumer Control), */
480 0xA1, 0x01, /* Collection (Application), */
481 0x85, 0x0D, /* Report ID (13), */
482 0x95, 0x01, /* Report Count (1), */
483 0x75, 0x10, /* Report Size (16), */
484 0x81, 0x03, /* Input (Constant, Variable), */
485 0x0A, 0x2F, 0x02, /* Usage (AC Zoom), */
486 0x0A, 0x2E, 0x02, /* Usage (AC Zoom Out), */
487 0x0A, 0x2D, 0x02, /* Usage (AC Zoom In), */
488 0x09, 0xB6, /* Usage (Scan Previous Track), */
489 0x09, 0xB5, /* Usage (Scan Next Track), */
Nikolai Kondrashov30311542010-08-30 14:06:37 +0400490 0x08, /* Usage (00h), */
491 0x08, /* Usage (00h), */
492 0x08, /* Usage (00h), */
493 0x08, /* Usage (00h), */
494 0x08, /* Usage (00h), */
495 0x0A, 0x2E, 0x02, /* Usage (AC Zoom Out), */
496 0x0A, 0x2D, 0x02, /* Usage (AC Zoom In), */
497 0x15, 0x0C, /* Logical Minimum (12), */
498 0x25, 0x17, /* Logical Maximum (23), */
499 0x75, 0x05, /* Report Size (5), */
Nikolai Kondrashov72a46342010-08-20 19:21:11 +0400500 0x80, /* Input, */
Nikolai Kondrashov30311542010-08-30 14:06:37 +0400501 0x75, 0x03, /* Report Size (3), */
502 0x81, 0x03, /* Input (Constant, Variable), */
Nikolai Kondrashov72a46342010-08-20 19:21:11 +0400503 0x75, 0x20, /* Report Size (32), */
504 0x81, 0x03, /* Input (Constant, Variable), */
505 0xC0, /* End Collection, */
506 0x09, 0x01, /* Usage (Consumer Control), */
507 0xA1, 0x01, /* Collection (Application), */
508 0x85, 0x0C, /* Report ID (12), */
509 0x75, 0x01, /* Report Size (1), */
510 0x09, 0xE9, /* Usage (Volume Inc), */
511 0x09, 0xEA, /* Usage (Volume Dec), */
512 0x09, 0xE2, /* Usage (Mute), */
513 0x14, /* Logical Minimum (0), */
514 0x25, 0x01, /* Logical Maximum (1), */
515 0x95, 0x03, /* Report Count (3), */
516 0x81, 0x06, /* Input (Variable, Relative), */
517 0x95, 0x35, /* Report Count (53), */
518 0x81, 0x03, /* Input (Constant, Variable), */
519 0xC0 /* End Collection */
520};
521
Nikolai Kondrashov8f1acc32010-08-30 14:06:36 +0400522/*
523 * Original Media Tablet 14.1 inch report descriptor.
524 *
525 * There are at least two versions of this model in the wild. They are
526 * represented by Genius G-Pen M712 (older version) and Genius G-Pen M712X
527 * (newer version). The hardware difference between these versions is the same
528 * as between older and newer versions of Media Tablet 10.6 inch. The report
529 * descriptors are identical for both versions.
530 *
531 * The function, behavior and report descriptor of this tablet is similar to
532 * that of Media Tablet 10.6 inch. However, there is one more field (with
533 * Consumer AC Pan usage) in the mouse description. Then the tablet X and Y
534 * logical extents both get scaled to 0..16383 range (a hardware limit?),
535 * which kind of defeats the advertised 4000 LPI resolution, considering the
536 * physical extents of 12x7.25 inches. Plus, reports 5, 10 and 255 are used
537 * sometimes (while moving the pen) with unknown purpose. Also, the key codes
538 * generated for zoom in/out are different.
539 *
540 * Usage Page (Desktop),
541 * Usage (Mouse),
542 * Collection (Application),
543 * Report ID (1),
544 * Usage (Pointer),
545 * Collection (Physical),
546 * Usage Page (Button),
547 * Usage Minimum (01h),
548 * Usage Maximum (05h),
549 * Logical Minimum (0),
550 * Logical Maximum (1),
551 * Report Size (1),
552 * Report Count (5),
553 * Input (Variable),
554 * Report Size (3),
555 * Report Count (1),
556 * Input (Constant, Variable),
557 * Usage Page (Desktop),
558 * Usage (X),
559 * Usage (Y),
560 * Usage (Wheel),
561 * Logical Minimum (-127),
562 * Logical Maximum (127),
563 * Report Size (8),
564 * Report Count (3),
565 * Input (Variable, Relative),
566 * Usage Page (Consumer),
567 * Logical Minimum (-127),
568 * Logical Maximum (127),
569 * Report Size (8),
570 * Report Count (1),
571 * Usage (AC Pan),
572 * Input (Variable, Relative),
573 * End Collection,
574 * End Collection,
575 * Usage Page (Digitizer),
576 * Usage (Pen),
577 * Collection (Application),
578 * Report ID (2),
579 * Usage (Stylus),
580 * Collection (Physical),
581 * Usage (00h),
582 * Logical Minimum (0),
583 * Logical Maximum (255),
584 * Report Size (8),
585 * Report Count (7),
586 * Input (Variable),
587 * Usage (Azimuth),
588 * Usage (Altitude),
589 * Logical Minimum (0),
590 * Logical Maximum (255),
591 * Report Size (8),
592 * Report Count (2),
593 * Feature (Variable),
594 * End Collection,
595 * Report ID (5),
596 * Usage Page (Digitizer),
597 * Usage (Stylus),
598 * Collection (Physical),
599 * Usage (00h),
600 * Logical Minimum (0),
601 * Logical Maximum (255),
602 * Report Size (8),
603 * Report Count (7),
604 * Input (Variable),
605 * End Collection,
606 * Report ID (10),
607 * Usage Page (Digitizer),
608 * Usage (Stylus),
609 * Collection (Physical),
610 * Usage (00h),
611 * Logical Minimum (0),
612 * Logical Maximum (255),
613 * Report Size (8),
614 * Report Count (7),
615 * Input (Variable),
616 * End Collection,
617 * Report ID (16),
618 * Usage (Stylus),
619 * Collection (Physical),
620 * Usage (Tip Switch),
621 * Usage (Barrel Switch),
622 * Usage (Invert),
623 * Usage (Eraser),
624 * Usage (In Range),
625 * Logical Minimum (0),
626 * Logical Maximum (1),
627 * Report Size (1),
628 * Report Count (5),
629 * Input (Variable),
630 * Report Count (3),
631 * Input (Constant, Variable),
632 * Usage Page (Desktop),
633 * Usage (X),
634 * Report Size (16),
635 * Report Count (1),
636 * Push,
637 * Unit Exponent (13),
638 * Unit (Inch^3),
639 * Logical Minimum (0),
640 * Logical Maximum (16383),
641 * Physical Minimum (0),
642 * Physical Maximum (16383),
643 * Input (Variable),
644 * Usage (Y),
645 * Input (Variable),
646 * Usage Page (Digitizer),
647 * Usage (Tip Pressure),
648 * Logical Minimum (0),
649 * Logical Maximum (1023),
650 * Physical Minimum (0),
651 * Physical Maximum (1023),
652 * Input (Variable),
653 * End Collection,
654 * End Collection,
655 * Usage Page (Desktop),
656 * Usage (Keyboard),
657 * Collection (Application),
658 * Report ID (13),
659 * Usage Page (Keyboard),
660 * Usage Minimum (KB Leftcontrol),
661 * Usage Maximum (KB Right GUI),
662 * Logical Minimum (0),
663 * Logical Maximum (1),
664 * Report Size (1),
665 * Report Count (8),
666 * Input (Variable),
667 * Report Size (8),
668 * Report Count (1),
669 * Input (Constant),
670 * Usage Page (Keyboard),
671 * Usage Minimum (None),
672 * Usage Maximum (KB Application),
673 * Logical Minimum (0),
674 * Logical Maximum (101),
675 * Report Size (8),
676 * Report Count (5),
677 * Input,
678 * End Collection,
679 * Usage Page (Consumer),
680 * Usage (Consumer Control),
681 * Collection (Application),
682 * Report ID (12),
683 * Usage (Volume Inc),
684 * Usage (Volume Dec),
685 * Usage (Mute),
686 * Logical Minimum (0),
687 * Logical Maximum (1),
688 * Report Size (1),
689 * Report Count (3),
690 * Input (Variable, Relative),
691 * Report Size (5),
692 * Report Count (1),
693 * Input (Constant, Variable, Relative),
694 * End Collection
695 */
696
697/* Size of the original report descriptor of Media Tablet 14.1 inch */
698#define MEDIA_TABLET_14_1_INCH_RDESC_ORIG_SIZE 309
699
700/*
701 * Fixed Media Tablet 14.1 inch descriptor.
702 * It is fixed similarly to the Media Tablet 10.6 inch descriptor.
703 */
704static __u8 media_tablet_14_1_inch_rdesc_fixed[] = {
705 0x05, 0x0D, /* Usage Page (Digitizer), */
706 0x09, 0x02, /* Usage (Pen), */
707 0xA1, 0x01, /* Collection (Application), */
708 0x85, 0x10, /* Report ID (16), */
709 0x09, 0x20, /* Usage (Stylus), */
710 0xA0, /* Collection (Physical), */
711 0x09, 0x42, /* Usage (Tip Switch), */
712 0x09, 0x44, /* Usage (Barrel Switch), */
713 0x09, 0x46, /* Usage (Tablet Pick), */
714 0x15, 0x01, /* Logical Minimum (1), */
715 0x25, 0x03, /* Logical Maximum (3), */
716 0x75, 0x04, /* Report Size (4), */
717 0x95, 0x01, /* Report Count (1), */
718 0x80, /* Input, */
719 0x75, 0x01, /* Report Size (1), */
720 0x09, 0x32, /* Usage (In Range), */
721 0x14, /* Logical Minimum (0), */
722 0x25, 0x01, /* Logical Maximum (1), */
723 0x95, 0x01, /* Report Count (1), */
724 0x81, 0x02, /* Input (Variable), */
725 0x95, 0x03, /* Report Count (3), */
726 0x81, 0x03, /* Input (Constant, Variable), */
727 0x75, 0x10, /* Report Size (16), */
728 0x95, 0x01, /* Report Count (1), */
729 0x14, /* Logical Minimum (0), */
730 0xA4, /* Push, */
731 0x05, 0x01, /* Usage Page (Desktop), */
732 0x65, 0x13, /* Unit (Inch), */
733 0x55, 0xFD, /* Unit Exponent (-3), */
734 0x34, /* Physical Minimum (0), */
735 0x09, 0x30, /* Usage (X), */
736 0x46, 0xE0, 0x2E, /* Physical Maximum (12000), */
737 0x26, 0xFF, 0x3F, /* Logical Maximum (16383), */
738 0x81, 0x02, /* Input (Variable), */
739 0x09, 0x31, /* Usage (Y), */
740 0x46, 0x52, 0x1C, /* Physical Maximum (7250), */
741 0x26, 0xFF, 0x3F, /* Logical Maximum (16383), */
742 0x81, 0x02, /* Input (Variable), */
743 0xB4, /* Pop, */
744 0x09, 0x30, /* Usage (Tip Pressure), */
745 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */
746 0x81, 0x02, /* Input (Variable), */
747 0xC0, /* End Collection, */
748 0xC0, /* End Collection, */
749 0x05, 0x01, /* Usage Page (Desktop), */
750 0x09, 0x02, /* Usage (Mouse), */
751 0xA1, 0x01, /* Collection (Application), */
752 0x85, 0x01, /* Report ID (1), */
753 0x09, 0x01, /* Usage (Pointer), */
754 0xA0, /* Collection (Physical), */
755 0x75, 0x08, /* Report Size (8), */
756 0x95, 0x03, /* Report Count (3), */
757 0x81, 0x03, /* Input (Constant, Variable), */
758 0x95, 0x02, /* Report Count (2), */
759 0x15, 0xFF, /* Logical Minimum (-1), */
760 0x25, 0x01, /* Logical Maximum (1), */
761 0x09, 0x38, /* Usage (Wheel), */
762 0x0B, 0x38, 0x02, /* Usage (Consumer AC Pan), */
763 0x0C, 0x00,
764 0x81, 0x06, /* Input (Variable, Relative), */
765 0xC0, /* End Collection, */
766 0xC0, /* End Collection, */
767 0x05, 0x0C, /* Usage Page (Consumer), */
768 0x09, 0x01, /* Usage (Consumer Control), */
769 0xA1, 0x01, /* Collection (Application), */
770 0x85, 0x0D, /* Report ID (13), */
771 0x95, 0x01, /* Report Count (1), */
772 0x75, 0x10, /* Report Size (16), */
773 0x81, 0x03, /* Input (Constant, Variable), */
774 0x0A, 0x2F, 0x02, /* Usage (AC Zoom), */
775 0x0A, 0x2E, 0x02, /* Usage (AC Zoom Out), */
776 0x0A, 0x2D, 0x02, /* Usage (AC Zoom In), */
777 0x09, 0xB6, /* Usage (Scan Previous Track), */
778 0x09, 0xB5, /* Usage (Scan Next Track), */
779 0x08, /* Usage (00h), */
780 0x08, /* Usage (00h), */
781 0x08, /* Usage (00h), */
782 0x08, /* Usage (00h), */
783 0x08, /* Usage (00h), */
784 0x0A, 0x2E, 0x02, /* Usage (AC Zoom Out), */
785 0x0A, 0x2D, 0x02, /* Usage (AC Zoom In), */
786 0x15, 0x0C, /* Logical Minimum (12), */
787 0x25, 0x17, /* Logical Maximum (23), */
788 0x75, 0x05, /* Report Size (5), */
789 0x80, /* Input, */
790 0x75, 0x03, /* Report Size (3), */
791 0x81, 0x03, /* Input (Constant, Variable), */
792 0x75, 0x20, /* Report Size (32), */
793 0x81, 0x03, /* Input (Constant, Variable), */
794 0xC0, /* End Collection, */
795 0x09, 0x01, /* Usage (Consumer Control), */
796 0xA1, 0x01, /* Collection (Application), */
797 0x85, 0x0C, /* Report ID (12), */
798 0x75, 0x01, /* Report Size (1), */
799 0x09, 0xE9, /* Usage (Volume Inc), */
800 0x09, 0xEA, /* Usage (Volume Dec), */
801 0x09, 0xE2, /* Usage (Mute), */
802 0x14, /* Logical Minimum (0), */
803 0x25, 0x01, /* Logical Maximum (1), */
804 0x95, 0x03, /* Report Count (3), */
805 0x81, 0x06, /* Input (Variable, Relative), */
806 0x75, 0x05, /* Report Size (5), */
807 0x81, 0x03, /* Input (Constant, Variable), */
808 0xC0 /* End Collection */
809};
810
Nikolai Kondrashov72a46342010-08-20 19:21:11 +0400811static __u8 *waltop_report_fixup(struct hid_device *hdev, __u8 *rdesc,
812 unsigned int *rsize)
813{
814 switch (hdev->product) {
815 case USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH:
816 if (*rsize == SLIM_TABLET_5_8_INCH_RDESC_ORIG_SIZE) {
817 rdesc = slim_tablet_5_8_inch_rdesc_fixed;
818 *rsize = sizeof(slim_tablet_5_8_inch_rdesc_fixed);
819 }
820 break;
821 case USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH:
822 if (*rsize == MEDIA_TABLET_10_6_INCH_RDESC_ORIG_SIZE) {
823 rdesc = media_tablet_10_6_inch_rdesc_fixed;
824 *rsize = sizeof(media_tablet_10_6_inch_rdesc_fixed);
825 }
826 break;
Nikolai Kondrashov8f1acc32010-08-30 14:06:36 +0400827 case USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH:
828 if (*rsize == MEDIA_TABLET_14_1_INCH_RDESC_ORIG_SIZE) {
829 rdesc = media_tablet_14_1_inch_rdesc_fixed;
830 *rsize = sizeof(media_tablet_14_1_inch_rdesc_fixed);
831 }
832 break;
Nikolai Kondrashov72a46342010-08-20 19:21:11 +0400833 }
834 return rdesc;
835}
836
837static const struct hid_device_id waltop_devices[] = {
838 { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP,
839 USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH) },
840 { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP,
841 USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH) },
Nikolai Kondrashov8f1acc32010-08-30 14:06:36 +0400842 { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP,
843 USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH) },
Nikolai Kondrashov72a46342010-08-20 19:21:11 +0400844 { }
845};
846MODULE_DEVICE_TABLE(hid, waltop_devices);
847
848static struct hid_driver waltop_driver = {
849 .name = "waltop",
850 .id_table = waltop_devices,
851 .report_fixup = waltop_report_fixup,
852};
853
854static int __init waltop_init(void)
855{
856 return hid_register_driver(&waltop_driver);
857}
858
859static void __exit waltop_exit(void)
860{
861 hid_unregister_driver(&waltop_driver);
862}
863
864module_init(waltop_init);
865module_exit(waltop_exit);
866MODULE_LICENSE("GPL");