blob: c1dce51b1c1ebaaf91b6fc20f82cac893dc70030 [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/*
Nikolai Kondrashovcdd49a82010-08-30 14:06:38 +040021 * 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
45/*
Nikolai Kondrashov56d27dd2012-03-06 09:54:23 +020046 * See Slim Tablet 5.8 inch description, device and HID report descriptors at
47 * http://sf.net/apps/mediawiki/digimend/?title=Waltop_Slim_Tablet_5.8%22
Nikolai Kondrashov72a46342010-08-20 19:21:11 +040048 */
49
50/* Size of the original report descriptor of Slim Tablet 5.8 inch */
51#define SLIM_TABLET_5_8_INCH_RDESC_ORIG_SIZE 222
52
Nikolai Kondrashov56d27dd2012-03-06 09:54:23 +020053/* Fixed Slim Tablet 5.8 inch descriptor */
Nikolai Kondrashov72a46342010-08-20 19:21:11 +040054static __u8 slim_tablet_5_8_inch_rdesc_fixed[] = {
55 0x05, 0x0D, /* Usage Page (Digitizer), */
56 0x09, 0x02, /* Usage (Pen), */
57 0xA1, 0x01, /* Collection (Application), */
58 0x85, 0x10, /* Report ID (16), */
59 0x09, 0x20, /* Usage (Stylus), */
60 0xA0, /* Collection (Physical), */
61 0x09, 0x42, /* Usage (Tip Switch), */
62 0x09, 0x44, /* Usage (Barrel Switch), */
63 0x09, 0x46, /* Usage (Tablet Pick), */
64 0x15, 0x01, /* Logical Minimum (1), */
65 0x25, 0x03, /* Logical Maximum (3), */
66 0x75, 0x04, /* Report Size (4), */
67 0x95, 0x01, /* Report Count (1), */
68 0x80, /* Input, */
69 0x09, 0x32, /* Usage (In Range), */
70 0x14, /* Logical Minimum (0), */
71 0x25, 0x01, /* Logical Maximum (1), */
72 0x75, 0x01, /* Report Size (1), */
73 0x95, 0x01, /* Report Count (1), */
74 0x81, 0x02, /* Input (Variable), */
75 0x95, 0x03, /* Report Count (3), */
76 0x81, 0x03, /* Input (Constant, Variable), */
77 0x75, 0x10, /* Report Size (16), */
78 0x95, 0x01, /* Report Count (1), */
79 0x14, /* Logical Minimum (0), */
80 0xA4, /* Push, */
81 0x05, 0x01, /* Usage Page (Desktop), */
82 0x65, 0x13, /* Unit (Inch), */
83 0x55, 0xFD, /* Unit Exponent (-3), */
84 0x34, /* Physical Minimum (0), */
85 0x09, 0x30, /* Usage (X), */
86 0x46, 0x88, 0x13, /* Physical Maximum (5000), */
87 0x26, 0x10, 0x27, /* Logical Maximum (10000), */
88 0x81, 0x02, /* Input (Variable), */
89 0x09, 0x31, /* Usage (Y), */
90 0x46, 0xB8, 0x0B, /* Physical Maximum (3000), */
91 0x26, 0x70, 0x17, /* Logical Maximum (6000), */
92 0x81, 0x02, /* Input (Variable), */
93 0xB4, /* Pop, */
94 0x09, 0x30, /* Usage (Tip Pressure), */
95 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */
96 0x81, 0x02, /* Input (Variable), */
97 0xC0, /* End Collection, */
98 0xC0 /* End Collection */
99};
100
101/*
Nikolai Kondrashov56d27dd2012-03-06 09:54:23 +0200102 * See Slim Tablet 12.1 inch description, device and HID report descriptors at
103 * http://sf.net/apps/mediawiki/digimend/?title=Waltop_Slim_Tablet_12.1%22
Nikolai Kondrashov00e7f962010-09-25 23:16:58 +0400104 */
105
106/* Size of the original report descriptor of Slim Tablet 12.1 inch */
107#define SLIM_TABLET_12_1_INCH_RDESC_ORIG_SIZE 269
108
Nikolai Kondrashov56d27dd2012-03-06 09:54:23 +0200109/* Fixed Slim Tablet 12.1 inch descriptor */
Nikolai Kondrashov00e7f962010-09-25 23:16:58 +0400110static __u8 slim_tablet_12_1_inch_rdesc_fixed[] = {
111 0x05, 0x0D, /* Usage Page (Digitizer), */
112 0x09, 0x02, /* Usage (Pen), */
113 0xA1, 0x01, /* Collection (Application), */
114 0x85, 0x10, /* Report ID (16), */
115 0x09, 0x20, /* Usage (Stylus), */
116 0xA0, /* Collection (Physical), */
117 0x09, 0x42, /* Usage (Tip Switch), */
118 0x09, 0x44, /* Usage (Barrel Switch), */
119 0x09, 0x46, /* Usage (Tablet Pick), */
120 0x15, 0x01, /* Logical Minimum (1), */
121 0x25, 0x03, /* Logical Maximum (3), */
122 0x75, 0x04, /* Report Size (4), */
123 0x95, 0x01, /* Report Count (1), */
124 0x80, /* Input, */
125 0x09, 0x32, /* Usage (In Range), */
126 0x14, /* Logical Minimum (0), */
127 0x25, 0x01, /* Logical Maximum (1), */
128 0x75, 0x01, /* Report Size (1), */
129 0x95, 0x01, /* Report Count (1), */
130 0x81, 0x02, /* Input (Variable), */
131 0x95, 0x03, /* Report Count (3), */
132 0x81, 0x03, /* Input (Constant, Variable), */
133 0x75, 0x10, /* Report Size (16), */
134 0x95, 0x01, /* Report Count (1), */
135 0x14, /* Logical Minimum (0), */
136 0xA4, /* Push, */
137 0x05, 0x01, /* Usage Page (Desktop), */
138 0x65, 0x13, /* Unit (Inch), */
139 0x55, 0xFD, /* Unit Exponent (-3), */
140 0x34, /* Physical Minimum (0), */
141 0x09, 0x30, /* Usage (X), */
142 0x46, 0x10, 0x27, /* Physical Maximum (10000), */
143 0x26, 0x20, 0x4E, /* Logical Maximum (20000), */
144 0x81, 0x02, /* Input (Variable), */
145 0x09, 0x31, /* Usage (Y), */
146 0x46, 0x6A, 0x18, /* Physical Maximum (6250), */
147 0x26, 0xD4, 0x30, /* Logical Maximum (12500), */
148 0x81, 0x02, /* Input (Variable), */
149 0xB4, /* Pop, */
150 0x09, 0x30, /* Usage (Tip Pressure), */
151 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */
152 0x81, 0x02, /* Input (Variable), */
153 0xC0, /* End Collection, */
154 0xC0 /* End Collection */
155};
156
157/*
Nikolai Kondrashov56d27dd2012-03-06 09:54:23 +0200158 * See Q Pad description, device and HID report descriptors at
159 * http://sf.net/apps/mediawiki/digimend/?title=Waltop_Q_Pad
Nikolai Kondrashov4fdc18d2012-02-06 22:54:20 +0200160 */
161
162/* Size of the original report descriptor of Q Pad */
163#define Q_PAD_RDESC_ORIG_SIZE 241
164
Nikolai Kondrashov56d27dd2012-03-06 09:54:23 +0200165/* Fixed Q Pad descriptor */
Nikolai Kondrashov4fdc18d2012-02-06 22:54:20 +0200166static __u8 q_pad_rdesc_fixed[] = {
167 0x05, 0x0D, /* Usage Page (Digitizer), */
168 0x09, 0x02, /* Usage (Pen), */
169 0xA1, 0x01, /* Collection (Application), */
170 0x85, 0x10, /* Report ID (16), */
171 0x09, 0x20, /* Usage (Stylus), */
172 0xA0, /* Collection (Physical), */
173 0x09, 0x42, /* Usage (Tip Switch), */
174 0x09, 0x44, /* Usage (Barrel Switch), */
175 0x09, 0x46, /* Usage (Tablet Pick), */
176 0x15, 0x01, /* Logical Minimum (1), */
177 0x25, 0x03, /* Logical Maximum (3), */
178 0x75, 0x04, /* Report Size (4), */
179 0x95, 0x01, /* Report Count (1), */
180 0x80, /* Input, */
181 0x09, 0x32, /* Usage (In Range), */
182 0x14, /* Logical Minimum (0), */
183 0x25, 0x01, /* Logical Maximum (1), */
184 0x75, 0x01, /* Report Size (1), */
185 0x95, 0x01, /* Report Count (1), */
186 0x81, 0x02, /* Input (Variable), */
187 0x95, 0x03, /* Report Count (3), */
188 0x81, 0x03, /* Input (Constant, Variable), */
189 0x75, 0x10, /* Report Size (16), */
190 0x95, 0x01, /* Report Count (1), */
191 0x14, /* Logical Minimum (0), */
192 0xA4, /* Push, */
193 0x05, 0x01, /* Usage Page (Desktop), */
194 0x65, 0x13, /* Unit (Inch), */
195 0x55, 0xFD, /* Unit Exponent (-3), */
196 0x34, /* Physical Minimum (0), */
197 0x09, 0x30, /* Usage (X), */
198 0x46, 0x70, 0x17, /* Physical Maximum (6000), */
199 0x26, 0x00, 0x30, /* Logical Maximum (12288), */
200 0x81, 0x02, /* Input (Variable), */
201 0x09, 0x31, /* Usage (Y), */
202 0x46, 0x94, 0x11, /* Physical Maximum (4500), */
203 0x26, 0x00, 0x24, /* Logical Maximum (9216), */
204 0x81, 0x02, /* Input (Variable), */
205 0xB4, /* Pop, */
206 0x09, 0x30, /* Usage (Tip Pressure), */
207 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */
208 0x81, 0x02, /* Input (Variable), */
209 0xC0, /* End Collection, */
210 0xC0 /* End Collection */
211};
212
213/*
Nikolai Kondrashov56d27dd2012-03-06 09:54:23 +0200214 * See Media Tablet 10.6 inch description, device and HID report descriptors at
215 * http://sf.net/apps/mediawiki/digimend/?title=Waltop_Media_Tablet_10.6%22
Nikolai Kondrashov72a46342010-08-20 19:21:11 +0400216 */
217
218/* Size of the original report descriptor of Media Tablet 10.6 inch */
219#define MEDIA_TABLET_10_6_INCH_RDESC_ORIG_SIZE 300
220
Nikolai Kondrashov56d27dd2012-03-06 09:54:23 +0200221/* Fixed Media Tablet 10.6 inch descriptor */
Nikolai Kondrashov72a46342010-08-20 19:21:11 +0400222static __u8 media_tablet_10_6_inch_rdesc_fixed[] = {
223 0x05, 0x0D, /* Usage Page (Digitizer), */
224 0x09, 0x02, /* Usage (Pen), */
225 0xA1, 0x01, /* Collection (Application), */
226 0x85, 0x10, /* Report ID (16), */
227 0x09, 0x20, /* Usage (Stylus), */
228 0xA0, /* Collection (Physical), */
229 0x09, 0x42, /* Usage (Tip Switch), */
230 0x09, 0x44, /* Usage (Barrel Switch), */
231 0x09, 0x46, /* Usage (Tablet Pick), */
232 0x15, 0x01, /* Logical Minimum (1), */
233 0x25, 0x03, /* Logical Maximum (3), */
234 0x75, 0x04, /* Report Size (4), */
235 0x95, 0x01, /* Report Count (1), */
236 0x80, /* Input, */
237 0x75, 0x01, /* Report Size (1), */
238 0x09, 0x32, /* Usage (In Range), */
239 0x14, /* Logical Minimum (0), */
240 0x25, 0x01, /* Logical Maximum (1), */
241 0x95, 0x01, /* Report Count (1), */
242 0x81, 0x02, /* Input (Variable), */
243 0x95, 0x03, /* Report Count (3), */
244 0x81, 0x03, /* Input (Constant, Variable), */
245 0x75, 0x10, /* Report Size (16), */
246 0x95, 0x01, /* Report Count (1), */
247 0x14, /* Logical Minimum (0), */
248 0xA4, /* Push, */
249 0x05, 0x01, /* Usage Page (Desktop), */
250 0x65, 0x13, /* Unit (Inch), */
251 0x55, 0xFD, /* Unit Exponent (-3), */
252 0x34, /* Physical Minimum (0), */
253 0x09, 0x30, /* Usage (X), */
254 0x46, 0x28, 0x23, /* Physical Maximum (9000), */
255 0x26, 0x50, 0x46, /* Logical Maximum (18000), */
256 0x81, 0x02, /* Input (Variable), */
257 0x09, 0x31, /* Usage (Y), */
258 0x46, 0x7C, 0x15, /* Physical Maximum (5500), */
259 0x26, 0xF8, 0x2A, /* Logical Maximum (11000), */
260 0x81, 0x02, /* Input (Variable), */
261 0xB4, /* Pop, */
262 0x09, 0x30, /* Usage (Tip Pressure), */
263 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */
264 0x81, 0x02, /* Input (Variable), */
265 0xC0, /* End Collection, */
266 0xC0, /* End Collection, */
267 0x05, 0x01, /* Usage Page (Desktop), */
268 0x09, 0x02, /* Usage (Mouse), */
269 0xA1, 0x01, /* Collection (Application), */
270 0x85, 0x01, /* Report ID (1), */
271 0x09, 0x01, /* Usage (Pointer), */
272 0xA0, /* Collection (Physical), */
Nikolai Kondrashov4b5b45752010-08-30 14:06:35 +0400273 0x75, 0x08, /* Report Size (8), */
274 0x95, 0x03, /* Report Count (3), */
Nikolai Kondrashov72a46342010-08-20 19:21:11 +0400275 0x81, 0x03, /* Input (Constant, Variable), */
Nikolai Kondrashov4b5b45752010-08-30 14:06:35 +0400276 0x95, 0x02, /* Report Count (2), */
Nikolai Kondrashov72a46342010-08-20 19:21:11 +0400277 0x15, 0xFF, /* Logical Minimum (-1), */
278 0x25, 0x01, /* Logical Maximum (1), */
Nikolai Kondrashov4b5b45752010-08-30 14:06:35 +0400279 0x09, 0x38, /* Usage (Wheel), */
280 0x0B, 0x38, 0x02, /* Usage (Consumer AC Pan), */
281 0x0C, 0x00,
Nikolai Kondrashov72a46342010-08-20 19:21:11 +0400282 0x81, 0x06, /* Input (Variable, Relative), */
Nikolai Kondrashov4b5b45752010-08-30 14:06:35 +0400283 0x95, 0x02, /* Report Count (2), */
Nikolai Kondrashov72a46342010-08-20 19:21:11 +0400284 0x81, 0x03, /* Input (Constant, Variable), */
285 0xC0, /* End Collection, */
286 0xC0, /* End Collection, */
287 0x05, 0x0C, /* Usage Page (Consumer), */
288 0x09, 0x01, /* Usage (Consumer Control), */
289 0xA1, 0x01, /* Collection (Application), */
290 0x85, 0x0D, /* Report ID (13), */
291 0x95, 0x01, /* Report Count (1), */
292 0x75, 0x10, /* Report Size (16), */
293 0x81, 0x03, /* Input (Constant, Variable), */
294 0x0A, 0x2F, 0x02, /* Usage (AC Zoom), */
295 0x0A, 0x2E, 0x02, /* Usage (AC Zoom Out), */
296 0x0A, 0x2D, 0x02, /* Usage (AC Zoom In), */
297 0x09, 0xB6, /* Usage (Scan Previous Track), */
298 0x09, 0xB5, /* Usage (Scan Next Track), */
Nikolai Kondrashov30311542010-08-30 14:06:37 +0400299 0x08, /* Usage (00h), */
300 0x08, /* Usage (00h), */
301 0x08, /* Usage (00h), */
302 0x08, /* Usage (00h), */
303 0x08, /* Usage (00h), */
304 0x0A, 0x2E, 0x02, /* Usage (AC Zoom Out), */
305 0x0A, 0x2D, 0x02, /* Usage (AC Zoom In), */
306 0x15, 0x0C, /* Logical Minimum (12), */
307 0x25, 0x17, /* Logical Maximum (23), */
308 0x75, 0x05, /* Report Size (5), */
Nikolai Kondrashov72a46342010-08-20 19:21:11 +0400309 0x80, /* Input, */
Nikolai Kondrashov30311542010-08-30 14:06:37 +0400310 0x75, 0x03, /* Report Size (3), */
311 0x81, 0x03, /* Input (Constant, Variable), */
Nikolai Kondrashov72a46342010-08-20 19:21:11 +0400312 0x75, 0x20, /* Report Size (32), */
313 0x81, 0x03, /* Input (Constant, Variable), */
314 0xC0, /* End Collection, */
315 0x09, 0x01, /* Usage (Consumer Control), */
316 0xA1, 0x01, /* Collection (Application), */
317 0x85, 0x0C, /* Report ID (12), */
318 0x75, 0x01, /* Report Size (1), */
319 0x09, 0xE9, /* Usage (Volume Inc), */
320 0x09, 0xEA, /* Usage (Volume Dec), */
321 0x09, 0xE2, /* Usage (Mute), */
322 0x14, /* Logical Minimum (0), */
323 0x25, 0x01, /* Logical Maximum (1), */
324 0x95, 0x03, /* Report Count (3), */
325 0x81, 0x06, /* Input (Variable, Relative), */
326 0x95, 0x35, /* Report Count (53), */
327 0x81, 0x03, /* Input (Constant, Variable), */
328 0xC0 /* End Collection */
329};
330
Nikolai Kondrashov8f1acc32010-08-30 14:06:36 +0400331/*
Nikolai Kondrashov56d27dd2012-03-06 09:54:23 +0200332 * See Media Tablet 14.1 inch description, device and HID report descriptors at
333 * http://sf.net/apps/mediawiki/digimend/?title=Waltop_Media_Tablet_14.1%22
Nikolai Kondrashov8f1acc32010-08-30 14:06:36 +0400334 */
335
336/* Size of the original report descriptor of Media Tablet 14.1 inch */
337#define MEDIA_TABLET_14_1_INCH_RDESC_ORIG_SIZE 309
338
Nikolai Kondrashov56d27dd2012-03-06 09:54:23 +0200339/* Fixed Media Tablet 14.1 inch descriptor */
Nikolai Kondrashov8f1acc32010-08-30 14:06:36 +0400340static __u8 media_tablet_14_1_inch_rdesc_fixed[] = {
341 0x05, 0x0D, /* Usage Page (Digitizer), */
342 0x09, 0x02, /* Usage (Pen), */
343 0xA1, 0x01, /* Collection (Application), */
344 0x85, 0x10, /* Report ID (16), */
345 0x09, 0x20, /* Usage (Stylus), */
346 0xA0, /* Collection (Physical), */
347 0x09, 0x42, /* Usage (Tip Switch), */
348 0x09, 0x44, /* Usage (Barrel Switch), */
349 0x09, 0x46, /* Usage (Tablet Pick), */
350 0x15, 0x01, /* Logical Minimum (1), */
351 0x25, 0x03, /* Logical Maximum (3), */
352 0x75, 0x04, /* Report Size (4), */
353 0x95, 0x01, /* Report Count (1), */
354 0x80, /* Input, */
355 0x75, 0x01, /* Report Size (1), */
356 0x09, 0x32, /* Usage (In Range), */
357 0x14, /* Logical Minimum (0), */
358 0x25, 0x01, /* Logical Maximum (1), */
359 0x95, 0x01, /* Report Count (1), */
360 0x81, 0x02, /* Input (Variable), */
361 0x95, 0x03, /* Report Count (3), */
362 0x81, 0x03, /* Input (Constant, Variable), */
363 0x75, 0x10, /* Report Size (16), */
364 0x95, 0x01, /* Report Count (1), */
365 0x14, /* Logical Minimum (0), */
366 0xA4, /* Push, */
367 0x05, 0x01, /* Usage Page (Desktop), */
368 0x65, 0x13, /* Unit (Inch), */
369 0x55, 0xFD, /* Unit Exponent (-3), */
370 0x34, /* Physical Minimum (0), */
371 0x09, 0x30, /* Usage (X), */
372 0x46, 0xE0, 0x2E, /* Physical Maximum (12000), */
373 0x26, 0xFF, 0x3F, /* Logical Maximum (16383), */
374 0x81, 0x02, /* Input (Variable), */
375 0x09, 0x31, /* Usage (Y), */
376 0x46, 0x52, 0x1C, /* Physical Maximum (7250), */
377 0x26, 0xFF, 0x3F, /* Logical Maximum (16383), */
378 0x81, 0x02, /* Input (Variable), */
379 0xB4, /* Pop, */
380 0x09, 0x30, /* Usage (Tip Pressure), */
381 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */
382 0x81, 0x02, /* Input (Variable), */
383 0xC0, /* End Collection, */
384 0xC0, /* End Collection, */
385 0x05, 0x01, /* Usage Page (Desktop), */
386 0x09, 0x02, /* Usage (Mouse), */
387 0xA1, 0x01, /* Collection (Application), */
388 0x85, 0x01, /* Report ID (1), */
389 0x09, 0x01, /* Usage (Pointer), */
390 0xA0, /* Collection (Physical), */
391 0x75, 0x08, /* Report Size (8), */
392 0x95, 0x03, /* Report Count (3), */
393 0x81, 0x03, /* Input (Constant, Variable), */
394 0x95, 0x02, /* Report Count (2), */
395 0x15, 0xFF, /* Logical Minimum (-1), */
396 0x25, 0x01, /* Logical Maximum (1), */
397 0x09, 0x38, /* Usage (Wheel), */
398 0x0B, 0x38, 0x02, /* Usage (Consumer AC Pan), */
399 0x0C, 0x00,
400 0x81, 0x06, /* Input (Variable, Relative), */
401 0xC0, /* End Collection, */
402 0xC0, /* End Collection, */
403 0x05, 0x0C, /* Usage Page (Consumer), */
404 0x09, 0x01, /* Usage (Consumer Control), */
405 0xA1, 0x01, /* Collection (Application), */
406 0x85, 0x0D, /* Report ID (13), */
407 0x95, 0x01, /* Report Count (1), */
408 0x75, 0x10, /* Report Size (16), */
409 0x81, 0x03, /* Input (Constant, Variable), */
410 0x0A, 0x2F, 0x02, /* Usage (AC Zoom), */
411 0x0A, 0x2E, 0x02, /* Usage (AC Zoom Out), */
412 0x0A, 0x2D, 0x02, /* Usage (AC Zoom In), */
413 0x09, 0xB6, /* Usage (Scan Previous Track), */
414 0x09, 0xB5, /* Usage (Scan Next Track), */
415 0x08, /* Usage (00h), */
416 0x08, /* Usage (00h), */
417 0x08, /* Usage (00h), */
418 0x08, /* Usage (00h), */
419 0x08, /* Usage (00h), */
420 0x0A, 0x2E, 0x02, /* Usage (AC Zoom Out), */
421 0x0A, 0x2D, 0x02, /* Usage (AC Zoom In), */
422 0x15, 0x0C, /* Logical Minimum (12), */
423 0x25, 0x17, /* Logical Maximum (23), */
424 0x75, 0x05, /* Report Size (5), */
425 0x80, /* Input, */
426 0x75, 0x03, /* Report Size (3), */
427 0x81, 0x03, /* Input (Constant, Variable), */
428 0x75, 0x20, /* Report Size (32), */
429 0x81, 0x03, /* Input (Constant, Variable), */
430 0xC0, /* End Collection, */
431 0x09, 0x01, /* Usage (Consumer Control), */
432 0xA1, 0x01, /* Collection (Application), */
433 0x85, 0x0C, /* Report ID (12), */
434 0x75, 0x01, /* Report Size (1), */
435 0x09, 0xE9, /* Usage (Volume Inc), */
436 0x09, 0xEA, /* Usage (Volume Dec), */
437 0x09, 0xE2, /* Usage (Mute), */
438 0x14, /* Logical Minimum (0), */
439 0x25, 0x01, /* Logical Maximum (1), */
440 0x95, 0x03, /* Report Count (3), */
441 0x81, 0x06, /* Input (Variable, Relative), */
442 0x75, 0x05, /* Report Size (5), */
443 0x81, 0x03, /* Input (Constant, Variable), */
444 0xC0 /* End Collection */
445};
446
Nikolai Kondrashov72a46342010-08-20 19:21:11 +0400447static __u8 *waltop_report_fixup(struct hid_device *hdev, __u8 *rdesc,
448 unsigned int *rsize)
449{
450 switch (hdev->product) {
451 case USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH:
452 if (*rsize == SLIM_TABLET_5_8_INCH_RDESC_ORIG_SIZE) {
453 rdesc = slim_tablet_5_8_inch_rdesc_fixed;
454 *rsize = sizeof(slim_tablet_5_8_inch_rdesc_fixed);
455 }
456 break;
Nikolai Kondrashov00e7f962010-09-25 23:16:58 +0400457 case USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH:
458 if (*rsize == SLIM_TABLET_12_1_INCH_RDESC_ORIG_SIZE) {
459 rdesc = slim_tablet_12_1_inch_rdesc_fixed;
460 *rsize = sizeof(slim_tablet_12_1_inch_rdesc_fixed);
461 }
462 break;
Nikolai Kondrashov4fdc18d2012-02-06 22:54:20 +0200463 case USB_DEVICE_ID_WALTOP_Q_PAD:
464 if (*rsize == Q_PAD_RDESC_ORIG_SIZE) {
465 rdesc = q_pad_rdesc_fixed;
466 *rsize = sizeof(q_pad_rdesc_fixed);
467 }
468 break;
Nikolai Kondrashov72a46342010-08-20 19:21:11 +0400469 case USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH:
470 if (*rsize == MEDIA_TABLET_10_6_INCH_RDESC_ORIG_SIZE) {
471 rdesc = media_tablet_10_6_inch_rdesc_fixed;
472 *rsize = sizeof(media_tablet_10_6_inch_rdesc_fixed);
473 }
474 break;
Nikolai Kondrashov8f1acc32010-08-30 14:06:36 +0400475 case USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH:
476 if (*rsize == MEDIA_TABLET_14_1_INCH_RDESC_ORIG_SIZE) {
477 rdesc = media_tablet_14_1_inch_rdesc_fixed;
478 *rsize = sizeof(media_tablet_14_1_inch_rdesc_fixed);
479 }
480 break;
Nikolai Kondrashov72a46342010-08-20 19:21:11 +0400481 }
482 return rdesc;
483}
484
485static const struct hid_device_id waltop_devices[] = {
486 { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP,
487 USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH) },
488 { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP,
Nikolai Kondrashov00e7f962010-09-25 23:16:58 +0400489 USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH) },
490 { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP,
Nikolai Kondrashov4fdc18d2012-02-06 22:54:20 +0200491 USB_DEVICE_ID_WALTOP_Q_PAD) },
492 { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP,
Nikolai Kondrashov72a46342010-08-20 19:21:11 +0400493 USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH) },
Nikolai Kondrashov8f1acc32010-08-30 14:06:36 +0400494 { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP,
495 USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH) },
Nikolai Kondrashov72a46342010-08-20 19:21:11 +0400496 { }
497};
498MODULE_DEVICE_TABLE(hid, waltop_devices);
499
500static struct hid_driver waltop_driver = {
501 .name = "waltop",
502 .id_table = waltop_devices,
503 .report_fixup = waltop_report_fixup,
504};
505
506static int __init waltop_init(void)
507{
508 return hid_register_driver(&waltop_driver);
509}
510
511static void __exit waltop_exit(void)
512{
513 hid_unregister_driver(&waltop_driver);
514}
515
516module_init(waltop_init);
517module_exit(waltop_exit);
518MODULE_LICENSE("GPL");