2
* Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@suse.cz>
3
* Copyright (c) 2000 Andreas Bach Aaen <abach@stofanet.dk>
4
* Copyright (c) 2000 Clifford Wolf <clifford@clifford.at>
5
* Copyright (c) 2000 Sam Mosel <sam.mosel@computer.org>
6
* Copyright (c) 2000 James E. Blair <corvus@gnu.org>
7
* Copyright (c) 2000 Daniel Egger <egger@suse.de>
8
* Copyright (c) 2001 Frederic Lepied <flepied@mandrakesoft.com>
9
* Copyright (c) 2002 Christer Nilsson <christer.nilsson@kretskompaniet.se>
10
* Copyright (c) 2002-2008 Ping Cheng <pingc@wacom.com>
11
* Copyright (c) 2002 John Joganic <john@joganic.com>
13
* USB Wacom Graphire and Intuos tablet support
18
* v0.1 (vp) - Initial release
19
* v0.2 (aba) - Support for all buttons / combinations
20
* v0.3 (vp) - Support for Intuos added
21
* v0.4 (sm) - Support for more Intuos models, menustrip
22
* relative mode, proximity.
23
* v0.5 (vp) - Big cleanup, nifty features removed,
24
* they belong in userspace
25
* v1.8 (vp) - Submit URB only when operating, moved to CVS,
26
* use input_report_key instead of report_btn and
28
* v1.11 (vp) - Add URB ->dev setting for new kernels
29
* v1.11 (jb) - Add support for the 4D Mouse & Lens
30
* v1.12 (de) - Add support for two more inking pen IDs
31
* v1.14 (vp) - Use new USB device id probing scheme.
32
* Fix Wacom Graphire mouse wheel
33
* v1.18 (vp) - Fix mouse wheel direction
35
* v1.20 (fl) - Report tool id for Intuos devices
36
* - Multi tools support
37
* - Corrected Intuos protocol decoding (airbrush, 4D mouse, lens cursor...)
38
* - Add PL models support
39
* - Fix Wacom Graphire mouse wheel again
40
* v1.21 (vp) - Removed protocol descriptions
41
* - Added MISC_SERIAL for tool serial numbers
42
* (gb) - Identify version on module load.
43
* v1.21.1 (fl) - added Graphire2 support
44
* v1.21.2 (fl) - added Intuos2 support
45
* - added all the PL ids
46
* v1.21.3 (fl) - added another eraser id from Neil Okamoto
47
* - added smooth filter for Graphire from Peri Hankey
48
* - added PenPartner support from Olaf van Es
49
* - new tool ids from Ole Martin Bjoerndalen
51
* WARNING: THIS IS NOT PART OF THE OFFICIAL KERNEL TREE
52
* THIS IS FOR TESTING PURPOSES
54
* v2.4.30-pc0.6.9 - Supports x86_64 systems
55
* v2.4.30-pc0.7.0 - Added Volito2 support
56
* v2.4.30-pc0.7.1 - Added DTF720, DTU 710, G4
57
* v2.4.30-pc0.7.3 - Added DTF 521, I3 12x12, and I3 12x19
58
* v2.4.30-pc0.7.5 - Support tablet buttons/keys
59
* v2.4.30-pc0.7.7 - Support Intuos outbound tracking
60
* v2.4.30-pc0.7.8 - Added Bamboo
61
* v2.4.30-pc0.7.9 - Added Bamboo1, Bamboo Fun, and Hummingbird
62
* v2.4.30-pc0.7.9-8 - Added Cintiq 20WSX
66
* This program is free software; you can redistribute it and/or modify
67
* it under the terms of the GNU General Public License as published by
68
* the Free Software Foundation; either version 2 of the License, or
69
* (at your option) any later version.
72
#include <linux/autoconf.h>
73
#if defined(CONFIG_MODVERSIONS) && !defined(MODVERSIONS)
78
#include <linux/modversions.h>
81
#include <linux/kernel.h>
82
#include <linux/slab.h>
83
#include <linux/input.h>
84
#include <linux/module.h>
85
#include <linux/init.h>
86
#include <linux/usb.h>
87
#include <linux/smp_lock.h>
88
#include <linux/list.h>
93
#define DRIVER_VERSION "v2.4.30-pc0.8.2-1"
94
#define DRIVER_AUTHOR "Vojtech Pavlik <vojtech@suse.cz>"
96
#define DRIVER_DESC "USB Wacom Graphire and Wacom Intuos tablet driver (LINUXWACOM)"
98
#define DRIVER_DESC "USB Wacom Graphire and Wacom Intuos tablet driver (LINUXWACOM-DEBUG)"
101
MODULE_AUTHOR(DRIVER_AUTHOR);
102
MODULE_DESCRIPTION(DRIVER_DESC);
103
MODULE_LICENSE("GPL");
105
#define USB_VENDOR_ID_WACOM 0x056a
106
#define STYLUS_DEVICE_ID 0x02
107
#define CURSOR_DEVICE_ID 0x06
108
#define ERASER_DEVICE_ID 0x0A
109
#define PAD_DEVICE_ID 0x0F
111
struct wacom_features {
118
void (*irq)(struct urb *urb);
120
unsigned long absbit;
121
unsigned long relbit;
122
unsigned long btnbit;
123
unsigned long digibit;
127
signed char data[10];
128
struct input_dev dev;
129
struct usb_device *usbdev;
131
struct wacom_features *features;
140
static void wacom_pl_irq(struct urb *urb)
142
struct wacom *wacom = urb->context;
143
unsigned char *data = wacom->data;
144
struct input_dev *dev = &wacom->dev;
147
if (urb->status) return;
149
if (data[0] != 2 && data[0] != 5)
151
printk(KERN_INFO "wacom_pl_irq: received unknown report #%d\n", data[0]);
155
/* proximity and pressure */
156
prox = data[1] & 0x40;
158
wacom->id[0] = ERASER_DEVICE_ID;
160
pressure = (signed char) ((data[7] <<1 ) | ((data[4] >> 2) & 1));
161
if ( wacom->features->pressure_max > 350 ) {
162
pressure = (pressure << 1) | ((data[4] >> 6) & 1);
164
pressure += (( wacom->features->pressure_max + 1 )/ 2);
167
* if going from out of proximity into proximity select between the eraser
168
* and the pen based on the state of the stylus2 button, choose eraser if
169
* pressed else choose pen. if not a proximity change from out to in, send
170
* an out of proximity for previous tool then a in for new tool.
172
if (!wacom->tool[0]) {
173
/* Eraser bit set for DTF */
175
wacom->tool[1] = BTN_TOOL_RUBBER;
177
/* Going into proximity select tool */
178
wacom->tool[1] = (data[4] & 0x20)? BTN_TOOL_RUBBER : BTN_TOOL_PEN;
181
/* was entered with stylus2 pressed */
182
if (wacom->tool[1] == BTN_TOOL_RUBBER && !(data[4] & 0x20) ) {
183
/* report out proximity for previous tool */
184
input_report_abs(dev, ABS_MISC, wacom->id[0]); /* report tool id */
185
input_report_key(dev, wacom->tool[1], 0);
186
input_event(dev, EV_MSC, MSC_SERIAL, wacom->id[0]);
187
wacom->tool[1] = BTN_TOOL_PEN;
191
if (wacom->tool[1] != BTN_TOOL_RUBBER) {
192
/* Unknown tool selected default to pen tool */
193
wacom->tool[1] = BTN_TOOL_PEN;
194
wacom->id[0] = STYLUS_DEVICE_ID;
196
input_report_key(dev, wacom->tool[1], prox); /* report in proximity for tool */
197
input_report_abs(dev, ABS_MISC, wacom->id[0]); /* report tool id */
198
input_report_abs(dev, ABS_X, data[3] | ((__u32)data[2] << 7) | ((__u32)(data[1] & 0x03) << 14));
199
input_report_abs(dev, ABS_Y, data[6] | ((__u32)data[5] << 7) | ((__u32)(data[4] & 0x03) << 14));
200
input_report_abs(dev, ABS_PRESSURE, pressure);
201
input_report_key(dev, BTN_TOUCH, data[4] & 0x08);
202
input_report_key(dev, BTN_STYLUS, data[4] & 0x10);
203
/* Only allow the stylus2 button to be reported for the pen tool. */
204
input_report_key(dev, BTN_STYLUS2, (wacom->tool[1] == BTN_TOOL_PEN) && (data[4] & 0x20));
207
/* report proximity-out of a (valid) tool */
208
if (wacom->tool[1] != BTN_TOOL_RUBBER) {
209
/* Unknown tool selected default to pen tool */
210
wacom->tool[1] = BTN_TOOL_PEN;
212
input_report_key(dev, wacom->tool[1], prox);
213
input_report_abs(dev, ABS_MISC, 0); /* reset tool id */
216
wacom->tool[0] = prox; /* Save proximity state */
217
/* end of proximity code */
219
input_event(dev, EV_MSC, MSC_SERIAL, wacom->id[0]);
222
static void wacom_ptu_irq(struct urb *urb)
224
struct wacom *wacom = urb->context;
225
unsigned char *data = wacom->data;
226
struct input_dev *dev = &wacom->dev;
228
if (urb->status) return;
230
if (data[0] != 2 && data[0] != 5)
232
printk(KERN_INFO "wacom_ptu_irq: received unknown report #%d\n", data[0]);
238
input_report_key(dev, BTN_TOOL_RUBBER, data[1] & 0x20);
239
input_report_key(dev, BTN_TOUCH, data[1] & 0x08);
240
wacom->id[0] = ERASER_DEVICE_ID;
244
input_report_key(dev, BTN_TOOL_PEN, data[1] & 0x20);
245
input_report_key(dev, BTN_TOUCH, data[1] & 0x01);
246
wacom->id[0] = STYLUS_DEVICE_ID;
248
input_report_abs(dev, ABS_MISC, wacom->id[0]); /* report tool id */
249
input_report_abs(dev, ABS_X, data[3] << 8 | data[2]);
250
input_report_abs(dev, ABS_Y, data[5] << 8 | data[4]);
251
input_report_abs(dev, ABS_PRESSURE, (data[6]|data[7] << 8));
252
input_report_key(dev, BTN_STYLUS, data[1] & 0x02);
253
input_report_key(dev, BTN_STYLUS2, data[1] & 0x10);
255
input_event(dev, EV_MSC, MSC_SERIAL, wacom->id[0]);
259
static void wacom_penpartner_irq(struct urb *urb)
261
struct wacom *wacom = urb->context;
262
unsigned char *data = wacom->data;
263
struct input_dev *dev = &wacom->dev;
265
if (urb->status) return;
269
if (data[5] & 0x80) {
270
wacom->tool[0] = (data[5] & 0x20) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN;
271
wacom->id[0] = (data[5] & 0x20) ? ERASER_DEVICE_ID : STYLUS_DEVICE_ID;
272
input_report_key(dev, wacom->tool[0], 1);
273
input_report_abs(dev, ABS_MISC, wacom->id[0]); /* report tool id */
274
input_report_abs(dev, ABS_X, data[2] << 8 | data[1]);
275
input_report_abs(dev, ABS_Y, data[4] << 8 | data[3]);
276
input_report_abs(dev, ABS_PRESSURE, (signed char)data[6] + 127);
277
input_report_key(dev, BTN_TOUCH, ((signed char)data[6] > -127));
278
input_report_key(dev, BTN_STYLUS, (data[5] & 0x40));
280
input_report_key(dev, wacom->tool[0], 0);
281
input_report_abs(dev, ABS_MISC, 0); /* report tool id */
282
input_report_abs(dev, ABS_PRESSURE, -1);
283
input_report_key(dev, BTN_TOUCH, 0);
285
input_event(dev, EV_MSC, MSC_SERIAL, data[5] & 0x80);
288
input_report_key(dev, BTN_TOOL_PEN, 1);
289
input_report_abs(dev, ABS_MISC, STYLUS_DEVICE_ID); /* report tool id */
290
input_report_abs(dev, ABS_X, data[2] << 8 | data[1]);
291
input_report_abs(dev, ABS_Y, data[4] << 8 | data[3]);
292
input_report_abs(dev, ABS_PRESSURE, (signed char)data[6] + 127);
293
input_report_key(dev, BTN_TOUCH, ((signed char)data[6] > -80) && !(data[5] & 0x20));
294
input_report_key(dev, BTN_STYLUS, (data[5] & 0x40));
295
input_event(dev, EV_MSC, MSC_SERIAL, ((signed char)data[6] > -80) && !(data[5] & 0x20));
298
printk(KERN_INFO "wacom_penpartner_irq: received unknown report #%d\n", data[0]);
299
wacom_request_reset(wacom);
304
static void wacom_graphire_irq(struct urb *urb)
306
struct wacom *wacom = urb->context;
307
unsigned char *data = wacom->data;
308
struct input_dev *dev = &wacom->dev;
311
if (urb->status) return;
313
/* 2 Volito1 and 2 users say this is wrong
314
if (data[0] == 99) return; */
318
printk(KERN_INFO "wacom_graphire_irq: received unknown report #%d\n", data[0]);
322
if (data[1] & 0x80) {
323
/* in prox and not a pad data */
325
switch ((data[1] >> 5) & 3) {
328
wacom->tool[0] = BTN_TOOL_PEN;
329
wacom->id[0] = STYLUS_DEVICE_ID;
333
wacom->tool[0] = BTN_TOOL_RUBBER;
334
wacom->id[0] = ERASER_DEVICE_ID;
337
case 2: /* Mouse with wheel */
338
input_report_key(dev, BTN_MIDDLE, data[1] & 0x04);
339
if ( strstr(wacom->features->name, "Graphire4") ||
340
strstr(wacom->features->name, "Bamboo") ) {
341
rw = data[7] & 0x04 ? (data[7] & 0x03)-4 : data[7] & 0x03;
342
input_report_rel(dev, REL_WHEEL, -rw);
344
input_report_rel(dev, REL_WHEEL, -(signed char) data[6]);
347
case 3: /* Mouse without wheel */
348
wacom->tool[0] = BTN_TOOL_MOUSE;
349
wacom->id[0] = CURSOR_DEVICE_ID;
350
input_report_key(dev, BTN_LEFT, data[1] & 0x01);
351
input_report_key(dev, BTN_RIGHT, data[1] & 0x02);
352
if ( strstr(wacom->features->name, "Graphire4") ||
353
strstr(wacom->features->name, "Bamboo") )
354
input_report_abs(dev, ABS_DISTANCE, data[6]);
356
input_report_abs(dev, ABS_DISTANCE, data[7]);
359
x = data[2] | ((__u32)data[3] << 8);
360
y = data[4] | ((__u32)data[5] << 8);
361
input_report_abs(dev, ABS_X, x);
362
input_report_abs(dev, ABS_Y, y);
364
if (wacom->tool[0] != BTN_TOOL_MOUSE) {
365
input_report_abs(dev, ABS_PRESSURE, data[6] | ((__u32)data[7] << 8));
366
input_report_key(dev, BTN_TOUCH, data[1] & 0x01);
367
input_report_key(dev, BTN_STYLUS, data[1] & 0x02);
368
input_report_key(dev, BTN_STYLUS2, data[1] & 0x04);
370
input_report_abs(dev, ABS_MISC, wacom->id[0]); /* report tool id */
371
input_report_key(dev, wacom->tool[0], 1);
372
} else if (wacom->id[0]) {
373
input_report_abs(dev, ABS_X, 0);
374
input_report_abs(dev, ABS_Y, 0);
375
if (wacom->tool[0] == BTN_TOOL_MOUSE) {
376
input_report_key(dev, BTN_LEFT, 0);
377
input_report_key(dev, BTN_RIGHT, 0);
378
input_report_abs(dev, ABS_DISTANCE, 0);
380
input_report_abs(dev, ABS_PRESSURE, 0);
381
input_report_key(dev, BTN_TOUCH, 0);
382
input_report_key(dev, BTN_STYLUS, 0);
383
input_report_key(dev, BTN_STYLUS2, 0);
386
input_report_abs(dev, ABS_MISC, 0); /* reset tool id */
387
input_report_key(dev, wacom->tool[0], 0);
389
input_event(dev, EV_MSC, MSC_SERIAL,wacom->id[0]);
392
if ( strstr(wacom->features->name, "Graphire4") ) {
393
if (data[7] & 0xf8) {
394
wacom->id[1] = PAD_DEVICE_ID;
395
input_report_key(dev, BTN_0, (data[7] & 0x40));
396
input_report_key(dev, BTN_4, (data[7] & 0x80));
397
rw = ((data[7] & 0x18) >> 3) - ((data[7] & 0x20) >> 3);
398
input_report_rel(dev, REL_WHEEL, rw);
399
input_report_key(dev, BTN_TOOL_FINGER, 0xf0);
400
input_report_abs(dev, ABS_MISC, wacom->id[1]);
401
input_event(dev, EV_MSC, MSC_SERIAL, 0xf0);
402
} else if ( wacom->id[1] ) {
404
input_report_key(dev, BTN_0, (data[7] & 0x40));
405
input_report_key(dev, BTN_4, (data[7] & 0x80));
406
input_report_rel(dev, REL_WHEEL, 0);
407
input_report_key(dev, BTN_TOOL_FINGER, 0);
408
input_report_abs(dev, ABS_MISC, 0);
409
input_event(dev, EV_MSC, MSC_SERIAL, 0xf0);
412
if ( strstr(wacom->features->name, "Bamboo") ) {
413
if ((data[7] & 0xf8) || (data[8] & 0xff)) {
414
wacom->id[1] = PAD_DEVICE_ID;
415
input_report_key(dev, BTN_0, (data[7] & 0x08));
416
input_report_key(dev, BTN_1, (data[7] & 0x20));
417
input_report_key(dev, BTN_4, (data[7] & 0x10));
418
input_report_key(dev, BTN_5, (data[7] & 0x40));
419
input_report_abs(dev, ABS_WHEEL, (data[8] & 0x7f));
420
input_report_key(dev, BTN_TOOL_FINGER, 0xf0);
421
input_report_abs(dev, ABS_MISC, wacom->id[1]);
422
input_event(dev, EV_MSC, MSC_SERIAL, 0xf0);
423
} else if (wacom->id[1]) {
425
input_report_key(dev, BTN_0, (data[7] & 0x08));
426
input_report_key(dev, BTN_1, (data[7] & 0x20));
427
input_report_key(dev, BTN_4, (data[7] & 0x10));
428
input_report_key(dev, BTN_5, (data[7] & 0x40));
429
input_report_abs(dev, ABS_WHEEL, (data[8] & 0x7f));
430
input_report_key(dev, BTN_TOOL_FINGER, 0);
431
input_report_abs(dev, ABS_MISC, 0);
432
input_event(dev, EV_MSC, MSC_SERIAL, 0xf0);
437
static int wacom_intuos_inout(struct urb *urb)
439
struct wacom *wacom = urb->context;
440
unsigned char *data = wacom->data;
441
struct input_dev *dev = &wacom->dev;
445
idx = data[1] & 0x01;
448
if ((data[1] & 0xfc) == 0xc0)
450
/* serial number of the tool */
451
wacom->serial[idx] = ((__u32)(data[3] & 0x0f) << 28) +
452
((__u32)data[4] << 20) + ((__u32)data[5] << 12) +
453
((__u32)data[6] << 4) + ((__u32)data[7] >> 4);
456
printk(KERN_INFO "wacom_intuos_irq: tool change 0x%03X\n",
457
(((__u32)data[2] << 4) | (data[3] >> 4)));
460
wacom->id[idx] = ((__u32)data[2] << 4) | (data[3] >> 4);
461
switch (wacom->id[idx])
463
case 0x812: /* Intuos2 ink pen XP-110-00A */
464
case 0x801: /* Intuos3 Inking pen */
465
case 0x012: /* Inking pen */
466
wacom->tool[idx] = BTN_TOOL_PENCIL; break;
468
case 0x822: /* Intuos Pen GP-300E-01H */
469
case 0x852: /* Intuos2 Grip Pen XP-501E-00A */
470
case 0x842: /* Designer Pen */
471
case 0x823: /* Intuos3 Grip Pen */
472
case 0x813: /* Intuos3 Classic Pen */
473
case 0x885: /* Intuos3 Marker Pen */
475
wacom->tool[idx] = BTN_TOOL_PEN; break;
477
case 0x832: /* Intuos2 stroke pen XP-120-00A */
478
case 0x032: /* Stroke pen */
479
wacom->tool[idx] = BTN_TOOL_BRUSH; break;
481
case 0x007: /* 2D Mouse */
482
case 0x09C: /* ?? Mouse - not a valid code according to Wacom */
483
case 0x094: /* 4D Mouse */
484
case 0x017: /* Intuos3 2D Mouse */
485
wacom->tool[idx] = BTN_TOOL_MOUSE; break;
487
case 0x096: /* Lens cursor */
488
case 0x097: /* Intuos3 Lens cursor */
489
wacom->tool[idx] = BTN_TOOL_LENS; break;
495
case 0x0FA: /* Eraser */
496
case 0x82B: /* Intuos3 Grip Pen Eraser */
497
case 0x81B: /* Intuos3 Classic Pen Eraser */
498
case 0x91B: /* Intuos3 Airbrush Eraser */
499
wacom->tool[idx] = BTN_TOOL_RUBBER; break;
501
case 0x112: /* Airbrush */
502
case 0x912: /* Intuos2 Airbrush */
503
case 0xD12: /* Intuos Airbrush */
504
case 0x913: /* Intuos3 Airbrush */
505
wacom->tool[idx] = BTN_TOOL_AIRBRUSH; break;
507
default: /* Unknown tool */
508
wacom->tool[idx] = BTN_TOOL_PEN; break;
514
if ((data[1] & 0xfe) == 0x80)
516
input_report_abs(dev, ABS_X, 0);
517
input_report_abs(dev, ABS_Y, 0);
518
input_report_abs(dev, ABS_DISTANCE, 0);
519
if (wacom->tool[idx] >= BTN_TOOL_MOUSE) {
520
input_report_key(dev, BTN_LEFT, 0);
521
input_report_key(dev, BTN_MIDDLE, 0);
522
input_report_key(dev, BTN_RIGHT, 0);
523
input_report_key(dev, BTN_SIDE, 0);
524
input_report_key(dev, BTN_EXTRA, 0);
525
input_report_abs(dev, ABS_THROTTLE, 0);
526
input_report_abs(dev, ABS_RZ, 0);
528
input_report_abs(dev, ABS_PRESSURE, 0);
529
input_report_abs(dev, ABS_TILT_X, 0);
530
input_report_abs(dev, ABS_TILT_Y, 0);
531
input_report_key(dev, BTN_STYLUS, 0);
532
input_report_key(dev, BTN_STYLUS2, 0);
533
input_report_key(dev, BTN_TOUCH, 0);
534
input_report_abs(dev, ABS_WHEEL, 0);
535
input_report_abs(dev, ABS_Z, 0);
537
input_report_key(dev, wacom->tool[idx], 0);
538
input_report_abs(dev, ABS_MISC, 0); /* reset tool id */
539
input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]);
545
static void wacom_intuos_general(struct urb *urb)
547
struct wacom *wacom = urb->context;
548
unsigned char *data = wacom->data;
549
struct input_dev *dev = &wacom->dev;
552
/* general pen packet */
553
if ((data[1] & 0xb8) == 0xa0)
555
t = ((__u32)data[6] << 2) | ((data[7] >> 6) & 3);
556
input_report_abs(dev, ABS_PRESSURE, t);
557
input_report_abs(dev, ABS_TILT_X,
558
((data[7] << 1) & 0x7e) | (data[8] >> 7));
559
input_report_abs(dev, ABS_TILT_Y, data[8] & 0x7f);
560
input_report_key(dev, BTN_STYLUS, data[1] & 2);
561
input_report_key(dev, BTN_STYLUS2, data[1] & 4);
562
input_report_key(dev, BTN_TOUCH, t > 10);
565
/* airbrush second packet */
566
if ((data[1] & 0xbc) == 0xb4)
568
input_report_abs(dev, ABS_WHEEL,
569
((__u32)data[6] << 2) | ((data[7] >> 6) & 3));
570
input_report_abs(dev, ABS_TILT_X,
571
((data[7] << 1) & 0x7e) | (data[8] >> 7));
572
input_report_abs(dev, ABS_TILT_Y, data[8] & 0x7f);
577
static void wacom_intuos_irq(struct urb *urb)
579
struct wacom *wacom = urb->context;
580
unsigned char *data = wacom->data;
581
struct input_dev *dev = &wacom->dev;
585
if (urb->status) return;
587
/* check for valid report */
588
if (data[0] != 2 && data[0] != 5 && data[0] != 6 && data[0] != 12)
590
printk(KERN_INFO "wacom_intuos_irq: received unknown report #%d\n", data[0]);
595
idx = data[1] & 0x01;
597
/* pad packets. Works as a second tool */
598
if (data[0] == 12 && (strstr(wacom->features->name, "Intuos3") ||
599
strstr(wacom->features->name, "Cintiq")) )
601
/* initiate the pad as a device */
602
if (wacom->tool[1] != BTN_TOOL_FINGER)
603
wacom->tool[1] = BTN_TOOL_FINGER;
605
input_report_key(dev, BTN_0, (data[5] & 0x01));
606
input_report_key(dev, BTN_1, (data[5] & 0x02));
607
input_report_key(dev, BTN_2, (data[5] & 0x04));
608
input_report_key(dev, BTN_3, (data[5] & 0x08));
609
input_report_key(dev, BTN_4, (data[6] & 0x01));
610
input_report_key(dev, BTN_5, (data[6] & 0x02));
611
input_report_key(dev, BTN_6, (data[6] & 0x04));
612
input_report_key(dev, BTN_7, (data[6] & 0x08));
613
input_report_key(dev, BTN_8, (data[5] & 0x10));
614
input_report_key(dev, BTN_9, (data[6] & 0x10));
615
input_report_abs(dev, ABS_RX, ((data[1] & 0x1f) << 8) | data[2]);
616
input_report_abs(dev, ABS_RY, ((data[3] & 0x1f) << 8) | data[4]);
618
if((data[5] & 0x1f) | (data[6] & 0x1f) | (data[1] & 0x1f) |
619
data[2] | (data[3] & 0x1f) | data[4]) {
620
input_report_key(dev, wacom->tool[1], 1);
621
input_report_abs(dev, ABS_MISC, PAD_DEVICE_ID);
623
input_report_key(dev, wacom->tool[1], 0);
624
input_report_abs(dev, ABS_MISC, 0);
626
input_event(dev, EV_MSC, MSC_SERIAL, 0xffffffff);
630
/* process in/out prox events */
631
if (wacom_intuos_inout(urb)) return;
633
/* Only large I3 supports Lens Cursor */
634
if((wacom->tool[idx] == BTN_TOOL_LENS) && strstr(wacom->features->name, "Intuos3"))
635
if (!(strstr(wacom->features->name, "Intuos3 12x12")
636
|| strstr(wacom->features->name, "Intuos3 12x19")))
639
/* Cintiq doesn't send data when RDY bit isn't set */
640
if (strstr(wacom->features->name, "Cintiq") && !(data[1] & 0x40)) return;
642
if(strstr(wacom->features->name, "Intuos3") || strstr(wacom->features->name, "Cintiq"))
644
input_report_abs(dev, ABS_X, ((__u32)data[2] << 9) | ((__u32)data[3] << 1) | ((data[9] >> 1) & 1));
645
input_report_abs(dev, ABS_Y, ((__u32)data[4] << 9) | ((__u32)data[5] << 1) | (data[9] & 1));
646
input_report_abs(dev, ABS_DISTANCE, ((data[9] >> 2) & 0x3f));
650
input_report_abs(dev, ABS_X, ((__u32)data[2] << 8) | data[3]);
651
input_report_abs(dev, ABS_Y, ((__u32)data[4] << 8) | data[5]);
652
input_report_abs(dev, ABS_DISTANCE, ((data[9] >> 3) & 0x1f));
655
/* process general packets */
656
wacom_intuos_general(urb);
658
/* 4D mouse, 2D mouse, marker pen rotation, or Lens cursor packets */
659
if ((data[1] & 0xbc) == 0xa8 || (data[1] & 0xbe) == 0xb0)
661
/* Rotation packet */
664
if(strstr(wacom->features->name, "Intuos3") ||
665
strstr(wacom->features->name, "Cintiq"))
667
/* I3 marker pen rotation */
668
t = ((__u32)data[6] << 3) | ((data[7] >> 5) & 7);
669
t = (data[7] & 0x20) ? ((t > 900) ? ((t-1) / 2 - 1350) :
670
((t-1) / 2 + 450)) : (450 - t / 2) ;
671
input_report_abs(dev, ABS_Z, t);
675
/* 4D mouse rotation packet */
676
t = ((__u32)data[6] << 3) | ((data[7] >> 5) & 7);
677
input_report_abs(dev, ABS_RZ, (data[7] & 0x20) ?
678
((t - 1) / 2) : -t / 2);
682
/* 4D mouse packets */
683
else if ( !(data[1] & 0x10) && !strstr(wacom->features->name, "Intuos3"))
685
input_report_key(dev, BTN_LEFT, data[8] & 0x01);
686
input_report_key(dev, BTN_MIDDLE, data[8] & 0x02);
687
input_report_key(dev, BTN_RIGHT, data[8] & 0x04);
688
input_report_key(dev, BTN_SIDE, data[8] & 0x20);
689
input_report_key(dev, BTN_EXTRA, data[8] & 0x10);
690
/* throttle is positive when rolled backwards */
691
t = ((__u32)data[6] << 2) | ((data[7] >> 6) & 3);
692
input_report_abs(dev, ABS_THROTTLE, (data[8] & 0x08) ? -t : t);
695
/* 2D mouse packets */
696
else if (wacom->tool[idx] == BTN_TOOL_MOUSE)
698
input_report_key(dev, BTN_LEFT, data[8] & 0x04);
699
input_report_key(dev, BTN_MIDDLE, data[8] & 0x08);
700
input_report_key(dev, BTN_RIGHT, data[8] & 0x10);
701
/* mouse wheel is positive when rolled backwards */
702
input_report_rel(dev, REL_WHEEL, (__u32)(data[8] & 0x01)
703
- (__u32)((data[8] & 0x02) >> 1));
705
/* I3 2D mouse side buttons */
706
if (strstr(wacom->features->name, "Intuos3"))
708
input_report_key(dev, BTN_SIDE, data[8] & 0x40);
709
input_report_key(dev, BTN_EXTRA, data[8] & 0x20);
712
/* lens cursor packets */
713
else if ( !strstr(wacom->features->name, "Intuos3") )
715
input_report_key(dev, BTN_LEFT, data[8] & 0x01);
716
input_report_key(dev, BTN_MIDDLE, data[8] & 0x02);
717
input_report_key(dev, BTN_RIGHT, data[8] & 0x04);
718
input_report_key(dev, BTN_SIDE, data[8] & 0x10);
719
input_report_key(dev, BTN_EXTRA, data[8] & 0x08);
723
input_report_abs(dev, ABS_MISC, wacom->id[idx]); /* report tool id */
724
input_report_key(dev, wacom->tool[idx], 1);
725
input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]);
728
#define WACOM_GRAPHIRE_BITS (BIT(EV_REL))
729
#define WACOM_GRAPHIRE_REL (BIT(REL_WHEEL))
730
#define WACOM_G4_TOOLS (BIT(BTN_TOOL_FINGER))
731
#define WACOM_G4_BUTTONS (BIT(BTN_0) | BIT(BTN_4))
732
#define WACOM_MO_BUTTONS (WACOM_G4_BUTTONS | BIT(BTN_1) | BIT(BTN_5))
733
#define WACOM_MO_ABS (BIT(ABS_WHEEL))
734
#define WACOM_INTUOS_TOOLS (BIT(BTN_TOOL_BRUSH) | BIT(BTN_TOOL_PENCIL) | BIT(BTN_TOOL_AIRBRUSH) | BIT(BTN_TOOL_LENS))
735
#define WACOM_INTUOS3_TOOLS (WACOM_INTUOS_TOOLS | BIT(BTN_TOOL_FINGER))
736
#define WACOM_INTUOS_BUTTONS (BIT(BTN_SIDE) | BIT(BTN_EXTRA))
737
#define WACOM_INTUOS3S_BUTTONS (WACOM_INTUOS_BUTTONS | BIT(BTN_0) | BIT(BTN_1) | BIT(BTN_2) | BIT(BTN_3))
738
#define WACOM_INTUOS3_BUTTONS (WACOM_INTUOS3S_BUTTONS | BIT(BTN_4) | BIT(BTN_5) | BIT(BTN_6) | BIT(BTN_7))
739
#define WACOM_BEE_BUTTONS (WACOM_INTUOS3_BUTTONS | BIT(BTN_8) | BIT(BTN_9))
740
#define WACOM_INTUOS_BITS (BIT(EV_REL))
741
#define WACOM_INTUOS_REL (BIT(REL_WHEEL))
742
#define WACOM_INTUOS_ABS (BIT(ABS_TILT_X) | BIT(ABS_TILT_Y) | BIT(ABS_RZ) | BIT(ABS_THROTTLE))
743
#define WACOM_INTUOS3S_ABS (WACOM_INTUOS_ABS | BIT(ABS_RX) | BIT(ABS_Z))
744
#define WACOM_INTUOS3_ABS (WACOM_INTUOS3S_ABS | BIT(ABS_RY))
746
struct wacom_features wacom_features[] = {
749
/* 0 */ { "Wacom Penpartner", 7, 5040, 3780, 255, 0,
750
wacom_penpartner_irq, 0, 0, 0, 0 },
753
/* 1 */ { "Wacom Graphire", 8, 10206, 7422, 511, 63,
754
wacom_graphire_irq, WACOM_GRAPHIRE_BITS, 0, WACOM_GRAPHIRE_REL, 0 },
755
/* 2 */ { "Wacom Graphire2 4x5", 8, 10206, 7422, 511, 63,
756
wacom_graphire_irq, WACOM_GRAPHIRE_BITS, 0, WACOM_GRAPHIRE_REL, 0 },
757
/* 3 */ { "Wacom Graphire2 5x7", 8, 13918, 10206, 511, 63,
758
wacom_graphire_irq, WACOM_GRAPHIRE_BITS, 0, WACOM_GRAPHIRE_REL, 0 },
761
/* 4 */ { "Wacom Intuos 4x5", 10, 12700, 10600, 1023, 31,
762
wacom_intuos_irq, WACOM_INTUOS_BITS, WACOM_INTUOS_ABS,
763
WACOM_INTUOS_REL, WACOM_INTUOS_BUTTONS, WACOM_INTUOS_TOOLS },
764
/* JEJ - confirmed X and Y range from test tablet */
765
/* 5 */ { "Wacom Intuos 6x8", 10, 20320, 16240, 1023, 31,
766
wacom_intuos_irq, WACOM_INTUOS_BITS, WACOM_INTUOS_ABS,
767
WACOM_INTUOS_REL, WACOM_INTUOS_BUTTONS, WACOM_INTUOS_TOOLS },
768
/* 6 */ { "Wacom Intuos 9x12", 10, 30480, 24060, 1023, 31,
769
wacom_intuos_irq, WACOM_INTUOS_BITS, WACOM_INTUOS_ABS,
770
WACOM_INTUOS_REL, WACOM_INTUOS_BUTTONS, WACOM_INTUOS_TOOLS },
771
/* 7 */ { "Wacom Intuos 12x12", 10, 30480, 31680, 1023, 31,
772
wacom_intuos_irq, WACOM_INTUOS_BITS, WACOM_INTUOS_ABS,
773
WACOM_INTUOS_REL, WACOM_INTUOS_BUTTONS, WACOM_INTUOS_TOOLS },
774
/* 8 */ { "Wacom Intuos 12x18", 10, 45720, 31680, 1023, 31,
775
wacom_intuos_irq, WACOM_INTUOS_BITS, WACOM_INTUOS_ABS,
776
WACOM_INTUOS_REL, WACOM_INTUOS_BUTTONS, WACOM_INTUOS_TOOLS },
779
/* 9 */ { "Wacom PL400", 8, 5408, 4056, 255, 0,
780
wacom_pl_irq, 0, 0, 0, 0 },
781
/* 10 */ { "Wacom PL500", 8, 6144, 4608, 255, 0,
782
wacom_pl_irq, 0, 0, 0, 0 },
783
/* 11 */ { "Wacom PL600", 8, 6126, 4604, 255, 0,
784
wacom_pl_irq, 0, 0, 0, 0 },
785
/* 12 */ { "Wacom PL600SX", 8, 6260, 5016, 255, 0,
786
wacom_pl_irq, 0, 0, 0, 0 },
787
/* 13 */ { "Wacom PL550", 8, 6144, 4608, 511, 0,
788
wacom_pl_irq, 0, 0, 0, 0 },
789
/* 14 */ { "Wacom PL800", 8, 7220, 5780, 511, 0,
790
wacom_pl_irq, 0, 0, 0, 0 },
791
/* 15 */ { "Wacom PL700", 8, 6758, 5406, 511, 0,
792
wacom_pl_irq, 0, 0, 0, 0 },
793
/* 16 */ { "Wacom PL510", 8, 6282, 4762, 511, 0,
794
wacom_pl_irq, 0, 0, 0, 0 },
795
/* 17 */ { "Wacom DTU710", 8, 34080, 27660, 511, 0,
796
wacom_pl_irq, 0, 0, 0, 0 },
799
/* JEJ - confirmed X and Y range from J.N. tablet */
800
/* 18 */ { "Wacom Intuos2 4x5", 10, 12700, 10600, 1023, 31,
801
wacom_intuos_irq, WACOM_INTUOS_BITS, WACOM_INTUOS_ABS,
802
WACOM_INTUOS_REL, WACOM_INTUOS_BUTTONS, WACOM_INTUOS_TOOLS },
803
/* JEJ - confirmed X and Y range from R.T. and J.S. tablets */
804
/* 19 */ { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 31,
805
wacom_intuos_irq, WACOM_INTUOS_BITS, WACOM_INTUOS_ABS,
806
WACOM_INTUOS_REL, WACOM_INTUOS_BUTTONS, WACOM_INTUOS_TOOLS },
807
/* JEJ - values from serial 9x12 */
808
/* 20 */ { "Wacom Intuos2 9x12", 10, 30480, 24060, 1023, 31,
809
wacom_intuos_irq, WACOM_INTUOS_BITS, WACOM_INTUOS_ABS,
810
WACOM_INTUOS_REL, WACOM_INTUOS_BUTTONS, WACOM_INTUOS_TOOLS },
811
/* JEJ - confirmed X and Y range from J.J. tablet */
812
/* 21 */ { "Wacom Intuos2 12x12", 10, 30480, 31680, 1023, 31,
813
wacom_intuos_irq, WACOM_INTUOS_BITS, WACOM_INTUOS_ABS,
814
WACOM_INTUOS_REL, WACOM_INTUOS_BUTTONS, WACOM_INTUOS_TOOLS },
815
/* 22 */ { "Wacom Intuos2 12x18", 10, 45720, 31680, 1023, 31,
816
wacom_intuos_irq, WACOM_INTUOS_BITS, WACOM_INTUOS_ABS,
817
WACOM_INTUOS_REL, WACOM_INTUOS_BUTTONS, WACOM_INTUOS_TOOLS },
819
/* 23 */ { "Wacom Volito1", 8, 5104, 3712, 511, 63,
820
wacom_graphire_irq, WACOM_GRAPHIRE_BITS, 0, 0, 0 },
821
/* Volito2 - PenPartner - PenStation */
822
/* 24 */ { "Wacom PenStation2", 8, 3250, 2320, 255, 63,
823
wacom_graphire_irq, WACOM_GRAPHIRE_BITS, 0, 0, 0 },
824
/* 25 */ { "Wacom Volito2 4x5", 8, 5104, 3712, 511, 63,
825
wacom_graphire_irq, WACOM_GRAPHIRE_BITS, 0, 0, 0 },
826
/* 26 */ { "Wacom Volito2 2x3", 8, 3250, 2320, 511, 63,
827
wacom_graphire_irq, WACOM_GRAPHIRE_BITS, 0, 0, 0 },
828
/* 27 */ { "Wacom PenPartner2", 8, 3250, 2320, 511, 63,
829
wacom_graphire_irq, WACOM_GRAPHIRE_BITS, 0, 0, 0 },
830
/* 28 */ { "Wacom Bamboo", 9, 14760, 9225, 511, 63,
831
wacom_graphire_irq, WACOM_GRAPHIRE_BITS, WACOM_MO_ABS,
832
WACOM_GRAPHIRE_REL, WACOM_MO_BUTTONS, WACOM_G4_TOOLS },
833
/* 29 */ { "Wacom Bamboo1", 8, 5104, 3712, 511, 63,
834
wacom_graphire_irq, WACOM_GRAPHIRE_BITS, 0, 0, 0 },
835
/* 30 */ { "Wacom Graphire3 4x5", 8, 10208, 7424, 511, 63,
836
wacom_graphire_irq, WACOM_GRAPHIRE_BITS, 0, WACOM_GRAPHIRE_REL, 0 },
837
/* 31 */ { "Wacom Graphire3 6x8", 8, 16704, 12064, 511, 63,
838
wacom_graphire_irq, WACOM_GRAPHIRE_BITS, 0, WACOM_GRAPHIRE_REL, 0 },
839
/* 32 */ { "Wacom Graphire4 4x5", 8, 10208, 7424, 511, 63,
840
wacom_graphire_irq, WACOM_GRAPHIRE_BITS, 0,
841
WACOM_GRAPHIRE_REL, WACOM_G4_BUTTONS, WACOM_G4_TOOLS },
842
/* 33 */ { "Wacom Graphire4 6x8", 8, 16704, 12064, 511, 63,
843
wacom_graphire_irq, WACOM_GRAPHIRE_BITS, 0,
844
WACOM_GRAPHIRE_REL, WACOM_G4_BUTTONS, WACOM_G4_TOOLS },
845
/* 34 */ { "Wacom BambooFun 4x5", 9, 14760, 9225, 511, 63,
846
wacom_graphire_irq, WACOM_GRAPHIRE_BITS, WACOM_MO_ABS,
847
WACOM_GRAPHIRE_REL, WACOM_MO_BUTTONS, WACOM_G4_TOOLS },
848
/* 35 */ { "Wacom BambooFun 6x8", 9, 21648,13530, 511, 63,
849
wacom_graphire_irq, WACOM_GRAPHIRE_BITS, WACOM_MO_ABS,
850
WACOM_GRAPHIRE_REL, WACOM_MO_BUTTONS, WACOM_G4_TOOLS },
851
/* 36 */ { "Wacom Cintiq Partner", 8, 20480, 15360, 511, 31,
852
wacom_ptu_irq, 0, 0, 0, 0 },
854
/* 37 */ { "Wacom Intuos3 4x5", 10, 25400, 20320, 1023, 63,
855
wacom_intuos_irq, WACOM_INTUOS_BITS, WACOM_INTUOS3S_ABS,
856
WACOM_INTUOS_REL, WACOM_INTUOS3S_BUTTONS, WACOM_INTUOS3_TOOLS },
857
/* 38 */ { "Wacom Intuos3 6x8", 10, 40640, 30480, 1023, 63,
858
wacom_intuos_irq, WACOM_INTUOS_BITS, WACOM_INTUOS3_ABS,
859
WACOM_INTUOS_REL, WACOM_INTUOS3_BUTTONS, WACOM_INTUOS3_TOOLS },
860
/* 39 */ { "Wacom Intuos3 9x12", 10, 60960, 45720, 1023, 63,
861
wacom_intuos_irq, WACOM_INTUOS_BITS, WACOM_INTUOS3_ABS,
862
WACOM_INTUOS_REL, WACOM_INTUOS3_BUTTONS, WACOM_INTUOS3_TOOLS },
863
/* 40 */ { "Wacom Intuos3 12x12", 10, 60960, 60960, 1023, 63,
864
wacom_intuos_irq, WACOM_INTUOS_BITS, WACOM_INTUOS3_ABS,
865
WACOM_INTUOS_REL, WACOM_INTUOS3_BUTTONS, WACOM_INTUOS3_TOOLS },
866
/* 41 */ { "Wacom Intuos3 12x19", 10, 97536, 60960, 1023, 63,
867
wacom_intuos_irq, WACOM_INTUOS_BITS, WACOM_INTUOS3_ABS,
868
WACOM_INTUOS_REL, WACOM_INTUOS3_BUTTONS, WACOM_INTUOS3_TOOLS },
869
/* 42 */ { "Wacom Intuos3 6x11", 10, 54204, 31750, 1023, 63,
870
wacom_intuos_irq, WACOM_INTUOS_BITS, WACOM_INTUOS3_ABS,
871
WACOM_INTUOS_REL, WACOM_INTUOS3_BUTTONS, WACOM_INTUOS3_TOOLS },
872
/* 43 */ { "Wacom Intuos3 4x6", 10, 31496, 19685, 1023, 63,
873
wacom_intuos_irq, WACOM_INTUOS_BITS, WACOM_INTUOS3S_ABS,
874
WACOM_INTUOS_REL, WACOM_INTUOS3S_BUTTONS, WACOM_INTUOS3_TOOLS },
875
/* Protocol 5 Cintiq */
876
/* 44 */ { "Wacom Cintiq 21UX", 10, 87200, 65600, 1023, 63,
877
wacom_intuos_irq, WACOM_INTUOS_BITS, WACOM_INTUOS3_ABS,
878
0, WACOM_INTUOS3_BUTTONS, WACOM_INTUOS3_TOOLS },
879
/* 45 */ { "Wacom Cintiq 20WSX", 10, 86680, 54180, 1023, 63,
880
wacom_intuos_irq, WACOM_INTUOS_BITS, WACOM_INTUOS3_ABS,
881
0, WACOM_BEE_BUTTONS, WACOM_INTUOS3_TOOLS },
882
/* 46 */ { "Wacom Cintiq 12WX", 10, 53020, 33440, 1023, 63,
883
wacom_intuos_irq, WACOM_INTUOS_BITS, WACOM_INTUOS3_ABS,
884
0, WACOM_BEE_BUTTONS, WACOM_INTUOS3_TOOLS },
885
/* 47 */ { "Wacom DTF720", 8, 6858, 5506, 511, 0,
886
wacom_pl_irq, 0, 0, 0, 0 },
887
/* 48 */ { "Wacom DTF521", 8, 6282, 4762, 511, 0,
888
wacom_pl_irq, 0, 0, 0, 0 },
889
/* 49 */ { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 31,
890
wacom_intuos_irq, WACOM_INTUOS_BITS, WACOM_INTUOS_ABS,
891
WACOM_INTUOS_REL, WACOM_INTUOS_BUTTONS, WACOM_INTUOS_TOOLS },
895
struct usb_device_id wacom_ids[] = {
896
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x00), driver_info: 0 },
897
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x10), driver_info: 1 },
898
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x11), driver_info: 2 },
899
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x12), driver_info: 3 },
900
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x20), driver_info: 4 },
901
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x21), driver_info: 5 },
902
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x22), driver_info: 6 },
903
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x23), driver_info: 7 },
904
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x24), driver_info: 8 },
905
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x30), driver_info: 9 },
906
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x31), driver_info: 10 },
907
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x32), driver_info: 11 },
908
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x33), driver_info: 12 },
909
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x34), driver_info: 13 },
910
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x35), driver_info: 14 },
911
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x37), driver_info: 15 },
912
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x38), driver_info: 16 },
913
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x39), driver_info: 17 },
914
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x41), driver_info: 18 },
915
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x42), driver_info: 19 },
916
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x43), driver_info: 20 },
917
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x44), driver_info: 21 },
918
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x45), driver_info: 22 },
919
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x60), driver_info: 23 },
920
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x61), driver_info: 24 },
921
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x62), driver_info: 25 },
922
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x63), driver_info: 26 },
923
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x64), driver_info: 27 },
924
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x65), driver_info: 28 },
925
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x69), driver_info: 29 },
926
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x13), driver_info: 30 },
927
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x14), driver_info: 31 },
928
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x15), driver_info: 32 },
929
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x16), driver_info: 33 },
930
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x17), driver_info: 34 },
931
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x18), driver_info: 35 },
932
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x03), driver_info: 36 },
933
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB0), driver_info: 37 },
934
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB1), driver_info: 38 },
935
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB2), driver_info: 39 },
936
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB3), driver_info: 40 },
937
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB4), driver_info: 41 },
938
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB5), driver_info: 42 },
939
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB7), driver_info: 43 },
940
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x3F), driver_info: 44 },
941
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC5), driver_info: 45 },
942
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC6), driver_info: 46 },
943
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC0), driver_info: 47 },
944
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC4), driver_info: 48 },
946
/* some Intuos2 6x8's erroneously report as 0x47;
947
* multiple confirmed examples exist. */
948
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x47), driver_info: 19 },
953
MODULE_DEVICE_TABLE(usb, wacom_ids);
955
static int wacom_open(struct input_dev *dev)
957
struct wacom *wacom = dev->private;
962
wacom->irq.dev = wacom->usbdev;
963
if (usb_submit_urb(&wacom->irq))
969
static void wacom_close(struct input_dev *dev)
971
struct wacom *wacom = dev->private;
974
usb_unlink_urb(&wacom->irq);
977
static void wacom_reset(struct wacom* wacom)
979
unsigned char edata[2], limit=0;
981
printk(KERN_INFO __FILE__ ": Setting tablet report for tablet data\n");
984
/* ask the tablet to report tablet data. repeats until it succeeds */
988
usb_set_report(wacom->usbdev, wacom->ifnum, 3, 2, edata, 2);
989
usb_get_report(wacom->usbdev, wacom->ifnum, 3, 2, edata, 2);
990
} while (edata[1] != 2 && limit++ < 5);
993
static void *wacom_probe(struct usb_device *dev, unsigned int ifnum, const struct usb_device_id *id)
995
struct usb_endpoint_descriptor *endpoint;
998
if (!(wacom = kmalloc(sizeof(struct wacom), GFP_KERNEL))) return NULL;
999
memset(wacom, 0, sizeof(struct wacom));
1001
wacom->features = wacom_features + id->driver_info;
1003
wacom->dev.evbit[0] |= BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_MSC) |
1004
wacom->features->evbit;
1005
wacom->dev.absbit[0] |= BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE) |
1006
BIT(ABS_DISTANCE) | BIT(ABS_WHEEL) |
1007
wacom->features->absbit;
1008
wacom->dev.absbit[LONG(ABS_MISC)] |= BIT(ABS_MISC);
1009
wacom->dev.relbit[0] |= wacom->features->relbit;
1010
wacom->dev.keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_RIGHT) |
1011
BIT(BTN_MIDDLE) | wacom->features->btnbit;
1012
wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_PEN) |
1013
BIT(BTN_TOOL_RUBBER) | BIT(BTN_TOOL_MOUSE) |
1014
BIT(BTN_TOUCH) | BIT(BTN_STYLUS) | BIT(BTN_STYLUS2) |
1015
wacom->features->digibit;
1016
wacom->dev.mscbit[0] |= BIT(MSC_SERIAL);
1019
printk(KERN_INFO __FILE__ ": Reporting max %d, %d\n",
1020
wacom->features->x_max, wacom->features->y_max);
1023
wacom->dev.absmax[ABS_X] = wacom->features->x_max;
1024
wacom->dev.absmax[ABS_Y] = wacom->features->y_max;
1025
wacom->dev.absmax[ABS_PRESSURE] = wacom->features->pressure_max;
1026
wacom->dev.absmax[ABS_DISTANCE] = wacom->features->distance_max;
1027
wacom->dev.absmax[ABS_TILT_X] = 127;
1028
wacom->dev.absmax[ABS_TILT_Y] = 127;
1029
wacom->dev.absmax[ABS_WHEEL] = 1023;
1031
wacom->dev.absmax[ABS_RX] = 4096;
1032
wacom->dev.absmax[ABS_RY] = 4096;
1033
wacom->dev.absmin[ABS_RZ] = -900;
1034
wacom->dev.absmax[ABS_RZ] = 899;
1035
wacom->dev.absmin[ABS_THROTTLE] = -1023;
1036
wacom->dev.absmax[ABS_THROTTLE] = 1023;
1037
wacom->dev.absmin[ABS_Z] = -900;
1038
wacom->dev.absmax[ABS_Z] = 899;
1040
wacom->dev.absfuzz[ABS_X] = 4;
1041
wacom->dev.absfuzz[ABS_Y] = 4;
1043
wacom->dev.private = wacom;
1044
wacom->dev.open = wacom_open;
1045
wacom->dev.close = wacom_close;
1047
wacom->dev.name = wacom->features->name;
1048
wacom->dev.idbus = BUS_USB;
1049
wacom->dev.idvendor = dev->descriptor.idVendor;
1050
wacom->dev.idproduct = dev->descriptor.idProduct;
1051
wacom->dev.idversion = dev->descriptor.bcdDevice;
1052
wacom->usbdev = dev;
1053
wacom->ifnum = ifnum;
1055
endpoint = dev->config[0].interface[ifnum].altsetting[0].endpoint + 0;
1057
usb_set_idle(dev, dev->config[0].interface[ifnum].altsetting[0].bInterfaceNumber, 0, 0);
1059
FILL_INT_URB(&wacom->irq, dev, usb_rcvintpipe(dev,
1060
endpoint->bEndpointAddress), wacom->data, wacom->features->pktlen,
1061
wacom->features->irq, wacom, endpoint->bInterval);
1063
input_register_device(&wacom->dev);
1067
printk(KERN_INFO __FILE__ ": input%d: %s on usb%d:%d.%d\n",
1068
wacom->dev.number, wacom->features->name, dev->bus->busnum,
1069
dev->devnum, ifnum);
1074
static void wacom_disconnect(struct usb_device *dev, void *ptr)
1076
struct wacom *wacom = ptr;
1078
usb_unlink_urb(&wacom->irq);
1079
input_unregister_device(&wacom->dev);
1083
static struct usb_driver wacom_driver = {
1086
disconnect: wacom_disconnect,
1087
id_table: wacom_ids,
1090
static int __init wacom_init(void)
1092
usb_register(&wacom_driver);
1093
info(DRIVER_VERSION " " DRIVER_AUTHOR);
1098
static void __exit wacom_exit(void)
1100
usb_deregister(&wacom_driver);
1103
module_init(wacom_init);
1104
module_exit(wacom_exit);