1
2
3
4
5
6
7
8
9
10
11
12
13
14
15#include "wacom_wac.h"
16#include "wacom.h"
17#include <linux/input/mt.h>
18#include <linux/hid.h>
19
20
21#define WACOM_PL_RES 20
22#define WACOM_PENPRTN_RES 40
23#define WACOM_VOLITO_RES 50
24#define WACOM_GRAPHIRE_RES 80
25#define WACOM_INTUOS_RES 100
26#define WACOM_INTUOS3_RES 200
27
28
29#define WACOM_DTU_OFFSET 200
30#define WACOM_CINTIQ_OFFSET 400
31
32
33
34
35#define WACOM_CONTACT_AREA_SCALE 2607
36
37static int wacom_penpartner_irq(struct wacom_wac *wacom)
38{
39 unsigned char *data = wacom->data;
40 struct input_dev *input = wacom->input;
41
42 switch (data[0]) {
43 case 1:
44 if (data[5] & 0x80) {
45 wacom->tool[0] = (data[5] & 0x20) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN;
46 wacom->id[0] = (data[5] & 0x20) ? ERASER_DEVICE_ID : STYLUS_DEVICE_ID;
47 input_report_key(input, wacom->tool[0], 1);
48 input_report_abs(input, ABS_MISC, wacom->id[0]);
49 input_report_abs(input, ABS_X, get_unaligned_le16(&data[1]));
50 input_report_abs(input, ABS_Y, get_unaligned_le16(&data[3]));
51 input_report_abs(input, ABS_PRESSURE, (signed char)data[6] + 127);
52 input_report_key(input, BTN_TOUCH, ((signed char)data[6] > -127));
53 input_report_key(input, BTN_STYLUS, (data[5] & 0x40));
54 } else {
55 input_report_key(input, wacom->tool[0], 0);
56 input_report_abs(input, ABS_MISC, 0);
57 input_report_abs(input, ABS_PRESSURE, -1);
58 input_report_key(input, BTN_TOUCH, 0);
59 }
60 break;
61
62 case 2:
63 input_report_key(input, BTN_TOOL_PEN, 1);
64 input_report_abs(input, ABS_MISC, STYLUS_DEVICE_ID);
65 input_report_abs(input, ABS_X, get_unaligned_le16(&data[1]));
66 input_report_abs(input, ABS_Y, get_unaligned_le16(&data[3]));
67 input_report_abs(input, ABS_PRESSURE, (signed char)data[6] + 127);
68 input_report_key(input, BTN_TOUCH, ((signed char)data[6] > -80) && !(data[5] & 0x20));
69 input_report_key(input, BTN_STYLUS, (data[5] & 0x40));
70 break;
71
72 default:
73 dev_dbg(input->dev.parent,
74 "%s: received unknown report #%d\n", __func__, data[0]);
75 return 0;
76 }
77
78 return 1;
79}
80
81static int wacom_pl_irq(struct wacom_wac *wacom)
82{
83 struct wacom_features *features = &wacom->features;
84 unsigned char *data = wacom->data;
85 struct input_dev *input = wacom->input;
86 int prox, pressure;
87
88 if (data[0] != WACOM_REPORT_PENABLED) {
89 dev_dbg(input->dev.parent,
90 "%s: received unknown report #%d\n", __func__, data[0]);
91 return 0;
92 }
93
94 prox = data[1] & 0x40;
95
96 if (prox) {
97 wacom->id[0] = ERASER_DEVICE_ID;
98 pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1));
99 if (features->pressure_max > 255)
100 pressure = (pressure << 1) | ((data[4] >> 6) & 1);
101 pressure += (features->pressure_max + 1) / 2;
102
103
104
105
106
107
108
109 if (!wacom->tool[0]) {
110
111 if (data[1] & 0x10)
112 wacom->tool[1] = BTN_TOOL_RUBBER;
113 else
114
115 wacom->tool[1] = (data[4] & 0x20) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN;
116 } else {
117
118 if (wacom->tool[1] == BTN_TOOL_RUBBER && !(data[4] & 0x20)) {
119
120 input_report_key(input, wacom->tool[1], 0);
121 input_sync(input);
122 wacom->tool[1] = BTN_TOOL_PEN;
123 return 0;
124 }
125 }
126 if (wacom->tool[1] != BTN_TOOL_RUBBER) {
127
128 wacom->tool[1] = BTN_TOOL_PEN;
129 wacom->id[0] = STYLUS_DEVICE_ID;
130 }
131 input_report_key(input, wacom->tool[1], prox);
132 input_report_abs(input, ABS_MISC, wacom->id[0]);
133 input_report_abs(input, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14));
134 input_report_abs(input, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14));
135 input_report_abs(input, ABS_PRESSURE, pressure);
136
137 input_report_key(input, BTN_TOUCH, data[4] & 0x08);
138 input_report_key(input, BTN_STYLUS, data[4] & 0x10);
139
140 input_report_key(input, BTN_STYLUS2, (wacom->tool[1] == BTN_TOOL_PEN) && (data[4] & 0x20));
141 } else {
142
143 if (wacom->tool[1] != BTN_TOOL_RUBBER) {
144
145 wacom->tool[1] = BTN_TOOL_PEN;
146 }
147 input_report_key(input, wacom->tool[1], prox);
148 }
149
150 wacom->tool[0] = prox;
151 return 1;
152}
153
154static int wacom_ptu_irq(struct wacom_wac *wacom)
155{
156 unsigned char *data = wacom->data;
157 struct input_dev *input = wacom->input;
158
159 if (data[0] != WACOM_REPORT_PENABLED) {
160 dev_dbg(input->dev.parent,
161 "%s: received unknown report #%d\n", __func__, data[0]);
162 return 0;
163 }
164
165 if (data[1] & 0x04) {
166 input_report_key(input, BTN_TOOL_RUBBER, data[1] & 0x20);
167 input_report_key(input, BTN_TOUCH, data[1] & 0x08);
168 wacom->id[0] = ERASER_DEVICE_ID;
169 } else {
170 input_report_key(input, BTN_TOOL_PEN, data[1] & 0x20);
171 input_report_key(input, BTN_TOUCH, data[1] & 0x01);
172 wacom->id[0] = STYLUS_DEVICE_ID;
173 }
174 input_report_abs(input, ABS_MISC, wacom->id[0]);
175 input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2]));
176 input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4]));
177 input_report_abs(input, ABS_PRESSURE, le16_to_cpup((__le16 *)&data[6]));
178 input_report_key(input, BTN_STYLUS, data[1] & 0x02);
179 input_report_key(input, BTN_STYLUS2, data[1] & 0x10);
180 return 1;
181}
182
183static int wacom_dtu_irq(struct wacom_wac *wacom)
184{
185 struct wacom_features *features = &wacom->features;
186 char *data = wacom->data;
187 struct input_dev *input = wacom->input;
188 int prox = data[1] & 0x20, pressure;
189
190 dev_dbg(input->dev.parent,
191 "%s: received report #%d", __func__, data[0]);
192
193 if (prox) {
194
195 wacom->tool[0] = (data[1] & 0x0c) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN;
196 if (wacom->tool[0] == BTN_TOOL_PEN)
197 wacom->id[0] = STYLUS_DEVICE_ID;
198 else
199 wacom->id[0] = ERASER_DEVICE_ID;
200 }
201 input_report_key(input, BTN_STYLUS, data[1] & 0x02);
202 input_report_key(input, BTN_STYLUS2, data[1] & 0x10);
203 input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2]));
204 input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4]));
205 pressure = ((data[7] & 0x01) << 8) | data[6];
206 if (pressure < 0)
207 pressure = features->pressure_max + pressure + 1;
208 input_report_abs(input, ABS_PRESSURE, pressure);
209 input_report_key(input, BTN_TOUCH, data[1] & 0x05);
210 if (!prox)
211 wacom->id[0] = 0;
212 input_report_key(input, wacom->tool[0], prox);
213 input_report_abs(input, ABS_MISC, wacom->id[0]);
214 return 1;
215}
216
217static int wacom_graphire_irq(struct wacom_wac *wacom)
218{
219 struct wacom_features *features = &wacom->features;
220 unsigned char *data = wacom->data;
221 struct input_dev *input = wacom->input;
222 int prox;
223 int rw = 0;
224 int retval = 0;
225
226 if (data[0] != WACOM_REPORT_PENABLED) {
227 dev_dbg(input->dev.parent,
228 "%s: received unknown report #%d\n", __func__, data[0]);
229 goto exit;
230 }
231
232 prox = data[1] & 0x80;
233 if (prox || wacom->id[0]) {
234 if (prox) {
235 switch ((data[1] >> 5) & 3) {
236
237 case 0:
238 wacom->tool[0] = BTN_TOOL_PEN;
239 wacom->id[0] = STYLUS_DEVICE_ID;
240 break;
241
242 case 1:
243 wacom->tool[0] = BTN_TOOL_RUBBER;
244 wacom->id[0] = ERASER_DEVICE_ID;
245 break;
246
247 case 2:
248 input_report_key(input, BTN_MIDDLE, data[1] & 0x04);
249
250
251 case 3:
252 wacom->tool[0] = BTN_TOOL_MOUSE;
253 wacom->id[0] = CURSOR_DEVICE_ID;
254 break;
255 }
256 }
257 input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2]));
258 input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4]));
259 if (wacom->tool[0] != BTN_TOOL_MOUSE) {
260 input_report_abs(input, ABS_PRESSURE, data[6] | ((data[7] & 0x03) << 8));
261 input_report_key(input, BTN_TOUCH, data[1] & 0x01);
262 input_report_key(input, BTN_STYLUS, data[1] & 0x02);
263 input_report_key(input, BTN_STYLUS2, data[1] & 0x04);
264 } else {
265 input_report_key(input, BTN_LEFT, data[1] & 0x01);
266 input_report_key(input, BTN_RIGHT, data[1] & 0x02);
267 if (features->type == WACOM_G4 ||
268 features->type == WACOM_MO) {
269 input_report_abs(input, ABS_DISTANCE, data[6] & 0x3f);
270 rw = (data[7] & 0x04) - (data[7] & 0x03);
271 } else {
272 input_report_abs(input, ABS_DISTANCE, data[7] & 0x3f);
273 rw = -(signed char)data[6];
274 }
275 input_report_rel(input, REL_WHEEL, rw);
276 }
277
278 if (!prox)
279 wacom->id[0] = 0;
280 input_report_abs(input, ABS_MISC, wacom->id[0]);
281 input_report_key(input, wacom->tool[0], prox);
282 input_event(input, EV_MSC, MSC_SERIAL, 1);
283 input_sync(input);
284 }
285
286
287 switch (features->type) {
288 case WACOM_G4:
289 prox = data[7] & 0xf8;
290 if (prox || wacom->id[1]) {
291 wacom->id[1] = PAD_DEVICE_ID;
292 input_report_key(input, BTN_BACK, (data[7] & 0x40));
293 input_report_key(input, BTN_FORWARD, (data[7] & 0x80));
294 rw = ((data[7] & 0x18) >> 3) - ((data[7] & 0x20) >> 3);
295 input_report_rel(input, REL_WHEEL, rw);
296 if (!prox)
297 wacom->id[1] = 0;
298 input_report_abs(input, ABS_MISC, wacom->id[1]);
299 input_event(input, EV_MSC, MSC_SERIAL, 0xf0);
300 retval = 1;
301 }
302 break;
303
304 case WACOM_MO:
305 prox = (data[7] & 0xf8) || data[8];
306 if (prox || wacom->id[1]) {
307 wacom->id[1] = PAD_DEVICE_ID;
308 input_report_key(input, BTN_BACK, (data[7] & 0x08));
309 input_report_key(input, BTN_LEFT, (data[7] & 0x20));
310 input_report_key(input, BTN_FORWARD, (data[7] & 0x10));
311 input_report_key(input, BTN_RIGHT, (data[7] & 0x40));
312 input_report_abs(input, ABS_WHEEL, (data[8] & 0x7f));
313 if (!prox)
314 wacom->id[1] = 0;
315 input_report_abs(input, ABS_MISC, wacom->id[1]);
316 input_event(input, EV_MSC, MSC_SERIAL, 0xf0);
317 retval = 1;
318 }
319 break;
320 }
321exit:
322 return retval;
323}
324
325static int wacom_intuos_inout(struct wacom_wac *wacom)
326{
327 struct wacom_features *features = &wacom->features;
328 unsigned char *data = wacom->data;
329 struct input_dev *input = wacom->input;
330 int idx = 0;
331
332
333 if (features->type == INTUOS)
334 idx = data[1] & 0x01;
335
336
337 if ((data[1] & 0xfc) == 0xc0) {
338 if (features->quirks == WACOM_QUIRK_MULTI_INPUT)
339 wacom->shared->stylus_in_proximity = true;
340
341
342 wacom->serial[idx] = ((data[3] & 0x0f) << 28) +
343 (data[4] << 20) + (data[5] << 12) +
344 (data[6] << 4) + (data[7] >> 4);
345
346 wacom->id[idx] = (data[2] << 4) | (data[3] >> 4) |
347 ((data[7] & 0x0f) << 20) | ((data[8] & 0xf0) << 12);
348
349 switch (wacom->id[idx]) {
350 case 0x812:
351 case 0x801:
352 case 0x120802:
353 case 0x012:
354 wacom->tool[idx] = BTN_TOOL_PENCIL;
355 break;
356
357 case 0x822:
358 case 0x842:
359 case 0x852:
360 case 0x823:
361 case 0x813:
362 case 0x885:
363 case 0x802:
364 case 0x804:
365 case 0x022:
366 case 0x100804:
367 case 0x140802:
368 case 0x160802:
369 case 0x180802:
370 case 0x100802:
371 wacom->tool[idx] = BTN_TOOL_PEN;
372 break;
373
374 case 0x832:
375 case 0x032:
376 wacom->tool[idx] = BTN_TOOL_BRUSH;
377 break;
378
379 case 0x007:
380 case 0x09c:
381 case 0x094:
382 case 0x017:
383 case 0x806:
384 wacom->tool[idx] = BTN_TOOL_MOUSE;
385 break;
386
387 case 0x096:
388 case 0x097:
389 case 0x006:
390 wacom->tool[idx] = BTN_TOOL_LENS;
391 break;
392
393 case 0x82a:
394 case 0x85a:
395 case 0x91a:
396 case 0xd1a:
397 case 0x0fa:
398 case 0x82b:
399 case 0x81b:
400 case 0x91b:
401 case 0x80c:
402 case 0x80a:
403 case 0x90a:
404 case 0x14080a:
405 case 0x10090a:
406 case 0x10080c:
407 case 0x16080a:
408 case 0x18080a:
409 case 0x10080a:
410 wacom->tool[idx] = BTN_TOOL_RUBBER;
411 break;
412
413 case 0xd12:
414 case 0x912:
415 case 0x112:
416 case 0x913:
417 case 0x902:
418 case 0x100902:
419 wacom->tool[idx] = BTN_TOOL_AIRBRUSH;
420 break;
421
422 default:
423 wacom->tool[idx] = BTN_TOOL_PEN;
424 break;
425 }
426 return 1;
427 }
428
429
430 if (!((wacom->id[idx] >> 20) & 0x01) &&
431 (features->type == WACOM_21UX2))
432 return 1;
433
434
435 if ((data[1] & 0xfe) == 0x20) {
436 input_report_key(input, BTN_TOUCH, 0);
437 input_report_abs(input, ABS_PRESSURE, 0);
438 input_report_abs(input, ABS_DISTANCE, wacom->features.distance_max);
439 }
440
441
442 if ((data[1] & 0xfe) == 0x80) {
443 if (features->quirks == WACOM_QUIRK_MULTI_INPUT)
444 wacom->shared->stylus_in_proximity = false;
445
446
447
448
449
450 input_report_abs(input, ABS_X, 0);
451 input_report_abs(input, ABS_Y, 0);
452 input_report_abs(input, ABS_DISTANCE, 0);
453 input_report_abs(input, ABS_TILT_X, 0);
454 input_report_abs(input, ABS_TILT_Y, 0);
455 if (wacom->tool[idx] >= BTN_TOOL_MOUSE) {
456 input_report_key(input, BTN_LEFT, 0);
457 input_report_key(input, BTN_MIDDLE, 0);
458 input_report_key(input, BTN_RIGHT, 0);
459 input_report_key(input, BTN_SIDE, 0);
460 input_report_key(input, BTN_EXTRA, 0);
461 input_report_abs(input, ABS_THROTTLE, 0);
462 input_report_abs(input, ABS_RZ, 0);
463 } else {
464 input_report_abs(input, ABS_PRESSURE, 0);
465 input_report_key(input, BTN_STYLUS, 0);
466 input_report_key(input, BTN_STYLUS2, 0);
467 input_report_key(input, BTN_TOUCH, 0);
468 input_report_abs(input, ABS_WHEEL, 0);
469 if (features->type >= INTUOS3S)
470 input_report_abs(input, ABS_Z, 0);
471 }
472 input_report_key(input, wacom->tool[idx], 0);
473 input_report_abs(input, ABS_MISC, 0);
474 input_event(input, EV_MSC, MSC_SERIAL, wacom->serial[idx]);
475 wacom->id[idx] = 0;
476 return 2;
477 }
478 return 0;
479}
480
481static void wacom_intuos_general(struct wacom_wac *wacom)
482{
483 struct wacom_features *features = &wacom->features;
484 unsigned char *data = wacom->data;
485 struct input_dev *input = wacom->input;
486 unsigned int t;
487
488
489 if ((data[1] & 0xb8) == 0xa0) {
490 t = (data[6] << 2) | ((data[7] >> 6) & 3);
491 if (features->type >= INTUOS4S && features->type <= WACOM_24HD) {
492 t = (t << 1) | (data[1] & 1);
493 }
494 input_report_abs(input, ABS_PRESSURE, t);
495 input_report_abs(input, ABS_TILT_X,
496 ((data[7] << 1) & 0x7e) | (data[8] >> 7));
497 input_report_abs(input, ABS_TILT_Y, data[8] & 0x7f);
498 input_report_key(input, BTN_STYLUS, data[1] & 2);
499 input_report_key(input, BTN_STYLUS2, data[1] & 4);
500 input_report_key(input, BTN_TOUCH, t > 10);
501 }
502
503
504 if ((data[1] & 0xbc) == 0xb4) {
505 input_report_abs(input, ABS_WHEEL,
506 (data[6] << 2) | ((data[7] >> 6) & 3));
507 input_report_abs(input, ABS_TILT_X,
508 ((data[7] << 1) & 0x7e) | (data[8] >> 7));
509 input_report_abs(input, ABS_TILT_Y, data[8] & 0x7f);
510 }
511}
512
513static int wacom_intuos_irq(struct wacom_wac *wacom)
514{
515 struct wacom_features *features = &wacom->features;
516 unsigned char *data = wacom->data;
517 struct input_dev *input = wacom->input;
518 unsigned int t;
519 int idx = 0, result;
520
521 if (data[0] != WACOM_REPORT_PENABLED &&
522 data[0] != WACOM_REPORT_INTUOSREAD &&
523 data[0] != WACOM_REPORT_INTUOSWRITE &&
524 data[0] != WACOM_REPORT_INTUOSPAD &&
525 data[0] != WACOM_REPORT_CINTIQ &&
526 data[0] != WACOM_REPORT_CINTIQPAD &&
527 data[0] != WACOM_REPORT_INTUOS5PAD) {
528 dev_dbg(input->dev.parent,
529 "%s: received unknown report #%d\n", __func__, data[0]);
530 return 0;
531 }
532
533
534 if (features->type == INTUOS)
535 idx = data[1] & 0x01;
536
537
538 if (data[0] == WACOM_REPORT_INTUOSPAD || data[0] == WACOM_REPORT_INTUOS5PAD ||
539 data[0] == WACOM_REPORT_CINTIQPAD) {
540 if (features->type >= INTUOS4S && features->type <= INTUOS4L) {
541 input_report_key(input, BTN_0, (data[2] & 0x01));
542 input_report_key(input, BTN_1, (data[3] & 0x01));
543 input_report_key(input, BTN_2, (data[3] & 0x02));
544 input_report_key(input, BTN_3, (data[3] & 0x04));
545 input_report_key(input, BTN_4, (data[3] & 0x08));
546 input_report_key(input, BTN_5, (data[3] & 0x10));
547 input_report_key(input, BTN_6, (data[3] & 0x20));
548 if (data[1] & 0x80) {
549 input_report_abs(input, ABS_WHEEL, (data[1] & 0x7f));
550 } else {
551
552 input_report_abs(input, ABS_WHEEL, 0);
553 }
554 if (features->type != INTUOS4S) {
555 input_report_key(input, BTN_7, (data[3] & 0x40));
556 input_report_key(input, BTN_8, (data[3] & 0x80));
557 }
558 if (data[1] | (data[2] & 0x01) | data[3]) {
559 input_report_abs(input, ABS_MISC, PAD_DEVICE_ID);
560 } else {
561 input_report_abs(input, ABS_MISC, 0);
562 }
563 } else if (features->type == DTK) {
564 input_report_key(input, BTN_0, (data[6] & 0x01));
565 input_report_key(input, BTN_1, (data[6] & 0x02));
566 input_report_key(input, BTN_2, (data[6] & 0x04));
567 input_report_key(input, BTN_3, (data[6] & 0x08));
568 input_report_key(input, BTN_4, (data[6] & 0x10));
569 input_report_key(input, BTN_5, (data[6] & 0x20));
570 if (data[6] & 0x3f) {
571 input_report_abs(input, ABS_MISC, PAD_DEVICE_ID);
572 } else {
573 input_report_abs(input, ABS_MISC, 0);
574 }
575 } else if (features->type == WACOM_13HD) {
576 input_report_key(input, BTN_0, (data[3] & 0x01));
577 input_report_key(input, BTN_1, (data[4] & 0x01));
578 input_report_key(input, BTN_2, (data[4] & 0x02));
579 input_report_key(input, BTN_3, (data[4] & 0x04));
580 input_report_key(input, BTN_4, (data[4] & 0x08));
581 input_report_key(input, BTN_5, (data[4] & 0x10));
582 input_report_key(input, BTN_6, (data[4] & 0x20));
583 input_report_key(input, BTN_7, (data[4] & 0x40));
584 input_report_key(input, BTN_8, (data[4] & 0x80));
585 if ((data[3] & 0x01) | data[4]) {
586 input_report_abs(input, ABS_MISC, PAD_DEVICE_ID);
587 } else {
588 input_report_abs(input, ABS_MISC, 0);
589 }
590 } else if (features->type == WACOM_24HD) {
591 input_report_key(input, BTN_0, (data[6] & 0x01));
592 input_report_key(input, BTN_1, (data[6] & 0x02));
593 input_report_key(input, BTN_2, (data[6] & 0x04));
594 input_report_key(input, BTN_3, (data[6] & 0x08));
595 input_report_key(input, BTN_4, (data[6] & 0x10));
596 input_report_key(input, BTN_5, (data[6] & 0x20));
597 input_report_key(input, BTN_6, (data[6] & 0x40));
598 input_report_key(input, BTN_7, (data[6] & 0x80));
599 input_report_key(input, BTN_8, (data[8] & 0x01));
600 input_report_key(input, BTN_9, (data[8] & 0x02));
601 input_report_key(input, BTN_A, (data[8] & 0x04));
602 input_report_key(input, BTN_B, (data[8] & 0x08));
603 input_report_key(input, BTN_C, (data[8] & 0x10));
604 input_report_key(input, BTN_X, (data[8] & 0x20));
605 input_report_key(input, BTN_Y, (data[8] & 0x40));
606 input_report_key(input, BTN_Z, (data[8] & 0x80));
607
608
609
610
611
612
613
614
615 input_report_key(input, KEY_PROG1, data[4] & 0x07);
616 input_report_key(input, KEY_PROG2, data[4] & 0xE0);
617 input_report_key(input, KEY_PROG3, data[3] & 0x1C);
618
619 if (data[1] & 0x80) {
620 input_report_abs(input, ABS_WHEEL, (data[1] & 0x7f));
621 } else {
622
623 input_report_abs(input, ABS_WHEEL, 0);
624 }
625
626 if (data[2] & 0x80) {
627 input_report_abs(input, ABS_THROTTLE, (data[2] & 0x7f));
628 } else {
629
630 input_report_abs(input, ABS_THROTTLE, 0);
631 }
632
633 if (data[1] | data[2] | (data[3] & 0x1f) | data[4] | data[6] | data[8]) {
634 input_report_abs(input, ABS_MISC, PAD_DEVICE_ID);
635 } else {
636 input_report_abs(input, ABS_MISC, 0);
637 }
638 } else if (features->type == WACOM_27QHD) {
639 input_report_key(input, KEY_PROG1, data[2] & 0x01);
640 input_report_key(input, KEY_PROG2, data[2] & 0x02);
641 input_report_key(input, KEY_PROG3, data[2] & 0x04);
642
643 input_report_abs(input, ABS_X, be16_to_cpup((__be16 *)&data[4]));
644 input_report_abs(input, ABS_Y, be16_to_cpup((__be16 *)&data[6]));
645 input_report_abs(input, ABS_Z, be16_to_cpup((__be16 *)&data[8]));
646 if ((data[2] & 0x07) | data[4] | data[5] | data[6] | data[7] | data[8] | data[9]) {
647 input_report_abs(input, ABS_MISC, PAD_DEVICE_ID);
648 } else {
649 input_report_abs(input, ABS_MISC, 0);
650 }
651 } else if (features->type >= INTUOS5S && features->type <= INTUOSPL) {
652 int i;
653
654
655 input_report_key(input, BTN_0, (data[3] & 0x01));
656
657
658
659
660
661
662 for (i = 0; i < 8; i++)
663 input_report_key(input, BTN_1 + i, data[4] & (1 << i));
664
665 if (data[2] & 0x80) {
666 input_report_abs(input, ABS_WHEEL, (data[2] & 0x7f));
667 } else {
668
669 input_report_abs(input, ABS_WHEEL, 0);
670 }
671
672 if (data[2] | (data[3] & 0x01) | data[4] | data[5]) {
673 input_report_abs(input, ABS_MISC, PAD_DEVICE_ID);
674 } else {
675 input_report_abs(input, ABS_MISC, 0);
676 }
677 } else {
678 if (features->type == WACOM_21UX2 || features->type == WACOM_22HD) {
679 input_report_key(input, BTN_0, (data[5] & 0x01));
680 input_report_key(input, BTN_1, (data[6] & 0x01));
681 input_report_key(input, BTN_2, (data[6] & 0x02));
682 input_report_key(input, BTN_3, (data[6] & 0x04));
683 input_report_key(input, BTN_4, (data[6] & 0x08));
684 input_report_key(input, BTN_5, (data[6] & 0x10));
685 input_report_key(input, BTN_6, (data[6] & 0x20));
686 input_report_key(input, BTN_7, (data[6] & 0x40));
687 input_report_key(input, BTN_8, (data[6] & 0x80));
688 input_report_key(input, BTN_9, (data[7] & 0x01));
689 input_report_key(input, BTN_A, (data[8] & 0x01));
690 input_report_key(input, BTN_B, (data[8] & 0x02));
691 input_report_key(input, BTN_C, (data[8] & 0x04));
692 input_report_key(input, BTN_X, (data[8] & 0x08));
693 input_report_key(input, BTN_Y, (data[8] & 0x10));
694 input_report_key(input, BTN_Z, (data[8] & 0x20));
695 input_report_key(input, BTN_BASE, (data[8] & 0x40));
696 input_report_key(input, BTN_BASE2, (data[8] & 0x80));
697
698 if (features->type == WACOM_22HD) {
699 input_report_key(input, KEY_PROG1, data[9] & 0x01);
700 input_report_key(input, KEY_PROG2, data[9] & 0x02);
701 input_report_key(input, KEY_PROG3, data[9] & 0x04);
702 }
703 } else {
704 input_report_key(input, BTN_0, (data[5] & 0x01));
705 input_report_key(input, BTN_1, (data[5] & 0x02));
706 input_report_key(input, BTN_2, (data[5] & 0x04));
707 input_report_key(input, BTN_3, (data[5] & 0x08));
708 input_report_key(input, BTN_4, (data[6] & 0x01));
709 input_report_key(input, BTN_5, (data[6] & 0x02));
710 input_report_key(input, BTN_6, (data[6] & 0x04));
711 input_report_key(input, BTN_7, (data[6] & 0x08));
712 input_report_key(input, BTN_8, (data[5] & 0x10));
713 input_report_key(input, BTN_9, (data[6] & 0x10));
714 }
715 input_report_abs(input, ABS_RX, ((data[1] & 0x1f) << 8) | data[2]);
716 input_report_abs(input, ABS_RY, ((data[3] & 0x1f) << 8) | data[4]);
717
718 if ((data[5] & 0x1f) | data[6] | (data[1] & 0x1f) |
719 data[2] | (data[3] & 0x1f) | data[4] | data[8] |
720 (data[7] & 0x01)) {
721 input_report_abs(input, ABS_MISC, PAD_DEVICE_ID);
722 } else {
723 input_report_abs(input, ABS_MISC, 0);
724 }
725 }
726 input_event(input, EV_MSC, MSC_SERIAL, 0xffffffff);
727 return 1;
728 }
729
730
731 result = wacom_intuos_inout(wacom);
732 if (result)
733 return result - 1;
734
735
736 if (!wacom->id[idx])
737 return 0;
738
739
740 if (wacom->tool[idx] == BTN_TOOL_LENS &&
741 (features->type == INTUOS3 ||
742 features->type == INTUOS3S ||
743 features->type == INTUOS4 ||
744 features->type == INTUOS4S ||
745 features->type == INTUOS5 ||
746 features->type == INTUOS5S ||
747 features->type == INTUOSPM ||
748 features->type == INTUOSPS)) {
749
750 return 0;
751 }
752
753
754 if (features->type == CINTIQ && !(data[1] & 0x40))
755 return 0;
756
757 if (features->type >= INTUOS3S) {
758 input_report_abs(input, ABS_X, (data[2] << 9) | (data[3] << 1) | ((data[9] >> 1) & 1));
759 input_report_abs(input, ABS_Y, (data[4] << 9) | (data[5] << 1) | (data[9] & 1));
760 input_report_abs(input, ABS_DISTANCE, ((data[9] >> 2) & 0x3f));
761 } else {
762 input_report_abs(input, ABS_X, be16_to_cpup((__be16 *)&data[2]));
763 input_report_abs(input, ABS_Y, be16_to_cpup((__be16 *)&data[4]));
764 input_report_abs(input, ABS_DISTANCE, ((data[9] >> 3) & 0x1f));
765 }
766
767
768 wacom_intuos_general(wacom);
769
770
771 if ((data[1] & 0xbc) == 0xa8 || (data[1] & 0xbe) == 0xb0 || (data[1] & 0xbc) == 0xac) {
772
773 if (data[1] & 0x02) {
774
775 if (features->type >= INTUOS3S) {
776
777 t = (data[6] << 3) | ((data[7] >> 5) & 7);
778 t = (data[7] & 0x20) ? ((t > 900) ? ((t-1) / 2 - 1350) :
779 ((t-1) / 2 + 450)) : (450 - t / 2) ;
780 input_report_abs(input, ABS_Z, t);
781 } else {
782
783 t = (data[6] << 3) | ((data[7] >> 5) & 7);
784 input_report_abs(input, ABS_RZ, (data[7] & 0x20) ?
785 ((t - 1) / 2) : -t / 2);
786 }
787
788 } else if (!(data[1] & 0x10) && features->type < INTUOS3S) {
789
790 input_report_key(input, BTN_LEFT, data[8] & 0x01);
791 input_report_key(input, BTN_MIDDLE, data[8] & 0x02);
792 input_report_key(input, BTN_RIGHT, data[8] & 0x04);
793
794 input_report_key(input, BTN_SIDE, data[8] & 0x20);
795 input_report_key(input, BTN_EXTRA, data[8] & 0x10);
796 t = (data[6] << 2) | ((data[7] >> 6) & 3);
797 input_report_abs(input, ABS_THROTTLE, (data[8] & 0x08) ? -t : t);
798
799 } else if (wacom->tool[idx] == BTN_TOOL_MOUSE) {
800
801 if (features->type >= INTUOS4S && features->type <= INTUOSPL) {
802 input_report_key(input, BTN_LEFT, data[6] & 0x01);
803 input_report_key(input, BTN_MIDDLE, data[6] & 0x02);
804 input_report_key(input, BTN_RIGHT, data[6] & 0x04);
805 input_report_rel(input, REL_WHEEL, ((data[7] & 0x80) >> 7)
806 - ((data[7] & 0x40) >> 6));
807 input_report_key(input, BTN_SIDE, data[6] & 0x08);
808 input_report_key(input, BTN_EXTRA, data[6] & 0x10);
809
810 input_report_abs(input, ABS_TILT_X,
811 ((data[7] << 1) & 0x7e) | (data[8] >> 7));
812 input_report_abs(input, ABS_TILT_Y, data[8] & 0x7f);
813 } else {
814
815 input_report_key(input, BTN_LEFT, data[8] & 0x04);
816 input_report_key(input, BTN_MIDDLE, data[8] & 0x08);
817 input_report_key(input, BTN_RIGHT, data[8] & 0x10);
818 input_report_rel(input, REL_WHEEL, (data[8] & 0x01)
819 - ((data[8] & 0x02) >> 1));
820
821
822 if (features->type >= INTUOS3S && features->type <= INTUOS3L) {
823 input_report_key(input, BTN_SIDE, data[8] & 0x40);
824 input_report_key(input, BTN_EXTRA, data[8] & 0x20);
825 }
826 }
827 } else if ((features->type < INTUOS3S || features->type == INTUOS3L ||
828 features->type == INTUOS4L || features->type == INTUOS5L ||
829 features->type == INTUOSPL) &&
830 wacom->tool[idx] == BTN_TOOL_LENS) {
831
832 input_report_key(input, BTN_LEFT, data[8] & 0x01);
833 input_report_key(input, BTN_MIDDLE, data[8] & 0x02);
834 input_report_key(input, BTN_RIGHT, data[8] & 0x04);
835 input_report_key(input, BTN_SIDE, data[8] & 0x10);
836 input_report_key(input, BTN_EXTRA, data[8] & 0x08);
837 }
838 }
839
840 input_report_abs(input, ABS_MISC, wacom->id[idx]);
841 input_report_key(input, wacom->tool[idx], 1);
842 input_event(input, EV_MSC, MSC_SERIAL, wacom->serial[idx]);
843 return 1;
844}
845
846static int int_dist(int x1, int y1, int x2, int y2)
847{
848 int x = x2 - x1;
849 int y = y2 - y1;
850
851 return int_sqrt(x*x + y*y);
852}
853
854static int wacom_24hdt_irq(struct wacom_wac *wacom)
855{
856 struct input_dev *input = wacom->input;
857 char *data = wacom->data;
858 int i;
859 int current_num_contacts = 0;
860 int contacts_to_send = 0;
861 int num_contacts_left = 4;
862 int byte_per_packet = WACOM_BYTES_PER_24HDT_PACKET;
863 int y_offset = 2;
864
865 if (wacom->features.type == WACOM_27QHDT) {
866 current_num_contacts = data[63];
867 num_contacts_left = 10;
868 byte_per_packet = WACOM_BYTES_PER_QHDTHID_PACKET;
869 y_offset = 0;
870 } else {
871 current_num_contacts = data[61];
872 }
873
874
875
876
877
878 if (current_num_contacts)
879 wacom->num_contacts_left = current_num_contacts;
880
881 contacts_to_send = min(num_contacts_left, wacom->num_contacts_left);
882
883 for (i = 0; i < contacts_to_send; i++) {
884 int offset = (byte_per_packet * i) + 1;
885 bool touch = data[offset] & 0x1 && !wacom->shared->stylus_in_proximity;
886 int slot = input_mt_get_slot_by_key(input, data[offset + 1]);
887
888 if (slot < 0)
889 continue;
890 input_mt_slot(input, slot);
891 input_mt_report_slot_state(input, MT_TOOL_FINGER, touch);
892
893 if (touch) {
894 int t_x = le16_to_cpup((__le16 *)&data[offset + 2]);
895 int t_y = get_unaligned_le16(&data[offset + 4 + y_offset]);
896
897 input_report_abs(input, ABS_MT_POSITION_X, t_x);
898 input_report_abs(input, ABS_MT_POSITION_Y, t_y);
899
900 if (wacom->features.type != WACOM_27QHDT) {
901 int c_x = get_unaligned_le16(&data[offset + 4]);
902 int c_y = get_unaligned_le16(&data[offset + 8]);
903 int w = get_unaligned_le16(&data[offset + 10]);
904 int h = get_unaligned_le16(&data[offset + 12]);
905
906 input_report_abs(input, ABS_MT_TOUCH_MAJOR, min(w,h));
907 input_report_abs(input, ABS_MT_WIDTH_MAJOR,
908 min(w, h) + int_dist(t_x, t_y, c_x, c_y));
909 input_report_abs(input, ABS_MT_WIDTH_MINOR, min(w, h));
910 input_report_abs(input, ABS_MT_ORIENTATION, w > h);
911 }
912 }
913 }
914 input_mt_report_pointer_emulation(input, true);
915
916 wacom->num_contacts_left -= contacts_to_send;
917 if (wacom->num_contacts_left <= 0)
918 wacom->num_contacts_left = 0;
919
920 return 1;
921}
922
923static int wacom_mt_touch(struct wacom_wac *wacom)
924{
925 struct input_dev *input = wacom->input;
926 char *data = wacom->data;
927 int i;
928 int current_num_contacts = data[2];
929 int contacts_to_send = 0;
930 int x_offset = 0;
931
932
933 if (wacom->features.type == MTTPC)
934 x_offset = -4;
935
936
937
938
939
940 if (current_num_contacts)
941 wacom->num_contacts_left = current_num_contacts;
942
943
944 contacts_to_send = min(5, wacom->num_contacts_left);
945
946 for (i = 0; i < contacts_to_send; i++) {
947 int offset = (WACOM_BYTES_PER_MT_PACKET + x_offset) * i + 3;
948 bool touch = data[offset] & 0x1;
949 int id = le16_to_cpup((__le16 *)&data[offset + 1]);
950 int slot = input_mt_get_slot_by_key(input, id);
951
952 if (slot < 0)
953 continue;
954
955 input_mt_slot(input, slot);
956 input_mt_report_slot_state(input, MT_TOOL_FINGER, touch);
957 if (touch) {
958 int x = le16_to_cpup((__le16 *)&data[offset + x_offset + 7]);
959 int y = le16_to_cpup((__le16 *)&data[offset + x_offset + 9]);
960 input_report_abs(input, ABS_MT_POSITION_X, x);
961 input_report_abs(input, ABS_MT_POSITION_Y, y);
962 }
963 }
964 input_mt_report_pointer_emulation(input, true);
965
966 wacom->num_contacts_left -= contacts_to_send;
967 if (wacom->num_contacts_left < 0)
968 wacom->num_contacts_left = 0;
969
970 return 1;
971}
972
973static int wacom_tpc_mt_touch(struct wacom_wac *wacom)
974{
975 struct input_dev *input = wacom->input;
976 unsigned char *data = wacom->data;
977 int contact_with_no_pen_down_count = 0;
978 int i;
979
980 for (i = 0; i < 2; i++) {
981 int p = data[1] & (1 << i);
982 bool touch = p && !wacom->shared->stylus_in_proximity;
983
984 input_mt_slot(input, i);
985 input_mt_report_slot_state(input, MT_TOOL_FINGER, touch);
986 if (touch) {
987 int x = le16_to_cpup((__le16 *)&data[i * 2 + 2]) & 0x7fff;
988 int y = le16_to_cpup((__le16 *)&data[i * 2 + 6]) & 0x7fff;
989
990 input_report_abs(input, ABS_MT_POSITION_X, x);
991 input_report_abs(input, ABS_MT_POSITION_Y, y);
992 contact_with_no_pen_down_count++;
993 }
994 }
995 input_mt_report_pointer_emulation(input, true);
996
997
998 wacom->shared->touch_down = (contact_with_no_pen_down_count > 0);
999
1000 return 1;
1001}
1002
1003static int wacom_tpc_single_touch(struct wacom_wac *wacom, size_t len)
1004{
1005 char *data = wacom->data;
1006 struct input_dev *input = wacom->input;
1007 bool prox;
1008 int x = 0, y = 0;
1009
1010 if (wacom->features.touch_max > 1 || len > WACOM_PKGLEN_TPC2FG)
1011 return 0;
1012
1013 if (!wacom->shared->stylus_in_proximity) {
1014 if (len == WACOM_PKGLEN_TPC1FG) {
1015 prox = data[0] & 0x01;
1016 x = get_unaligned_le16(&data[1]);
1017 y = get_unaligned_le16(&data[3]);
1018 } else {
1019 prox = data[1] & 0x01;
1020 x = le16_to_cpup((__le16 *)&data[2]);
1021 y = le16_to_cpup((__le16 *)&data[4]);
1022 }
1023 } else
1024
1025 prox = 0;
1026
1027 if (prox) {
1028 input_report_abs(input, ABS_X, x);
1029 input_report_abs(input, ABS_Y, y);
1030 }
1031 input_report_key(input, BTN_TOUCH, prox);
1032
1033
1034 wacom->shared->touch_down = prox;
1035
1036 return 1;
1037}
1038
1039static int wacom_tpc_pen(struct wacom_wac *wacom)
1040{
1041 struct wacom_features *features = &wacom->features;
1042 char *data = wacom->data;
1043 struct input_dev *input = wacom->input;
1044 int pressure;
1045 bool prox = data[1] & 0x20;
1046
1047 if (!wacom->shared->stylus_in_proximity)
1048
1049 wacom->tool[0] = (data[1] & 0x0c) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN;
1050
1051
1052 wacom->shared->stylus_in_proximity = prox;
1053
1054
1055 if (!wacom->shared->touch_down) {
1056 input_report_key(input, BTN_STYLUS, data[1] & 0x02);
1057 input_report_key(input, BTN_STYLUS2, data[1] & 0x10);
1058 input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2]));
1059 input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4]));
1060 pressure = ((data[7] & 0x01) << 8) | data[6];
1061 if (pressure < 0)
1062 pressure = features->pressure_max + pressure + 1;
1063 input_report_abs(input, ABS_PRESSURE, pressure);
1064 input_report_key(input, BTN_TOUCH, data[1] & 0x05);
1065 input_report_key(input, wacom->tool[0], prox);
1066 return 1;
1067 }
1068
1069 return 0;
1070}
1071
1072static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len)
1073{
1074 char *data = wacom->data;
1075
1076 dev_dbg(wacom->input->dev.parent,
1077 "%s: received report #%d\n", __func__, data[0]);
1078
1079 switch (len) {
1080 case WACOM_PKGLEN_TPC1FG:
1081 return wacom_tpc_single_touch(wacom, len);
1082
1083 case WACOM_PKGLEN_TPC2FG:
1084 return wacom_tpc_mt_touch(wacom);
1085
1086 default:
1087 switch (data[0]) {
1088 case WACOM_REPORT_TPC1FG:
1089 case WACOM_REPORT_TPCHID:
1090 case WACOM_REPORT_TPCST:
1091 case WACOM_REPORT_TPC1FGE:
1092 return wacom_tpc_single_touch(wacom, len);
1093
1094 case WACOM_REPORT_TPCMT:
1095 return wacom_mt_touch(wacom);
1096
1097 case WACOM_REPORT_PENABLED:
1098 return wacom_tpc_pen(wacom);
1099 }
1100 }
1101
1102 return 0;
1103}
1104
1105static int wacom_bpt_touch(struct wacom_wac *wacom)
1106{
1107 struct wacom_features *features = &wacom->features;
1108 struct input_dev *input = wacom->input;
1109 unsigned char *data = wacom->data;
1110 int i;
1111
1112 if (data[0] != 0x02)
1113 return 0;
1114
1115 for (i = 0; i < 2; i++) {
1116 int offset = (data[1] & 0x80) ? (8 * i) : (9 * i);
1117 bool touch = data[offset + 3] & 0x80;
1118
1119
1120
1121
1122
1123
1124
1125 touch = touch && !wacom->shared->stylus_in_proximity;
1126
1127 input_mt_slot(input, i);
1128 input_mt_report_slot_state(input, MT_TOOL_FINGER, touch);
1129 if (touch) {
1130 int x = get_unaligned_be16(&data[offset + 3]) & 0x7ff;
1131 int y = get_unaligned_be16(&data[offset + 5]) & 0x7ff;
1132 if (features->quirks & WACOM_QUIRK_BBTOUCH_LOWRES) {
1133 x <<= 5;
1134 y <<= 5;
1135 }
1136 input_report_abs(input, ABS_MT_POSITION_X, x);
1137 input_report_abs(input, ABS_MT_POSITION_Y, y);
1138 }
1139 }
1140
1141 input_mt_report_pointer_emulation(input, true);
1142
1143 input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
1144 input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0);
1145 input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0);
1146 input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0);
1147
1148 input_sync(input);
1149
1150 return 0;
1151}
1152
1153static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data)
1154{
1155 struct wacom_features *features = &wacom->features;
1156 struct input_dev *input = wacom->input;
1157 bool touch = data[1] & 0x80;
1158 int slot = input_mt_get_slot_by_key(input, data[0]);
1159
1160 if (slot < 0)
1161 return;
1162
1163 touch = touch && !wacom->shared->stylus_in_proximity;
1164
1165 input_mt_slot(input, slot);
1166 input_mt_report_slot_state(input, MT_TOOL_FINGER, touch);
1167
1168 if (touch) {
1169 int x = (data[2] << 4) | (data[4] >> 4);
1170 int y = (data[3] << 4) | (data[4] & 0x0f);
1171 int width, height;
1172
1173 if (features->type >= INTUOSPS && features->type <= INTUOSPL) {
1174 width = data[5];
1175 height = data[6];
1176 } else {
1177
1178
1179
1180
1181
1182 int a = data[5];
1183 int x_res = input_abs_get_res(input, ABS_X);
1184 int y_res = input_abs_get_res(input, ABS_Y);
1185 width = 2 * int_sqrt(a * WACOM_CONTACT_AREA_SCALE);
1186 height = width * y_res / x_res;
1187 }
1188
1189 input_report_abs(input, ABS_MT_POSITION_X, x);
1190 input_report_abs(input, ABS_MT_POSITION_Y, y);
1191 input_report_abs(input, ABS_MT_TOUCH_MAJOR, width);
1192 input_report_abs(input, ABS_MT_TOUCH_MINOR, height);
1193 }
1194}
1195
1196static void wacom_bpt3_button_msg(struct wacom_wac *wacom, unsigned char *data)
1197{
1198 struct input_dev *input = wacom->input;
1199
1200 input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
1201 input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0);
1202 input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0);
1203 input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0);
1204}
1205
1206static int wacom_bpt3_touch(struct wacom_wac *wacom)
1207{
1208 struct input_dev *input = wacom->input;
1209 unsigned char *data = wacom->data;
1210 int count = data[1] & 0x07;
1211 int i;
1212
1213 if (data[0] != 0x02)
1214 return 0;
1215
1216
1217 for (i = 0; i < count; i++) {
1218 int offset = (8 * i) + 2;
1219 int msg_id = data[offset];
1220
1221 if (msg_id >= 2 && msg_id <= 17)
1222 wacom_bpt3_touch_msg(wacom, data + offset);
1223 else if (msg_id == 128)
1224 wacom_bpt3_button_msg(wacom, data + offset);
1225
1226 }
1227 input_mt_report_pointer_emulation(input, true);
1228
1229 input_sync(input);
1230
1231 return 0;
1232}
1233
1234static int wacom_bpt_pen(struct wacom_wac *wacom)
1235{
1236 struct input_dev *input = wacom->input;
1237 unsigned char *data = wacom->data;
1238 int prox = 0, x = 0, y = 0, p = 0, d = 0, pen = 0, btn1 = 0, btn2 = 0;
1239
1240 if (data[0] != 0x02)
1241 return 0;
1242
1243 prox = (data[1] & 0x20) == 0x20;
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255 if (prox) {
1256 if (!wacom->shared->stylus_in_proximity) {
1257 if (data[1] & 0x08) {
1258 wacom->tool[0] = BTN_TOOL_RUBBER;
1259 wacom->id[0] = ERASER_DEVICE_ID;
1260 } else {
1261 wacom->tool[0] = BTN_TOOL_PEN;
1262 wacom->id[0] = STYLUS_DEVICE_ID;
1263 }
1264 wacom->shared->stylus_in_proximity = true;
1265 }
1266 x = le16_to_cpup((__le16 *)&data[2]);
1267 y = le16_to_cpup((__le16 *)&data[4]);
1268 p = le16_to_cpup((__le16 *)&data[6]);
1269
1270
1271
1272
1273
1274
1275 if (data[8] <= wacom->features.distance_max)
1276 d = wacom->features.distance_max - data[8];
1277
1278 pen = data[1] & 0x01;
1279 btn1 = data[1] & 0x02;
1280 btn2 = data[1] & 0x04;
1281 }
1282
1283 input_report_key(input, BTN_TOUCH, pen);
1284 input_report_key(input, BTN_STYLUS, btn1);
1285 input_report_key(input, BTN_STYLUS2, btn2);
1286
1287 input_report_abs(input, ABS_X, x);
1288 input_report_abs(input, ABS_Y, y);
1289 input_report_abs(input, ABS_PRESSURE, p);
1290 input_report_abs(input, ABS_DISTANCE, d);
1291
1292 if (!prox) {
1293 wacom->id[0] = 0;
1294 wacom->shared->stylus_in_proximity = false;
1295 }
1296
1297 input_report_key(input, wacom->tool[0], prox);
1298 input_report_abs(input, ABS_MISC, wacom->id[0]);
1299
1300 return 1;
1301}
1302
1303static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len)
1304{
1305 if (len == WACOM_PKGLEN_BBTOUCH)
1306 return wacom_bpt_touch(wacom);
1307 else if (len == WACOM_PKGLEN_BBTOUCH3)
1308 return wacom_bpt3_touch(wacom);
1309 else if (len == WACOM_PKGLEN_BBFUN || len == WACOM_PKGLEN_BBPEN)
1310 return wacom_bpt_pen(wacom);
1311
1312 return 0;
1313}
1314
1315static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len)
1316{
1317 unsigned char *data = wacom->data;
1318 int connected;
1319
1320 if (len != WACOM_PKGLEN_WIRELESS || data[0] != 0x80)
1321 return 0;
1322
1323 connected = data[1] & 0x01;
1324 if (connected) {
1325 int pid, battery;
1326
1327 pid = get_unaligned_be16(&data[6]);
1328 battery = data[5] & 0x3f;
1329 if (wacom->pid != pid) {
1330 wacom->pid = pid;
1331 wacom_schedule_work(wacom);
1332 }
1333 wacom->battery_capacity = battery;
1334 } else if (wacom->pid != 0) {
1335
1336 wacom->pid = 0;
1337 wacom_schedule_work(wacom);
1338 wacom->battery_capacity = 0;
1339 }
1340
1341 return 0;
1342}
1343
1344void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
1345{
1346 bool sync;
1347
1348 switch (wacom_wac->features.type) {
1349 case PENPARTNER:
1350 sync = wacom_penpartner_irq(wacom_wac);
1351 break;
1352
1353 case PL:
1354 sync = wacom_pl_irq(wacom_wac);
1355 break;
1356
1357 case WACOM_G4:
1358 case GRAPHIRE:
1359 case WACOM_MO:
1360 sync = wacom_graphire_irq(wacom_wac);
1361 break;
1362
1363 case PTU:
1364 sync = wacom_ptu_irq(wacom_wac);
1365 break;
1366
1367 case DTU:
1368 sync = wacom_dtu_irq(wacom_wac);
1369 break;
1370
1371 case INTUOS:
1372 case INTUOS3S:
1373 case INTUOS3:
1374 case INTUOS3L:
1375 case INTUOS4S:
1376 case INTUOS4:
1377 case INTUOS4L:
1378 case CINTIQ:
1379 case WACOM_BEE:
1380 case WACOM_13HD:
1381 case WACOM_21UX2:
1382 case WACOM_22HD:
1383 case WACOM_24HD:
1384 case WACOM_27QHD:
1385 case DTK:
1386 sync = wacom_intuos_irq(wacom_wac);
1387 break;
1388
1389 case WACOM_24HDT:
1390 case WACOM_27QHDT:
1391 sync = wacom_24hdt_irq(wacom_wac);
1392 break;
1393
1394 case INTUOS5S:
1395 case INTUOS5:
1396 case INTUOS5L:
1397 case INTUOSPS:
1398 case INTUOSPM:
1399 case INTUOSPL:
1400 if (len == WACOM_PKGLEN_BBTOUCH3)
1401 sync = wacom_bpt3_touch(wacom_wac);
1402 else
1403 sync = wacom_intuos_irq(wacom_wac);
1404 break;
1405
1406 case TABLETPC:
1407 case TABLETPCE:
1408 case TABLETPC2FG:
1409 case MTSCREEN:
1410 case MTTPC:
1411 sync = wacom_tpc_irq(wacom_wac, len);
1412 break;
1413
1414 case BAMBOO_PT:
1415 sync = wacom_bpt_irq(wacom_wac, len);
1416 break;
1417
1418 case WIRELESS:
1419 sync = wacom_wireless_irq(wacom_wac, len);
1420 break;
1421
1422 default:
1423 sync = false;
1424 break;
1425 }
1426
1427 if (sync)
1428 input_sync(wacom_wac->input);
1429}
1430
1431static void wacom_setup_cintiq(struct wacom_wac *wacom_wac)
1432{
1433 struct input_dev *input_dev = wacom_wac->input;
1434
1435 input_set_capability(input_dev, EV_MSC, MSC_SERIAL);
1436
1437 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
1438 __set_bit(BTN_TOOL_PEN, input_dev->keybit);
1439 __set_bit(BTN_TOOL_BRUSH, input_dev->keybit);
1440 __set_bit(BTN_TOOL_PENCIL, input_dev->keybit);
1441 __set_bit(BTN_TOOL_AIRBRUSH, input_dev->keybit);
1442 __set_bit(BTN_STYLUS, input_dev->keybit);
1443 __set_bit(BTN_STYLUS2, input_dev->keybit);
1444
1445 input_set_abs_params(input_dev, ABS_DISTANCE,
1446 0, wacom_wac->features.distance_max, 0, 0);
1447 input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0);
1448 input_set_abs_params(input_dev, ABS_TILT_X, 0, 127, 0, 0);
1449 input_set_abs_params(input_dev, ABS_TILT_Y, 0, 127, 0, 0);
1450}
1451
1452static void wacom_setup_intuos(struct wacom_wac *wacom_wac)
1453{
1454 struct input_dev *input_dev = wacom_wac->input;
1455
1456 input_set_capability(input_dev, EV_REL, REL_WHEEL);
1457
1458 wacom_setup_cintiq(wacom_wac);
1459
1460 __set_bit(BTN_LEFT, input_dev->keybit);
1461 __set_bit(BTN_RIGHT, input_dev->keybit);
1462 __set_bit(BTN_MIDDLE, input_dev->keybit);
1463 __set_bit(BTN_SIDE, input_dev->keybit);
1464 __set_bit(BTN_EXTRA, input_dev->keybit);
1465 __set_bit(BTN_TOOL_MOUSE, input_dev->keybit);
1466 __set_bit(BTN_TOOL_LENS, input_dev->keybit);
1467
1468 input_set_abs_params(input_dev, ABS_RZ, -900, 899, 0, 0);
1469 input_set_abs_params(input_dev, ABS_THROTTLE, -1023, 1023, 0, 0);
1470}
1471
1472void wacom_setup_device_quirks(struct wacom_features *features)
1473{
1474
1475
1476 if (features->device_type == BTN_TOOL_FINGER && !features->x_max) {
1477 features->x_max = 1023;
1478 features->y_max = 1023;
1479 }
1480
1481
1482 if (features->type >= WIRELESS ||
1483 (features->type >= INTUOS5S && features->type <= INTUOSPL) ||
1484 (features->oVid && features->oPid))
1485 features->quirks |= WACOM_QUIRK_MULTI_INPUT;
1486
1487
1488 if (features->type == BAMBOO_PT &&
1489 features->pktlen == WACOM_PKGLEN_BBTOUCH) {
1490 features->x_max <<= 5;
1491 features->y_max <<= 5;
1492 features->x_fuzz <<= 5;
1493 features->y_fuzz <<= 5;
1494 features->quirks |= WACOM_QUIRK_BBTOUCH_LOWRES;
1495 }
1496
1497 if (features->type == WIRELESS) {
1498
1499
1500 features->quirks |= WACOM_QUIRK_NO_INPUT;
1501
1502
1503 if (!features->device_type)
1504 features->quirks |= WACOM_QUIRK_MONITOR;
1505 }
1506}
1507
1508static void wacom_abs_set_axis(struct input_dev *input_dev,
1509 struct wacom_wac *wacom_wac)
1510{
1511 struct wacom_features *features = &wacom_wac->features;
1512
1513 if (features->device_type == BTN_TOOL_PEN) {
1514 input_set_abs_params(input_dev, ABS_X, features->x_min,
1515 features->x_max, features->x_fuzz, 0);
1516 input_set_abs_params(input_dev, ABS_Y, features->y_min,
1517 features->y_max, features->y_fuzz, 0);
1518 input_set_abs_params(input_dev, ABS_PRESSURE, 0,
1519 features->pressure_max, features->pressure_fuzz, 0);
1520
1521
1522 input_abs_set_res(input_dev, ABS_X, features->x_resolution);
1523 input_abs_set_res(input_dev, ABS_Y, features->y_resolution);
1524 } else {
1525 if (features->touch_max <= 2) {
1526 input_set_abs_params(input_dev, ABS_X, 0,
1527 features->x_max, features->x_fuzz, 0);
1528 input_set_abs_params(input_dev, ABS_Y, 0,
1529 features->y_max, features->y_fuzz, 0);
1530 input_abs_set_res(input_dev, ABS_X,
1531 features->x_resolution);
1532 input_abs_set_res(input_dev, ABS_Y,
1533 features->y_resolution);
1534 }
1535
1536 if (features->touch_max > 1) {
1537 input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0,
1538 features->x_max, features->x_fuzz, 0);
1539 input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0,
1540 features->y_max, features->y_fuzz, 0);
1541 input_abs_set_res(input_dev, ABS_MT_POSITION_X,
1542 features->x_resolution);
1543 input_abs_set_res(input_dev, ABS_MT_POSITION_Y,
1544 features->y_resolution);
1545 }
1546 }
1547}
1548
1549int wacom_setup_input_capabilities(struct input_dev *input_dev,
1550 struct wacom_wac *wacom_wac)
1551{
1552 struct wacom_features *features = &wacom_wac->features;
1553 int i;
1554
1555 input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
1556
1557 __set_bit(BTN_TOUCH, input_dev->keybit);
1558 __set_bit(ABS_MISC, input_dev->absbit);
1559
1560 wacom_abs_set_axis(input_dev, wacom_wac);
1561
1562 switch (wacom_wac->features.type) {
1563 case WACOM_MO:
1564 input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0);
1565
1566
1567 case WACOM_G4:
1568 input_set_capability(input_dev, EV_MSC, MSC_SERIAL);
1569
1570 __set_bit(BTN_BACK, input_dev->keybit);
1571 __set_bit(BTN_FORWARD, input_dev->keybit);
1572
1573
1574 case GRAPHIRE:
1575 input_set_capability(input_dev, EV_REL, REL_WHEEL);
1576
1577 __set_bit(BTN_LEFT, input_dev->keybit);
1578 __set_bit(BTN_RIGHT, input_dev->keybit);
1579 __set_bit(BTN_MIDDLE, input_dev->keybit);
1580
1581 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
1582 __set_bit(BTN_TOOL_PEN, input_dev->keybit);
1583 __set_bit(BTN_TOOL_MOUSE, input_dev->keybit);
1584 __set_bit(BTN_STYLUS, input_dev->keybit);
1585 __set_bit(BTN_STYLUS2, input_dev->keybit);
1586
1587 __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
1588 break;
1589
1590 case WACOM_24HD:
1591 __set_bit(BTN_A, input_dev->keybit);
1592 __set_bit(BTN_B, input_dev->keybit);
1593 __set_bit(BTN_C, input_dev->keybit);
1594 __set_bit(BTN_X, input_dev->keybit);
1595 __set_bit(BTN_Y, input_dev->keybit);
1596 __set_bit(BTN_Z, input_dev->keybit);
1597
1598 for (i = 6; i < 10; i++)
1599 __set_bit(BTN_0 + i, input_dev->keybit);
1600
1601 __set_bit(KEY_PROG1, input_dev->keybit);
1602 __set_bit(KEY_PROG2, input_dev->keybit);
1603 __set_bit(KEY_PROG3, input_dev->keybit);
1604
1605 input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
1606 input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0);
1607
1608
1609 case DTK:
1610 for (i = 0; i < 6; i++)
1611 __set_bit(BTN_0 + i, input_dev->keybit);
1612
1613 __set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
1614
1615 wacom_setup_cintiq(wacom_wac);
1616 break;
1617
1618 case WACOM_27QHD:
1619 __set_bit(KEY_PROG1, input_dev->keybit);
1620 __set_bit(KEY_PROG2, input_dev->keybit);
1621 __set_bit(KEY_PROG3, input_dev->keybit);
1622
1623 __set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
1624
1625 wacom_setup_cintiq(wacom_wac);
1626
1627 break;
1628
1629 case WACOM_22HD:
1630 __set_bit(KEY_PROG1, input_dev->keybit);
1631 __set_bit(KEY_PROG2, input_dev->keybit);
1632 __set_bit(KEY_PROG3, input_dev->keybit);
1633
1634
1635 case WACOM_21UX2:
1636 __set_bit(BTN_A, input_dev->keybit);
1637 __set_bit(BTN_B, input_dev->keybit);
1638 __set_bit(BTN_C, input_dev->keybit);
1639 __set_bit(BTN_X, input_dev->keybit);
1640 __set_bit(BTN_Y, input_dev->keybit);
1641 __set_bit(BTN_Z, input_dev->keybit);
1642 __set_bit(BTN_BASE, input_dev->keybit);
1643 __set_bit(BTN_BASE2, input_dev->keybit);
1644
1645
1646 case WACOM_BEE:
1647 __set_bit(BTN_8, input_dev->keybit);
1648 __set_bit(BTN_9, input_dev->keybit);
1649
1650
1651 case CINTIQ:
1652 for (i = 0; i < 8; i++)
1653 __set_bit(BTN_0 + i, input_dev->keybit);
1654
1655 input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0);
1656 input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0);
1657 input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
1658
1659 __set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
1660
1661 wacom_setup_cintiq(wacom_wac);
1662 break;
1663
1664 case WACOM_13HD:
1665 for (i = 0; i < 9; i++)
1666 __set_bit(BTN_0 + i, input_dev->keybit);
1667
1668 input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
1669 __set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
1670 wacom_setup_cintiq(wacom_wac);
1671 break;
1672
1673 case INTUOS3:
1674 case INTUOS3L:
1675 __set_bit(BTN_4, input_dev->keybit);
1676 __set_bit(BTN_5, input_dev->keybit);
1677 __set_bit(BTN_6, input_dev->keybit);
1678 __set_bit(BTN_7, input_dev->keybit);
1679
1680 input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0);
1681
1682
1683 case INTUOS3S:
1684 __set_bit(BTN_0, input_dev->keybit);
1685 __set_bit(BTN_1, input_dev->keybit);
1686 __set_bit(BTN_2, input_dev->keybit);
1687 __set_bit(BTN_3, input_dev->keybit);
1688
1689 input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0);
1690 input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
1691
1692
1693 case INTUOS:
1694 __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
1695
1696 wacom_setup_intuos(wacom_wac);
1697 break;
1698
1699 case INTUOS5:
1700 case INTUOS5L:
1701 case INTUOSPM:
1702 case INTUOSPL:
1703 if (features->device_type == BTN_TOOL_PEN) {
1704 __set_bit(BTN_7, input_dev->keybit);
1705 __set_bit(BTN_8, input_dev->keybit);
1706 }
1707
1708
1709 case INTUOS5S:
1710 case INTUOSPS:
1711 __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
1712
1713 if (features->device_type == BTN_TOOL_PEN) {
1714 for (i = 0; i < 7; i++)
1715 __set_bit(BTN_0 + i, input_dev->keybit);
1716
1717 input_set_abs_params(input_dev, ABS_DISTANCE, 0,
1718 features->distance_max,
1719 0, 0);
1720
1721 input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
1722
1723 wacom_setup_intuos(wacom_wac);
1724 } else if (features->device_type == BTN_TOOL_FINGER) {
1725 __clear_bit(ABS_MISC, input_dev->absbit);
1726
1727 input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR,
1728 0, features->x_max, 0, 0);
1729 input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR,
1730 0, features->y_max, 0, 0);
1731 input_mt_init_slots(input_dev, features->touch_max, INPUT_MT_POINTER);
1732 }
1733 break;
1734
1735 case INTUOS4:
1736 case INTUOS4L:
1737 __set_bit(BTN_7, input_dev->keybit);
1738 __set_bit(BTN_8, input_dev->keybit);
1739
1740
1741 case INTUOS4S:
1742 for (i = 0; i < 7; i++)
1743 __set_bit(BTN_0 + i, input_dev->keybit);
1744
1745 input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
1746 wacom_setup_intuos(wacom_wac);
1747
1748 __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
1749 break;
1750
1751 case WACOM_24HDT:
1752 if (features->device_type == BTN_TOOL_FINGER) {
1753 input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, features->x_max, 0, 0);
1754 input_set_abs_params(input_dev, ABS_MT_WIDTH_MAJOR, 0, features->x_max, 0, 0);
1755 input_set_abs_params(input_dev, ABS_MT_WIDTH_MINOR, 0, features->y_max, 0, 0);
1756 input_set_abs_params(input_dev, ABS_MT_ORIENTATION, 0, 1, 0, 0);
1757 }
1758
1759
1760 case MTSCREEN:
1761 case MTTPC:
1762 case TABLETPC2FG:
1763 if (features->device_type == BTN_TOOL_FINGER) {
1764 unsigned int flags = INPUT_MT_DIRECT;
1765
1766 if (wacom_wac->features.type == TABLETPC2FG)
1767 flags = 0;
1768
1769 input_mt_init_slots(input_dev, features->touch_max, flags);
1770 }
1771
1772
1773 case TABLETPC:
1774 case TABLETPCE:
1775 __clear_bit(ABS_MISC, input_dev->absbit);
1776
1777 __set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
1778
1779 if (features->device_type != BTN_TOOL_PEN)
1780 break;
1781
1782
1783
1784 case PL:
1785 case DTU:
1786 __set_bit(BTN_TOOL_PEN, input_dev->keybit);
1787 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
1788 __set_bit(BTN_STYLUS, input_dev->keybit);
1789 __set_bit(BTN_STYLUS2, input_dev->keybit);
1790
1791 __set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
1792 break;
1793
1794 case PTU:
1795 __set_bit(BTN_STYLUS2, input_dev->keybit);
1796
1797
1798 case PENPARTNER:
1799 __set_bit(BTN_TOOL_PEN, input_dev->keybit);
1800 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
1801 __set_bit(BTN_STYLUS, input_dev->keybit);
1802
1803 __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
1804 break;
1805
1806 case BAMBOO_PT:
1807 __clear_bit(ABS_MISC, input_dev->absbit);
1808
1809 __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
1810
1811 if (features->device_type == BTN_TOOL_FINGER) {
1812 unsigned int flags = INPUT_MT_POINTER;
1813
1814 __set_bit(BTN_LEFT, input_dev->keybit);
1815 __set_bit(BTN_FORWARD, input_dev->keybit);
1816 __set_bit(BTN_BACK, input_dev->keybit);
1817 __set_bit(BTN_RIGHT, input_dev->keybit);
1818
1819 if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) {
1820 input_set_abs_params(input_dev,
1821 ABS_MT_TOUCH_MAJOR,
1822 0, features->x_max, 0, 0);
1823 input_set_abs_params(input_dev,
1824 ABS_MT_TOUCH_MINOR,
1825 0, features->y_max, 0, 0);
1826 } else {
1827 __set_bit(BTN_TOOL_FINGER, input_dev->keybit);
1828 __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit);
1829 flags = 0;
1830 }
1831 input_mt_init_slots(input_dev, features->touch_max, flags);
1832 } else if (features->device_type == BTN_TOOL_PEN) {
1833 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
1834 __set_bit(BTN_TOOL_PEN, input_dev->keybit);
1835 __set_bit(BTN_STYLUS, input_dev->keybit);
1836 __set_bit(BTN_STYLUS2, input_dev->keybit);
1837 input_set_abs_params(input_dev, ABS_DISTANCE, 0,
1838 features->distance_max,
1839 0, 0);
1840 }
1841 break;
1842 }
1843 return 0;
1844}
1845
1846static const struct wacom_features wacom_features_0x00 =
1847 { "Wacom Penpartner", WACOM_PKGLEN_PENPRTN, 5040, 3780, 255,
1848 0, PENPARTNER, WACOM_PENPRTN_RES, WACOM_PENPRTN_RES };
1849static const struct wacom_features wacom_features_0x10 =
1850 { "Wacom Graphire", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511,
1851 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES };
1852static const struct wacom_features wacom_features_0x11 =
1853 { "Wacom Graphire2 4x5", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511,
1854 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES };
1855static const struct wacom_features wacom_features_0x12 =
1856 { "Wacom Graphire2 5x7", WACOM_PKGLEN_GRAPHIRE, 13918, 10206, 511,
1857 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES };
1858static const struct wacom_features wacom_features_0x13 =
1859 { "Wacom Graphire3", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511,
1860 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES };
1861static const struct wacom_features wacom_features_0x14 =
1862 { "Wacom Graphire3 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511,
1863 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES };
1864static const struct wacom_features wacom_features_0x15 =
1865 { "Wacom Graphire4 4x5", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511,
1866 63, WACOM_G4, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES };
1867static const struct wacom_features wacom_features_0x16 =
1868 { "Wacom Graphire4 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511,
1869 63, WACOM_G4, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES };
1870static const struct wacom_features wacom_features_0x17 =
1871 { "Wacom BambooFun 4x5", WACOM_PKGLEN_BBFUN, 14760, 9225, 511,
1872 63, WACOM_MO, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1873static const struct wacom_features wacom_features_0x18 =
1874 { "Wacom BambooFun 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 511,
1875 63, WACOM_MO, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1876static const struct wacom_features wacom_features_0x19 =
1877 { "Wacom Bamboo1 Medium", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511,
1878 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES };
1879static const struct wacom_features wacom_features_0x60 =
1880 { "Wacom Volito", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511,
1881 63, GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES };
1882static const struct wacom_features wacom_features_0x61 =
1883 { "Wacom PenStation2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 255,
1884 63, GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES };
1885static const struct wacom_features wacom_features_0x62 =
1886 { "Wacom Volito2 4x5", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511,
1887 63, GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES };
1888static const struct wacom_features wacom_features_0x63 =
1889 { "Wacom Volito2 2x3", WACOM_PKGLEN_GRAPHIRE, 3248, 2320, 511,
1890 63, GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES };
1891static const struct wacom_features wacom_features_0x64 =
1892 { "Wacom PenPartner2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 511,
1893 63, GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES };
1894static const struct wacom_features wacom_features_0x65 =
1895 { "Wacom Bamboo", WACOM_PKGLEN_BBFUN, 14760, 9225, 511,
1896 63, WACOM_MO, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1897static const struct wacom_features wacom_features_0x69 =
1898 { "Wacom Bamboo1", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511,
1899 63, GRAPHIRE, WACOM_PENPRTN_RES, WACOM_PENPRTN_RES };
1900static const struct wacom_features wacom_features_0x6A =
1901 { "Wacom Bamboo1 4x6", WACOM_PKGLEN_GRAPHIRE, 14760, 9225, 1023,
1902 63, GRAPHIRE, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1903static const struct wacom_features wacom_features_0x6B =
1904 { "Wacom Bamboo1 5x8", WACOM_PKGLEN_GRAPHIRE, 21648, 13530, 1023,
1905 63, GRAPHIRE, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1906static const struct wacom_features wacom_features_0x20 =
1907 { "Wacom Intuos 4x5", WACOM_PKGLEN_INTUOS, 12700, 10600, 1023,
1908 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1909static const struct wacom_features wacom_features_0x21 =
1910 { "Wacom Intuos 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023,
1911 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1912static const struct wacom_features wacom_features_0x22 =
1913 { "Wacom Intuos 9x12", WACOM_PKGLEN_INTUOS, 30480, 24060, 1023,
1914 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1915static const struct wacom_features wacom_features_0x23 =
1916 { "Wacom Intuos 12x12", WACOM_PKGLEN_INTUOS, 30480, 31680, 1023,
1917 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1918static const struct wacom_features wacom_features_0x24 =
1919 { "Wacom Intuos 12x18", WACOM_PKGLEN_INTUOS, 45720, 31680, 1023,
1920 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1921static const struct wacom_features wacom_features_0x30 =
1922 { "Wacom PL400", WACOM_PKGLEN_GRAPHIRE, 5408, 4056, 255,
1923 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1924static const struct wacom_features wacom_features_0x31 =
1925 { "Wacom PL500", WACOM_PKGLEN_GRAPHIRE, 6144, 4608, 255,
1926 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1927static const struct wacom_features wacom_features_0x32 =
1928 { "Wacom PL600", WACOM_PKGLEN_GRAPHIRE, 6126, 4604, 255,
1929 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1930static const struct wacom_features wacom_features_0x33 =
1931 { "Wacom PL600SX", WACOM_PKGLEN_GRAPHIRE, 6260, 5016, 255,
1932 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1933static const struct wacom_features wacom_features_0x34 =
1934 { "Wacom PL550", WACOM_PKGLEN_GRAPHIRE, 6144, 4608, 511,
1935 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1936static const struct wacom_features wacom_features_0x35 =
1937 { "Wacom PL800", WACOM_PKGLEN_GRAPHIRE, 7220, 5780, 511,
1938 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1939static const struct wacom_features wacom_features_0x37 =
1940 { "Wacom PL700", WACOM_PKGLEN_GRAPHIRE, 6758, 5406, 511,
1941 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1942static const struct wacom_features wacom_features_0x38 =
1943 { "Wacom PL510", WACOM_PKGLEN_GRAPHIRE, 6282, 4762, 511,
1944 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1945static const struct wacom_features wacom_features_0x39 =
1946 { "Wacom DTU710", WACOM_PKGLEN_GRAPHIRE, 34080, 27660, 511,
1947 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1948static const struct wacom_features wacom_features_0xC4 =
1949 { "Wacom DTF521", WACOM_PKGLEN_GRAPHIRE, 6282, 4762, 511,
1950 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1951static const struct wacom_features wacom_features_0xC0 =
1952 { "Wacom DTF720", WACOM_PKGLEN_GRAPHIRE, 6858, 5506, 511,
1953 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1954static const struct wacom_features wacom_features_0xC2 =
1955 { "Wacom DTF720a", WACOM_PKGLEN_GRAPHIRE, 6858, 5506, 511,
1956 0, PL, WACOM_PL_RES, WACOM_PL_RES };
1957static const struct wacom_features wacom_features_0x03 =
1958 { "Wacom Cintiq Partner", WACOM_PKGLEN_GRAPHIRE, 20480, 15360, 511,
1959 0, PTU, WACOM_PL_RES, WACOM_PL_RES };
1960static const struct wacom_features wacom_features_0x41 =
1961 { "Wacom Intuos2 4x5", WACOM_PKGLEN_INTUOS, 12700, 10600, 1023,
1962 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1963static const struct wacom_features wacom_features_0x42 =
1964 { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023,
1965 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1966static const struct wacom_features wacom_features_0x43 =
1967 { "Wacom Intuos2 9x12", WACOM_PKGLEN_INTUOS, 30480, 24060, 1023,
1968 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1969static const struct wacom_features wacom_features_0x44 =
1970 { "Wacom Intuos2 12x12", WACOM_PKGLEN_INTUOS, 30480, 31680, 1023,
1971 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1972static const struct wacom_features wacom_features_0x45 =
1973 { "Wacom Intuos2 12x18", WACOM_PKGLEN_INTUOS, 45720, 31680, 1023,
1974 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1975static const struct wacom_features wacom_features_0xB0 =
1976 { "Wacom Intuos3 4x5", WACOM_PKGLEN_INTUOS, 25400, 20320, 1023,
1977 63, INTUOS3S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1978static const struct wacom_features wacom_features_0xB1 =
1979 { "Wacom Intuos3 6x8", WACOM_PKGLEN_INTUOS, 40640, 30480, 1023,
1980 63, INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1981static const struct wacom_features wacom_features_0xB2 =
1982 { "Wacom Intuos3 9x12", WACOM_PKGLEN_INTUOS, 60960, 45720, 1023,
1983 63, INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1984static const struct wacom_features wacom_features_0xB3 =
1985 { "Wacom Intuos3 12x12", WACOM_PKGLEN_INTUOS, 60960, 60960, 1023,
1986 63, INTUOS3L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1987static const struct wacom_features wacom_features_0xB4 =
1988 { "Wacom Intuos3 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 1023,
1989 63, INTUOS3L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1990static const struct wacom_features wacom_features_0xB5 =
1991 { "Wacom Intuos3 6x11", WACOM_PKGLEN_INTUOS, 54204, 31750, 1023,
1992 63, INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1993static const struct wacom_features wacom_features_0xB7 =
1994 { "Wacom Intuos3 4x6", WACOM_PKGLEN_INTUOS, 31496, 19685, 1023,
1995 63, INTUOS3S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1996static const struct wacom_features wacom_features_0xB8 =
1997 { "Wacom Intuos4 4x6", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047,
1998 63, INTUOS4S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
1999static const struct wacom_features wacom_features_0xB9 =
2000 { "Wacom Intuos4 6x9", WACOM_PKGLEN_INTUOS, 44704, 27940, 2047,
2001 63, INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
2002static const struct wacom_features wacom_features_0xBA =
2003 { "Wacom Intuos4 8x13", WACOM_PKGLEN_INTUOS, 65024, 40640, 2047,
2004 63, INTUOS4L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
2005static const struct wacom_features wacom_features_0xBB =
2006 { "Wacom Intuos4 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 2047,
2007 63, INTUOS4L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
2008static const struct wacom_features wacom_features_0xBC =
2009 { "Wacom Intuos4 WL", WACOM_PKGLEN_INTUOS, 40640, 25400, 2047,
2010 63, INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
2011static const struct wacom_features wacom_features_0x26 =
2012 { "Wacom Intuos5 touch S", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047,
2013 63, INTUOS5S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
2014 .touch_max = 16 };
2015static const struct wacom_features wacom_features_0x27 =
2016 { "Wacom Intuos5 touch M", WACOM_PKGLEN_INTUOS, 44704, 27940, 2047,
2017 63, INTUOS5, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
2018 .touch_max = 16 };
2019static const struct wacom_features wacom_features_0x28 =
2020 { "Wacom Intuos5 touch L", WACOM_PKGLEN_INTUOS, 65024, 40640, 2047,
2021 63, INTUOS5L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
2022 .touch_max = 16 };
2023static const struct wacom_features wacom_features_0x29 =
2024 { "Wacom Intuos5 S", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047,
2025 63, INTUOS5S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
2026static const struct wacom_features wacom_features_0x2A =
2027 { "Wacom Intuos5 M", WACOM_PKGLEN_INTUOS, 44704, 27940, 2047,
2028 63, INTUOS5, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
2029static const struct wacom_features wacom_features_0x314 =
2030 { "Wacom Intuos Pro S", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047,
2031 63, INTUOSPS, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
2032 .touch_max = 16 };
2033static const struct wacom_features wacom_features_0x315 =
2034 { "Wacom Intuos Pro M", WACOM_PKGLEN_INTUOS, 44704, 27940, 2047,
2035 63, INTUOSPM, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
2036 .touch_max = 16 };
2037static const struct wacom_features wacom_features_0x317 =
2038 { "Wacom Intuos Pro L", WACOM_PKGLEN_INTUOS, 65024, 40640, 2047,
2039 63, INTUOSPL, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
2040 .touch_max = 16 };
2041static const struct wacom_features wacom_features_0xF4 =
2042 { "Wacom Cintiq 24HD", WACOM_PKGLEN_INTUOS, 104280, 65400, 2047,
2043 63, WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
2044 WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET };
2045static const struct wacom_features wacom_features_0xF8 =
2046 { "Wacom Cintiq 24HD touch", WACOM_PKGLEN_INTUOS, 104280, 65400, 2047,
2047 63, WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
2048 WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET,
2049 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf6 };
2050static const struct wacom_features wacom_features_0xF6 =
2051 { "Wacom Cintiq 24HD touch", .type = WACOM_24HDT,
2052 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf8, .touch_max = 10 };
2053static const struct wacom_features wacom_features_0x32A =
2054 { "Wacom Cintiq 27QHD", WACOM_PKGLEN_INTUOS, 119740, 67520, 1023, 63,
2055 WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
2056 WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET };
2057static const struct wacom_features wacom_features_0x3F =
2058 { "Wacom Cintiq 21UX", WACOM_PKGLEN_INTUOS, 87200, 65600, 1023,
2059 63, CINTIQ, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
2060static const struct wacom_features wacom_features_0xC5 =
2061 { "Wacom Cintiq 20WSX", WACOM_PKGLEN_INTUOS, 86680, 54180, 1023,
2062 63, WACOM_BEE, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
2063static const struct wacom_features wacom_features_0xC6 =
2064 { "Wacom Cintiq 12WX", WACOM_PKGLEN_INTUOS, 53020, 33440, 1023,
2065 63, WACOM_BEE, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
2066static const struct wacom_features wacom_features_0x304 =
2067 { "Wacom Cintiq 13HD", WACOM_PKGLEN_INTUOS, 59352, 33648, 1023,
2068 63, WACOM_13HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
2069 WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET };
2070static const struct wacom_features wacom_features_0xC7 =
2071 { "Wacom DTU1931", WACOM_PKGLEN_GRAPHIRE, 37832, 30305, 511,
2072 0, PL, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
2073static const struct wacom_features wacom_features_0xCE =
2074 { "Wacom DTU2231", WACOM_PKGLEN_GRAPHIRE, 47864, 27011, 511,
2075 0, DTU, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
2076static const struct wacom_features wacom_features_0xF0 =
2077 { "Wacom DTU1631", WACOM_PKGLEN_GRAPHIRE, 34623, 19553, 511,
2078 0, DTU, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
2079static const struct wacom_features wacom_features_0x57 =
2080 { "Wacom DTK2241", WACOM_PKGLEN_INTUOS, 95640, 54060, 2047,
2081 63, DTK, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
2082 WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET };
2083static const struct wacom_features wacom_features_0x59 =
2084 { "Wacom DTH2242", WACOM_PKGLEN_INTUOS, 95640, 54060, 2047,
2085 63, DTK, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
2086 WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET,
2087 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5D };
2088static const struct wacom_features wacom_features_0x5D =
2089 { "Wacom DTH2242", .type = WACOM_24HDT,
2090 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x59, .touch_max = 10 };
2091static const struct wacom_features wacom_features_0xCC =
2092 { "Wacom Cintiq 21UX2", WACOM_PKGLEN_INTUOS, 87000, 65400, 2047,
2093 63, WACOM_21UX2, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
2094 WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET };
2095static const struct wacom_features wacom_features_0xFA =
2096 { "Wacom Cintiq 22HD", WACOM_PKGLEN_INTUOS, 95640, 54060, 2047,
2097 63, WACOM_22HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
2098 WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET };
2099static const struct wacom_features wacom_features_0x5B =
2100 { "Wacom Cintiq 22HDT", WACOM_PKGLEN_INTUOS, 95640, 54060, 2047,
2101 63, WACOM_22HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
2102 WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET,
2103 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5e };
2104static const struct wacom_features wacom_features_0x5E =
2105 { "Wacom Cintiq 22HDT", .type = WACOM_24HDT,
2106 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5b, .touch_max = 10 };
2107static const struct wacom_features wacom_features_0x90 =
2108 { "Wacom ISDv4 90", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255,
2109 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
2110static const struct wacom_features wacom_features_0x93 =
2111 { "Wacom ISDv4 93", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255,
2112 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
2113static const struct wacom_features wacom_features_0x97 =
2114 { "Wacom ISDv4 97", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 511,
2115 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
2116static const struct wacom_features wacom_features_0x9A =
2117 { "Wacom ISDv4 9A", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255,
2118 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
2119static const struct wacom_features wacom_features_0x9F =
2120 { "Wacom ISDv4 9F", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255,
2121 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
2122static const struct wacom_features wacom_features_0xE2 =
2123 { "Wacom ISDv4 E2", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255,
2124 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
2125 .touch_max = 2 };
2126static const struct wacom_features wacom_features_0xE3 =
2127 { "Wacom ISDv4 E3", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255,
2128 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
2129 .touch_max = 2 };
2130static const struct wacom_features wacom_features_0xE5 =
2131 { "Wacom ISDv4 E5", WACOM_PKGLEN_MTOUCH, 26202, 16325, 255,
2132 0, MTSCREEN, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
2133static const struct wacom_features wacom_features_0xE6 =
2134 { "Wacom ISDv4 E6", WACOM_PKGLEN_TPC2FG, 27760, 15694, 255,
2135 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
2136 .touch_max = 2 };
2137static const struct wacom_features wacom_features_0xEC =
2138 { "Wacom ISDv4 EC", WACOM_PKGLEN_GRAPHIRE, 25710, 14500, 255,
2139 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
2140static const struct wacom_features wacom_features_0xED =
2141 { "Wacom ISDv4 ED", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255,
2142 0, TABLETPCE, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
2143static const struct wacom_features wacom_features_0xEF =
2144 { "Wacom ISDv4 EF", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255,
2145 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
2146static const struct wacom_features wacom_features_0x100 =
2147 { "Wacom ISDv4 100", WACOM_PKGLEN_MTTPC, 26202, 16325, 255,
2148 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
2149static const struct wacom_features wacom_features_0x101 =
2150 { "Wacom ISDv4 101", WACOM_PKGLEN_MTTPC, 26202, 16325, 255,
2151 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
2152static const struct wacom_features wacom_features_0x10D =
2153 { "Wacom ISDv4 10D", WACOM_PKGLEN_MTTPC, 26202, 16325, 255,
2154 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
2155static const struct wacom_features wacom_features_0x4001 =
2156 { "Wacom ISDv4 4001", WACOM_PKGLEN_MTTPC, 26202, 16325, 255,
2157 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
2158static const struct wacom_features wacom_features_0x47 =
2159 { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023,
2160 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
2161static const struct wacom_features wacom_features_0x84 =
2162 { "Wacom Wireless Receiver", WACOM_PKGLEN_WIRELESS, 0, 0, 0,
2163 0, WIRELESS, 0, 0, .touch_max = 16 };
2164static const struct wacom_features wacom_features_0xD0 =
2165 { "Wacom Bamboo 2FG", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
2166 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
2167 .touch_max = 2 };
2168static const struct wacom_features wacom_features_0xD1 =
2169 { "Wacom Bamboo 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
2170 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
2171 .touch_max = 2 };
2172static const struct wacom_features wacom_features_0xD2 =
2173 { "Wacom Bamboo Craft", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
2174 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
2175 .touch_max = 2 };
2176static const struct wacom_features wacom_features_0xD3 =
2177 { "Wacom Bamboo 2FG 6x8", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023,
2178 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
2179 .touch_max = 2 };
2180static const struct wacom_features wacom_features_0xD4 =
2181 { "Wacom Bamboo Pen", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
2182 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
2183static const struct wacom_features wacom_features_0xD5 =
2184 { "Wacom Bamboo Pen 6x8", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023,
2185 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
2186static const struct wacom_features wacom_features_0xD6 =
2187 { "Wacom BambooPT 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
2188 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
2189 .touch_max = 2 };
2190static const struct wacom_features wacom_features_0xD7 =
2191 { "Wacom BambooPT 2FG Small", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
2192 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
2193 .touch_max = 2 };
2194static const struct wacom_features wacom_features_0xD8 =
2195 { "Wacom Bamboo Comic 2FG", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023,
2196 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
2197 .touch_max = 2 };
2198static const struct wacom_features wacom_features_0xDA =
2199 { "Wacom Bamboo 2FG 4x5 SE", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023,
2200 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
2201 .touch_max = 2 };
2202static struct wacom_features wacom_features_0xDB =
2203 { "Wacom Bamboo 2FG 6x8 SE", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023,
2204 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
2205 .touch_max = 2 };
2206static const struct wacom_features wacom_features_0xDD =
2207 { "Wacom Bamboo Connect", WACOM_PKGLEN_BBPEN, 14720, 9200, 1023,
2208 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
2209static const struct wacom_features wacom_features_0xDE =
2210 { "Wacom Bamboo 16FG 4x5", WACOM_PKGLEN_BBPEN, 14720, 9200, 1023,
2211 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
2212 .touch_max = 16 };
2213static const struct wacom_features wacom_features_0xDF =
2214 { "Wacom Bamboo 16FG 6x8", WACOM_PKGLEN_BBPEN, 21648, 13700, 1023,
2215 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
2216 .touch_max = 16 };
2217static const struct wacom_features wacom_features_0x6004 =
2218 { "ISD-V4", WACOM_PKGLEN_GRAPHIRE, 12800, 8000, 255,
2219 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
2220
2221#define USB_DEVICE_WACOM(prod) \
2222 USB_DEVICE(USB_VENDOR_ID_WACOM, prod), \
2223 .driver_info = (kernel_ulong_t)&wacom_features_##prod
2224
2225#define USB_DEVICE_DETAILED(prod, class, sub, proto) \
2226 USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_WACOM, prod, class, \
2227 sub, proto), \
2228 .driver_info = (kernel_ulong_t)&wacom_features_##prod
2229
2230#define USB_DEVICE_LENOVO(prod) \
2231 USB_DEVICE(USB_VENDOR_ID_LENOVO, prod), \
2232 .driver_info = (kernel_ulong_t)&wacom_features_##prod
2233
2234const struct usb_device_id wacom_ids[] = {
2235 { USB_DEVICE_WACOM(0x00) },
2236 { USB_DEVICE_WACOM(0x10) },
2237 { USB_DEVICE_WACOM(0x11) },
2238 { USB_DEVICE_WACOM(0x12) },
2239 { USB_DEVICE_WACOM(0x13) },
2240 { USB_DEVICE_WACOM(0x14) },
2241 { USB_DEVICE_WACOM(0x15) },
2242 { USB_DEVICE_WACOM(0x16) },
2243 { USB_DEVICE_WACOM(0x17) },
2244 { USB_DEVICE_WACOM(0x18) },
2245 { USB_DEVICE_WACOM(0x19) },
2246 { USB_DEVICE_WACOM(0x60) },
2247 { USB_DEVICE_WACOM(0x61) },
2248 { USB_DEVICE_WACOM(0x62) },
2249 { USB_DEVICE_WACOM(0x63) },
2250 { USB_DEVICE_WACOM(0x64) },
2251 { USB_DEVICE_WACOM(0x65) },
2252 { USB_DEVICE_WACOM(0x69) },
2253 { USB_DEVICE_WACOM(0x6A) },
2254 { USB_DEVICE_WACOM(0x6B) },
2255 { USB_DEVICE_WACOM(0x20) },
2256 { USB_DEVICE_WACOM(0x21) },
2257 { USB_DEVICE_WACOM(0x22) },
2258 { USB_DEVICE_WACOM(0x23) },
2259 { USB_DEVICE_WACOM(0x24) },
2260 { USB_DEVICE_WACOM(0x30) },
2261 { USB_DEVICE_WACOM(0x31) },
2262 { USB_DEVICE_WACOM(0x32) },
2263 { USB_DEVICE_WACOM(0x33) },
2264 { USB_DEVICE_WACOM(0x34) },
2265 { USB_DEVICE_WACOM(0x35) },
2266 { USB_DEVICE_WACOM(0x37) },
2267 { USB_DEVICE_WACOM(0x38) },
2268 { USB_DEVICE_WACOM(0x39) },
2269 { USB_DEVICE_WACOM(0xC4) },
2270 { USB_DEVICE_WACOM(0xC0) },
2271 { USB_DEVICE_WACOM(0xC2) },
2272 { USB_DEVICE_WACOM(0x03) },
2273 { USB_DEVICE_WACOM(0x41) },
2274 { USB_DEVICE_WACOM(0x42) },
2275 { USB_DEVICE_WACOM(0x43) },
2276 { USB_DEVICE_WACOM(0x44) },
2277 { USB_DEVICE_WACOM(0x45) },
2278 { USB_DEVICE_WACOM(0x57) },
2279 { USB_DEVICE_WACOM(0x59) },
2280 { USB_DEVICE_DETAILED(0x5D, USB_CLASS_HID, 0, 0) },
2281 { USB_DEVICE_WACOM(0x5B) },
2282 { USB_DEVICE_DETAILED(0x5E, USB_CLASS_HID, 0, 0) },
2283 { USB_DEVICE_WACOM(0xB0) },
2284 { USB_DEVICE_WACOM(0xB1) },
2285 { USB_DEVICE_WACOM(0xB2) },
2286 { USB_DEVICE_WACOM(0xB3) },
2287 { USB_DEVICE_WACOM(0xB4) },
2288 { USB_DEVICE_WACOM(0xB5) },
2289 { USB_DEVICE_WACOM(0xB7) },
2290 { USB_DEVICE_WACOM(0xB8) },
2291 { USB_DEVICE_WACOM(0xB9) },
2292 { USB_DEVICE_WACOM(0xBA) },
2293 { USB_DEVICE_WACOM(0xBB) },
2294 { USB_DEVICE_WACOM(0xBC) },
2295 { USB_DEVICE_WACOM(0x26) },
2296 { USB_DEVICE_WACOM(0x27) },
2297 { USB_DEVICE_WACOM(0x28) },
2298 { USB_DEVICE_WACOM(0x29) },
2299 { USB_DEVICE_WACOM(0x2A) },
2300 { USB_DEVICE_WACOM(0x3F) },
2301 { USB_DEVICE_WACOM(0xC5) },
2302 { USB_DEVICE_WACOM(0xC6) },
2303 { USB_DEVICE_WACOM(0xC7) },
2304
2305
2306
2307
2308 { USB_DEVICE_DETAILED(0xCE, USB_CLASS_HID,
2309 USB_INTERFACE_SUBCLASS_BOOT,
2310 USB_INTERFACE_PROTOCOL_MOUSE) },
2311 { USB_DEVICE_WACOM(0x84) },
2312 { USB_DEVICE_WACOM(0xD0) },
2313 { USB_DEVICE_WACOM(0xD1) },
2314 { USB_DEVICE_WACOM(0xD2) },
2315 { USB_DEVICE_WACOM(0xD3) },
2316 { USB_DEVICE_WACOM(0xD4) },
2317 { USB_DEVICE_WACOM(0xD5) },
2318 { USB_DEVICE_WACOM(0xD6) },
2319 { USB_DEVICE_WACOM(0xD7) },
2320 { USB_DEVICE_WACOM(0xD8) },
2321 { USB_DEVICE_WACOM(0xDA) },
2322 { USB_DEVICE_WACOM(0xDB) },
2323 { USB_DEVICE_WACOM(0xDD) },
2324 { USB_DEVICE_WACOM(0xDE) },
2325 { USB_DEVICE_WACOM(0xDF) },
2326 { USB_DEVICE_WACOM(0xF0) },
2327 { USB_DEVICE_WACOM(0xCC) },
2328 { USB_DEVICE_WACOM(0x90) },
2329 { USB_DEVICE_WACOM(0x93) },
2330 { USB_DEVICE_WACOM(0x97) },
2331 { USB_DEVICE_WACOM(0x9A) },
2332 { USB_DEVICE_WACOM(0x9F) },
2333 { USB_DEVICE_WACOM(0xE2) },
2334 { USB_DEVICE_WACOM(0xE3) },
2335 { USB_DEVICE_WACOM(0xE5) },
2336 { USB_DEVICE_WACOM(0xE6) },
2337 { USB_DEVICE_WACOM(0xEC) },
2338 { USB_DEVICE_WACOM(0xED) },
2339 { USB_DEVICE_WACOM(0xEF) },
2340 { USB_DEVICE_WACOM(0x100) },
2341 { USB_DEVICE_WACOM(0x101) },
2342 { USB_DEVICE_WACOM(0x10D) },
2343 { USB_DEVICE_WACOM(0x304) },
2344 { USB_DEVICE_DETAILED(0x314, USB_CLASS_HID, 0, 0) },
2345 { USB_DEVICE_DETAILED(0x315, USB_CLASS_HID, 0, 0) },
2346 { USB_DEVICE_DETAILED(0x317, USB_CLASS_HID, 0, 0) },
2347 { USB_DEVICE_WACOM(0x32A) },
2348 { USB_DEVICE_WACOM(0x4001) },
2349 { USB_DEVICE_WACOM(0x47) },
2350 { USB_DEVICE_WACOM(0xF4) },
2351 { USB_DEVICE_WACOM(0xF8) },
2352 { USB_DEVICE_DETAILED(0xF6, USB_CLASS_HID, 0, 0) },
2353 { USB_DEVICE_WACOM(0xFA) },
2354 { USB_DEVICE_LENOVO(0x6004) },
2355 { }
2356};
2357MODULE_DEVICE_TABLE(usb, wacom_ids);
2358