Lines 51-56
Link Here
|
51 |
* - Cleanups here and there |
51 |
* - Cleanups here and there |
52 |
* v1.30.1 (pi) - Added Graphire3 support |
52 |
* v1.30.1 (pi) - Added Graphire3 support |
53 |
* v1.40 (pc) - Add support for several new devices, fix eraser reporting, ... |
53 |
* v1.40 (pc) - Add support for several new devices, fix eraser reporting, ... |
|
|
54 |
* |
55 |
* WARNING: THIS IS NOT PART OF THE OFFICIAL KERNEL TREE |
56 |
* THIS IS FOR TESTING PURPOSES |
57 |
* |
58 |
* v1.40-2.6.11.3-pc-0.1 - initial release based on 2.6.11 |
59 |
* - fixed a Graphire bug |
60 |
* - added Intuos3 |
61 |
* - added Cintiq 21UX |
62 |
* v1.40-2.6.11.3-pc-0.2 - fixed an I3 bug |
63 |
* |
54 |
*/ |
64 |
*/ |
55 |
|
65 |
|
56 |
/* |
66 |
/* |
Lines 72-78
Link Here
|
72 |
/* |
82 |
/* |
73 |
* Version Information |
83 |
* Version Information |
74 |
*/ |
84 |
*/ |
75 |
#define DRIVER_VERSION "v1.30" |
85 |
#define DRIVER_VERSION "v1.40" |
76 |
#define DRIVER_AUTHOR "Vojtech Pavlik <vojtech@ucw.cz>" |
86 |
#define DRIVER_AUTHOR "Vojtech Pavlik <vojtech@ucw.cz>" |
77 |
#define DRIVER_DESC "USB Wacom Graphire and Wacom Intuos tablet driver" |
87 |
#define DRIVER_DESC "USB Wacom Graphire and Wacom Intuos tablet driver" |
78 |
#define DRIVER_LICENSE "GPL" |
88 |
#define DRIVER_LICENSE "GPL" |
Lines 83-88
Link Here
|
83 |
|
93 |
|
84 |
#define USB_VENDOR_ID_WACOM 0x056a |
94 |
#define USB_VENDOR_ID_WACOM 0x056a |
85 |
|
95 |
|
|
|
96 |
enum { |
97 |
PENPARTNER = 0, |
98 |
GRAPHIRE, |
99 |
PL, |
100 |
INTUOS, |
101 |
INTUOS3, |
102 |
CINTIQ, |
103 |
MAX_TYPE |
104 |
}; |
105 |
|
86 |
struct wacom_features { |
106 |
struct wacom_features { |
87 |
char *name; |
107 |
char *name; |
88 |
int pktlen; |
108 |
int pktlen; |
Lines 141-148
Link Here
|
141 |
goto exit; |
161 |
goto exit; |
142 |
} |
162 |
} |
143 |
|
163 |
|
144 |
if (data[0] != 2) |
164 |
if (data[0] != 2) { |
145 |
dbg("wacom_pl_irq: received unknown report #%d", data[0]); |
165 |
dbg("wacom_pl_irq: received unknown report #%d", data[0]); |
|
|
166 |
goto exit; |
167 |
} |
146 |
|
168 |
|
147 |
prox = data[1] & 0x40; |
169 |
prox = data[1] & 0x40; |
148 |
|
170 |
|
Lines 180-187
Link Here
|
180 |
wacom->tool[1] = BTN_TOOL_PEN; |
202 |
wacom->tool[1] = BTN_TOOL_PEN; |
181 |
} |
203 |
} |
182 |
input_report_key(dev, wacom->tool[1], prox); /* report in proximity for tool */ |
204 |
input_report_key(dev, wacom->tool[1], prox); /* report in proximity for tool */ |
183 |
input_report_abs(dev, ABS_X, data[3] | ((__u32)data[2] << 7) | ((__u32)(data[1] & 0x03) << 14)); |
205 |
input_report_abs(dev, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14)); |
184 |
input_report_abs(dev, ABS_Y, data[6] | ((__u32)data[5] << 7) | ((__u32)(data[4] & 0x03) << 14)); |
206 |
input_report_abs(dev, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14)); |
185 |
input_report_abs(dev, ABS_PRESSURE, pressure); |
207 |
input_report_abs(dev, ABS_PRESSURE, pressure); |
186 |
|
208 |
|
187 |
input_report_key(dev, BTN_TOUCH, data[4] & 0x08); |
209 |
input_report_key(dev, BTN_TOUCH, data[4] & 0x08); |
Lines 233-238
Link Here
|
233 |
if (data[0] != 2) |
255 |
if (data[0] != 2) |
234 |
{ |
256 |
{ |
235 |
printk(KERN_INFO "wacom_ptu_irq: received unknown report #%d\n", data[0]); |
257 |
printk(KERN_INFO "wacom_ptu_irq: received unknown report #%d\n", data[0]); |
|
|
258 |
goto exit; |
236 |
} |
259 |
} |
237 |
|
260 |
|
238 |
input_regs(dev, regs); |
261 |
input_regs(dev, regs); |
Lines 246-254
Link Here
|
246 |
input_report_key(dev, BTN_TOOL_PEN, data[1] & 0x20); |
269 |
input_report_key(dev, BTN_TOOL_PEN, data[1] & 0x20); |
247 |
input_report_key(dev, BTN_TOUCH, data[1] & 0x01); |
270 |
input_report_key(dev, BTN_TOUCH, data[1] & 0x01); |
248 |
} |
271 |
} |
249 |
input_report_abs(dev, ABS_X, data[3] << 8 | data[2]); |
272 |
input_report_abs(dev, ABS_X, le16_to_cpu(*(__le16 *) &data[2])); |
250 |
input_report_abs(dev, ABS_Y, data[5] << 8 | data[4]); |
273 |
input_report_abs(dev, ABS_Y, le16_to_cpu(*(__le16 *) &data[4])); |
251 |
input_report_abs(dev, ABS_PRESSURE, (data[6]|data[7] << 8)); |
274 |
input_report_abs(dev, ABS_PRESSURE, le16_to_cpu(*(__le16 *) &data[6])); |
252 |
input_report_key(dev, BTN_STYLUS, data[1] & 0x02); |
275 |
input_report_key(dev, BTN_STYLUS, data[1] & 0x02); |
253 |
input_report_key(dev, BTN_STYLUS2, data[1] & 0x10); |
276 |
input_report_key(dev, BTN_STYLUS2, data[1] & 0x10); |
254 |
|
277 |
|
Lines 283-292
Link Here
|
283 |
goto exit; |
306 |
goto exit; |
284 |
} |
307 |
} |
285 |
|
308 |
|
|
|
309 |
if (data[0] != 2) { |
310 |
printk(KERN_INFO "wacom_penpartner_irq: received unknown report #%d\n", data[0]); |
311 |
goto exit; |
312 |
} |
313 |
|
286 |
input_regs(dev, regs); |
314 |
input_regs(dev, regs); |
287 |
input_report_key(dev, BTN_TOOL_PEN, 1); |
315 |
input_report_key(dev, BTN_TOOL_PEN, 1); |
288 |
input_report_abs(dev, ABS_X, le16_to_cpu(get_unaligned((__le16 *) &data[1]))); |
316 |
input_report_abs(dev, ABS_X, le16_to_cpu(*(__le16 *) &data[1])); |
289 |
input_report_abs(dev, ABS_Y, le16_to_cpu(get_unaligned((__le16 *) &data[3]))); |
317 |
input_report_abs(dev, ABS_Y, le16_to_cpu(*(__le16 *) &data[3])); |
290 |
input_report_abs(dev, ABS_PRESSURE, (signed char)data[6] + 127); |
318 |
input_report_abs(dev, ABS_PRESSURE, (signed char)data[6] + 127); |
291 |
input_report_key(dev, BTN_TOUCH, ((signed char)data[6] > -80) && !(data[5] & 0x20)); |
319 |
input_report_key(dev, BTN_TOUCH, ((signed char)data[6] > -80) && !(data[5] & 0x20)); |
292 |
input_report_key(dev, BTN_STYLUS, (data[5] & 0x40)); |
320 |
input_report_key(dev, BTN_STYLUS, (data[5] & 0x40)); |
Lines 322-377
Link Here
|
322 |
goto exit; |
350 |
goto exit; |
323 |
} |
351 |
} |
324 |
|
352 |
|
325 |
/* check if we can handle the data */ |
353 |
if (data[0] != 2) { |
326 |
if (data[0] == 99) |
|
|
327 |
goto exit; |
328 |
|
329 |
if (data[0] != 2) |
330 |
dbg("wacom_graphire_irq: received unknown report #%d", data[0]); |
354 |
dbg("wacom_graphire_irq: received unknown report #%d", data[0]); |
331 |
|
355 |
goto exit; |
332 |
x = le16_to_cpu(*(__le16 *) &data[2]); |
356 |
} |
333 |
y = le16_to_cpu(*(__le16 *) &data[4]); |
|
|
334 |
|
357 |
|
335 |
input_regs(dev, regs); |
358 |
input_regs(dev, regs); |
336 |
|
359 |
|
337 |
switch ((data[1] >> 5) & 3) { |
360 |
if ( data[1] & 0x10 ) /* in prox */ |
338 |
|
361 |
{ |
339 |
case 0: /* Pen */ |
362 |
switch ((data[1] >> 5) & 3) { |
340 |
input_report_key(dev, BTN_TOOL_PEN, data[1] & 0x80); |
|
|
341 |
break; |
342 |
|
343 |
case 1: /* Rubber */ |
344 |
input_report_key(dev, BTN_TOOL_RUBBER, data[1] & 0x80); |
345 |
break; |
346 |
|
347 |
case 2: /* Mouse with wheel */ |
348 |
input_report_key(dev, BTN_MIDDLE, data[1] & 0x04); |
349 |
input_report_rel(dev, REL_WHEEL, (signed char) data[6]); |
350 |
/* fall through */ |
351 |
|
352 |
case 3: /* Mouse without wheel */ |
353 |
input_report_key(dev, BTN_TOOL_MOUSE, data[7] > 24); |
354 |
input_report_key(dev, BTN_LEFT, data[1] & 0x01); |
355 |
input_report_key(dev, BTN_RIGHT, data[1] & 0x02); |
356 |
input_report_abs(dev, ABS_DISTANCE, data[7]); |
357 |
|
358 |
input_report_abs(dev, ABS_X, x); |
359 |
input_report_abs(dev, ABS_Y, y); |
360 |
|
363 |
|
361 |
input_sync(dev); |
364 |
case 0: /* Pen */ |
362 |
goto exit; |
365 |
wacom->tool[0] = BTN_TOOL_PEN; |
|
|
366 |
break; |
367 |
|
368 |
case 1: /* Rubber */ |
369 |
wacom->tool[0] = BTN_TOOL_RUBBER; |
370 |
break; |
371 |
|
372 |
case 2: /* Mouse with wheel */ |
373 |
input_report_key(dev, BTN_MIDDLE, data[1] & 0x04); |
374 |
input_report_rel(dev, REL_WHEEL, (signed char) data[6]); |
375 |
/* fall through */ |
376 |
|
377 |
case 3: /* Mouse without wheel */ |
378 |
wacom->tool[0] = BTN_TOOL_MOUSE; |
379 |
input_report_key(dev, BTN_LEFT, data[1] & 0x01); |
380 |
input_report_key(dev, BTN_RIGHT, data[1] & 0x02); |
381 |
input_report_abs(dev, ABS_DISTANCE, data[7]); |
382 |
break; |
383 |
} |
363 |
} |
384 |
} |
364 |
|
385 |
|
365 |
if (data[1] & 0x80) { |
386 |
if (data[1] & 0x80) { |
|
|
387 |
x = le16_to_cpu(*(__le16 *) &data[2]); |
388 |
y = le16_to_cpu(*(__le16 *) &data[4]); |
366 |
input_report_abs(dev, ABS_X, x); |
389 |
input_report_abs(dev, ABS_X, x); |
367 |
input_report_abs(dev, ABS_Y, y); |
390 |
input_report_abs(dev, ABS_Y, y); |
368 |
} |
391 |
} |
369 |
|
392 |
if (wacom->tool[0] != BTN_TOOL_MOUSE) { |
370 |
input_report_abs(dev, ABS_PRESSURE, le16_to_cpu(*(__le16 *) &data[6])); |
393 |
input_report_abs(dev, ABS_PRESSURE, le16_to_cpu(*(__le16 *) &data[6])); |
371 |
input_report_key(dev, BTN_TOUCH, data[1] & 0x01); |
394 |
input_report_key(dev, BTN_TOUCH, data[1] & 0x01); |
372 |
input_report_key(dev, BTN_STYLUS, data[1] & 0x02); |
395 |
input_report_key(dev, BTN_STYLUS, data[1] & 0x02); |
373 |
input_report_key(dev, BTN_STYLUS2, data[1] & 0x04); |
396 |
input_report_key(dev, BTN_STYLUS2, data[1] & 0x04); |
374 |
|
397 |
} |
|
|
398 |
input_report_key(dev, wacom->tool[0], data[1] & 0x10); |
375 |
input_sync(dev); |
399 |
input_sync(dev); |
376 |
|
400 |
|
377 |
exit: |
401 |
exit: |
Lines 381-386
Link Here
|
381 |
__FUNCTION__, retval); |
405 |
__FUNCTION__, retval); |
382 |
} |
406 |
} |
383 |
|
407 |
|
|
|
408 |
static int wacom_intuos_inout(struct urb *urb) |
409 |
{ |
410 |
struct wacom *wacom = urb->context; |
411 |
unsigned char *data = wacom->data; |
412 |
struct input_dev *dev = &wacom->dev; |
413 |
int idx; |
414 |
|
415 |
/* tool number */ |
416 |
idx = data[1] & 0x01; |
417 |
|
418 |
/* Enter report */ |
419 |
if ((data[1] & 0xfc) == 0xc0) |
420 |
{ |
421 |
/* serial number of the tool */ |
422 |
wacom->serial[idx] = ((data[3] & 0x0f) << 28) + |
423 |
(data[4] << 20) + (data[5] << 12) + |
424 |
(data[6] << 4) + (data[7] >> 4); |
425 |
|
426 |
switch ((data[2] << 4) | (data[3] >> 4)) { |
427 |
case 0x812: /* Inking pen */ |
428 |
case 0x801: /* Intuos3 Inking pen */ |
429 |
case 0x012: |
430 |
wacom->tool[idx] = BTN_TOOL_PENCIL; |
431 |
break; |
432 |
case 0x822: /* Pen */ |
433 |
case 0x842: |
434 |
case 0x852: |
435 |
case 0x823: /* Intuos3 Grip Pen */ |
436 |
case 0x813: /* Intuos3 Classic Pen */ |
437 |
case 0x885: /* Intuos3 Marker Pen */ |
438 |
case 0x022: |
439 |
wacom->tool[idx] = BTN_TOOL_PEN; |
440 |
break; |
441 |
case 0x832: /* Stroke pen */ |
442 |
case 0x032: |
443 |
wacom->tool[idx] = BTN_TOOL_BRUSH; |
444 |
break; |
445 |
case 0x007: /* Mouse 4D and 2D */ |
446 |
case 0x09c: |
447 |
case 0x094: |
448 |
case 0x017: /* Intuos3 2D Mouse */ |
449 |
wacom->tool[idx] = BTN_TOOL_MOUSE; |
450 |
break; |
451 |
case 0x096: /* Lens cursor */ |
452 |
case 0x097: /* Intuos3 Lens cursor */ |
453 |
wacom->tool[idx] = BTN_TOOL_LENS; |
454 |
break; |
455 |
case 0x82a: /* Eraser */ |
456 |
case 0x85a: |
457 |
case 0x91a: |
458 |
case 0xd1a: |
459 |
case 0x0fa: |
460 |
case 0x82b: /* Intuos3 Grip Pen Eraser */ |
461 |
case 0x81b: /* Intuos3 Classic Pen Eraser */ |
462 |
case 0x91b: /* Intuos3 Airbrush Eraser */ |
463 |
wacom->tool[idx] = BTN_TOOL_RUBBER; |
464 |
break; |
465 |
case 0xd12: /* Airbrush */ |
466 |
case 0x912: |
467 |
case 0x112: |
468 |
case 0x913: /* Intuos3 Airbrush */ |
469 |
wacom->tool[idx] = BTN_TOOL_AIRBRUSH; |
470 |
break; |
471 |
default: /* Unknown tool */ |
472 |
wacom->tool[idx] = BTN_TOOL_PEN; |
473 |
} |
474 |
input_report_key(dev, wacom->tool[idx], 1); |
475 |
input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]); |
476 |
input_sync(dev); |
477 |
return 1; |
478 |
} |
479 |
|
480 |
/* Exit report */ |
481 |
if ((data[1] & 0xfe) == 0x80) { |
482 |
input_report_key(dev, wacom->tool[idx], 0); |
483 |
input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]); |
484 |
input_sync(dev); |
485 |
return 1; |
486 |
} |
487 |
|
488 |
return 0; |
489 |
} |
490 |
|
491 |
static void wacom_intuos_general(struct urb *urb) |
492 |
{ |
493 |
struct wacom *wacom = urb->context; |
494 |
unsigned char *data = wacom->data; |
495 |
struct input_dev *dev = &wacom->dev; |
496 |
unsigned int t; |
497 |
|
498 |
/* general pen packet */ |
499 |
if ((data[1] & 0xb8) == 0xa0) |
500 |
{ |
501 |
t = (data[6] << 2) | ((data[7] >> 6) & 3); |
502 |
input_report_abs(dev, ABS_PRESSURE, t); |
503 |
input_report_abs(dev, ABS_TILT_X, |
504 |
((data[7] << 1) & 0x7e) | (data[8] >> 7)); |
505 |
input_report_abs(dev, ABS_TILT_Y, data[8] & 0x7f); |
506 |
input_report_key(dev, BTN_STYLUS, data[1] & 2); |
507 |
input_report_key(dev, BTN_STYLUS2, data[1] & 4); |
508 |
input_report_key(dev, BTN_TOUCH, t > 10); |
509 |
} |
510 |
|
511 |
/* airbrush second packet */ |
512 |
if ((data[1] & 0xbc) == 0xb4) |
513 |
{ |
514 |
input_report_abs(dev, ABS_WHEEL, |
515 |
(data[6] << 2) | ((data[7] >> 6) & 3)); |
516 |
input_report_abs(dev, ABS_TILT_X, |
517 |
((data[7] << 1) & 0x7e) | (data[8] >> 7)); |
518 |
input_report_abs(dev, ABS_TILT_Y, data[8] & 0x7f); |
519 |
} |
520 |
return; |
521 |
} |
522 |
|
384 |
static void wacom_intuos_irq(struct urb *urb, struct pt_regs *regs) |
523 |
static void wacom_intuos_irq(struct urb *urb, struct pt_regs *regs) |
385 |
{ |
524 |
{ |
386 |
struct wacom *wacom = urb->context; |
525 |
struct wacom *wacom = urb->context; |
Lines 405-518
Link Here
|
405 |
goto exit; |
544 |
goto exit; |
406 |
} |
545 |
} |
407 |
|
546 |
|
408 |
if (data[0] != 2) |
547 |
if (data[0] != 2 && data[0] != 5 && data[0] != 6 && data[0] != 12) { |
409 |
dbg("wacom_intuos_irq: received unknown report #%d", data[0]); |
548 |
dbg("wacom_intuos_irq: received unknown report #%d", data[0]); |
|
|
549 |
goto exit; |
550 |
} |
410 |
|
551 |
|
411 |
input_regs(dev, regs); |
552 |
input_regs(dev, regs); |
412 |
|
553 |
|
413 |
/* tool number */ |
554 |
/* tool number */ |
414 |
idx = data[1] & 0x01; |
555 |
idx = data[1] & 0x01; |
415 |
|
556 |
|
416 |
if ((data[1] & 0xfc) == 0xc0) { /* Enter report */ |
557 |
/* pad packets. Works as a second tool and is always in prox */ |
417 |
|
558 |
if (data[0] == 12) |
418 |
wacom->serial[idx] = ((__u32)(data[3] & 0x0f) << 28) + /* serial number of the tool */ |
559 |
{ |
419 |
((__u32)data[4] << 20) + ((__u32)data[5] << 12) + |
560 |
/* initiate the pad as a device */ |
420 |
((__u32)data[6] << 4) + (data[7] >> 4); |
561 |
if (wacom->tool[1] != BTN_TOOL_FINGER) |
421 |
|
562 |
{ |
422 |
switch (((__u32)data[2] << 4) | (data[3] >> 4)) { |
563 |
wacom->tool[1] = BTN_TOOL_FINGER; |
423 |
case 0x812: |
564 |
input_report_key(dev, wacom->tool[1], 1); |
424 |
case 0x012: wacom->tool[idx] = BTN_TOOL_PENCIL; break; /* Inking pen */ |
|
|
425 |
case 0x822: |
426 |
case 0x842: |
427 |
case 0x852: |
428 |
case 0x022: wacom->tool[idx] = BTN_TOOL_PEN; break; /* Pen */ |
429 |
case 0x832: |
430 |
case 0x032: wacom->tool[idx] = BTN_TOOL_BRUSH; break; /* Stroke pen */ |
431 |
case 0x007: |
432 |
case 0x09c: |
433 |
case 0x094: wacom->tool[idx] = BTN_TOOL_MOUSE; break; /* Mouse 4D and 2D */ |
434 |
case 0x096: wacom->tool[idx] = BTN_TOOL_LENS; break; /* Lens cursor */ |
435 |
case 0x82a: |
436 |
case 0x85a: |
437 |
case 0x91a: |
438 |
case 0xd1a: |
439 |
case 0x0fa: wacom->tool[idx] = BTN_TOOL_RUBBER; break; /* Eraser */ |
440 |
case 0xd12: |
441 |
case 0x912: |
442 |
case 0x112: wacom->tool[idx] = BTN_TOOL_AIRBRUSH; break; /* Airbrush */ |
443 |
default: wacom->tool[idx] = BTN_TOOL_PEN; break; /* Unknown tool */ |
444 |
} |
565 |
} |
445 |
|
566 |
input_report_key(dev, BTN_0, (data[5] & 0x01)); |
446 |
input_report_key(dev, wacom->tool[idx], 1); |
567 |
input_report_key(dev, BTN_1, (data[5] & 0x02)); |
447 |
input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]); |
568 |
input_report_key(dev, BTN_2, (data[5] & 0x04)); |
|
|
569 |
input_report_key(dev, BTN_3, (data[5] & 0x08)); |
570 |
input_report_key(dev, BTN_4, (data[6] & 0x01)); |
571 |
input_report_key(dev, BTN_5, (data[6] & 0x02)); |
572 |
input_report_key(dev, BTN_6, (data[6] & 0x04)); |
573 |
input_report_key(dev, BTN_7, (data[6] & 0x08)); |
574 |
input_report_abs(dev, ABS_RX, ((data[1] & 0x1f) << 8) | data[2]); |
575 |
input_report_abs(dev, ABS_RY, ((data[3] & 0x1f) << 8) | data[4]); |
576 |
input_event(dev, EV_MSC, MSC_SERIAL, 0xffffffff); |
448 |
input_sync(dev); |
577 |
input_sync(dev); |
449 |
goto exit; |
578 |
goto exit; |
450 |
} |
579 |
} |
451 |
|
580 |
|
452 |
if ((data[1] & 0xfe) == 0x80) { /* Exit report */ |
581 |
/* process in/out prox events */ |
453 |
input_report_key(dev, wacom->tool[idx], 0); |
582 |
if (wacom_intuos_inout(urb)) goto exit; |
454 |
input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]); |
|
|
455 |
input_sync(dev); |
456 |
goto exit; |
457 |
} |
458 |
|
583 |
|
459 |
input_report_abs(dev, ABS_X, be16_to_cpu(*(__be16 *) &data[2])); |
584 |
/* Cintiq doesn't send data when RDY bit isn't set */ |
460 |
input_report_abs(dev, ABS_Y, be16_to_cpu(*(__be16 *) &data[4])); |
585 |
if ((wacom->features->type == CINTIQ) && !(data[1] & 0x40)) return; |
461 |
input_report_abs(dev, ABS_DISTANCE, data[9]); |
|
|
462 |
|
463 |
if ((data[1] & 0xb8) == 0xa0) { /* general pen packet */ |
464 |
input_report_abs(dev, ABS_PRESSURE, t = ((__u32)data[6] << 2) | ((data[7] >> 6) & 3)); |
465 |
input_report_abs(dev, ABS_TILT_X, ((data[7] << 1) & 0x7e) | (data[8] >> 7)); |
466 |
input_report_abs(dev, ABS_TILT_Y, data[8] & 0x7f); |
467 |
input_report_key(dev, BTN_STYLUS, data[1] & 2); |
468 |
input_report_key(dev, BTN_STYLUS2, data[1] & 4); |
469 |
input_report_key(dev, BTN_TOUCH, t > 10); |
470 |
} |
471 |
|
586 |
|
472 |
if ((data[1] & 0xbc) == 0xb4) { /* airbrush second packet */ |
587 |
if(wacom->features->type >= INTUOS3) |
473 |
input_report_abs(dev, ABS_WHEEL, ((__u32)data[6] << 2) | ((data[7] >> 6) & 3)); |
588 |
{ |
474 |
input_report_abs(dev, ABS_TILT_X, ((data[7] << 1) & 0x7e) | (data[8] >> 7)); |
589 |
input_report_abs(dev, ABS_X, (data[2] << 9) | (data[3] << 1) | ((data[9] >> 1) & 1)); |
475 |
input_report_abs(dev, ABS_TILT_Y, data[8] & 0x7f); |
590 |
input_report_abs(dev, ABS_Y, (data[4] << 9) | (data[5] << 1) | (data[9] & 1)); |
|
|
591 |
input_report_abs(dev, ABS_DISTANCE, ((data[9] >> 2) & 0x3f)); |
476 |
} |
592 |
} |
477 |
|
593 |
else |
478 |
if ((data[1] & 0xbc) == 0xa8 || (data[1] & 0xbe) == 0xb0) { /* 4D mouse or Lens cursor packets */ |
594 |
{ |
479 |
|
595 |
input_report_abs(dev, ABS_X, be16_to_cpu(*(__be16 *) &data[2])); |
480 |
if (data[1] & 0x02) { /* Rotation packet */ |
596 |
input_report_abs(dev, ABS_Y, be16_to_cpu(*(__be16 *) &data[4])); |
481 |
|
597 |
input_report_abs(dev, ABS_DISTANCE, ((data[9] >> 3) & 0x1f)); |
482 |
input_report_abs(dev, ABS_RZ, (data[7] & 0x20) ? |
598 |
} |
483 |
((__u32)data[6] << 3) | ((data[7] >> 5) & 7): |
599 |
|
484 |
(-(((__u32)data[6] << 3) | ((data[7] >> 5) & 7))) - 1); |
600 |
/* process general packets */ |
485 |
|
601 |
wacom_intuos_general(urb); |
486 |
} else { |
602 |
|
487 |
|
603 |
/* 4D mouse, 2D mouse, marker pen rotation, or Lens cursor packets */ |
488 |
if ((data[1] & 0x10) == 0) { /* 4D mouse packets */ |
604 |
if ((data[1] & 0xbc) == 0xa8 || (data[1] & 0xbe) == 0xb0) { |
489 |
|
605 |
/* Rotation packet */ |
490 |
input_report_key(dev, BTN_LEFT, data[8] & 0x01); |
606 |
if (data[1] & 0x02) |
491 |
input_report_key(dev, BTN_MIDDLE, data[8] & 0x02); |
607 |
{ |
492 |
input_report_key(dev, BTN_RIGHT, data[8] & 0x04); |
608 |
if(wacom->features->type >= INTUOS3) |
493 |
|
609 |
{ |
494 |
input_report_key(dev, BTN_SIDE, data[8] & 0x20); |
610 |
/* I3 marker pen rotation reported as wheel |
495 |
input_report_key(dev, BTN_EXTRA, data[8] & 0x10); |
611 |
* due to valuator limitation |
496 |
input_report_abs(dev, ABS_THROTTLE, -((data[8] & 0x08) ? |
612 |
*/ |
497 |
((__u32)data[6] << 2) | ((data[7] >> 6) & 3) : |
613 |
t = (data[6] << 3) | ((data[7] >> 5) & 7); |
498 |
-((__u32)data[6] << 2) | ((data[7] >> 6) & 3))); |
614 |
t = (data[7] & 0x20) ? ((t > 900) ? ((t-1) / 2 - 1350) : |
499 |
|
615 |
((t-1) / 2 + 450)) : (450 - t / 2) ; |
500 |
} else { |
616 |
input_report_abs(dev, ABS_WHEEL, t); |
501 |
if (wacom->tool[idx] == BTN_TOOL_MOUSE) { /* 2D mouse packets */ |
617 |
} |
502 |
input_report_key(dev, BTN_LEFT, data[8] & 0x04); |
618 |
else |
503 |
input_report_key(dev, BTN_MIDDLE, data[8] & 0x08); |
619 |
{ |
504 |
input_report_key(dev, BTN_RIGHT, data[8] & 0x10); |
620 |
/* 4D mouse rotation packet */ |
505 |
input_report_rel(dev, REL_WHEEL, |
621 |
t = (data[6] << 3) | ((data[7] >> 5) & 7); |
506 |
(-(__u32)(data[8] & 0x01) + (__u32)((data[8] & 0x02) >> 1))); |
622 |
input_report_abs(dev, ABS_RZ, (data[7] & 0x20) ? |
507 |
} |
623 |
((t - 1) / 2) : -t / 2); |
508 |
else { /* Lens cursor packets */ |
|
|
509 |
input_report_key(dev, BTN_LEFT, data[8] & 0x01); |
510 |
input_report_key(dev, BTN_MIDDLE, data[8] & 0x02); |
511 |
input_report_key(dev, BTN_RIGHT, data[8] & 0x04); |
512 |
input_report_key(dev, BTN_SIDE, data[8] & 0x10); |
513 |
input_report_key(dev, BTN_EXTRA, data[8] & 0x08); |
514 |
} |
515 |
} |
624 |
} |
|
|
625 |
} |
626 |
/* 4D mouse packets */ |
627 |
else if ( !(data[1] & 0x10) && wacom->features->type < INTUOS3) |
628 |
{ |
629 |
input_report_key(dev, BTN_LEFT, data[8] & 0x01); |
630 |
input_report_key(dev, BTN_MIDDLE, data[8] & 0x02); |
631 |
input_report_key(dev, BTN_RIGHT, data[8] & 0x04); |
632 |
|
633 |
input_report_key(dev, BTN_SIDE, data[8] & 0x20); |
634 |
input_report_key(dev, BTN_EXTRA, data[8] & 0x10); |
635 |
t = (data[6] << 2) | ((data[7] >> 6) & 3); |
636 |
input_report_abs(dev, ABS_THROTTLE, (data[8] & 0x08) ? -t : t); |
637 |
} |
638 |
/* 2D mouse packets */ |
639 |
else if (wacom->tool[idx] == BTN_TOOL_MOUSE) |
640 |
{ |
641 |
input_report_key(dev, BTN_LEFT, data[8] & 0x04); |
642 |
input_report_key(dev, BTN_MIDDLE, data[8] & 0x08); |
643 |
input_report_key(dev, BTN_RIGHT, data[8] & 0x10); |
644 |
input_report_rel(dev, REL_WHEEL, ((data[8] & 0x02) >> 1) |
645 |
- (data[8] & 0x01)); |
646 |
|
647 |
/* I3 2D mouse side buttons */ |
648 |
if (wacom->features->type == INTUOS3) |
649 |
{ |
650 |
input_report_key(dev, BTN_SIDE, data[8] & 0x40); |
651 |
input_report_key(dev, BTN_EXTRA, data[8] & 0x20); |
652 |
} |
653 |
} |
654 |
/* Lens cursor packets */ |
655 |
else if (wacom->features->type < INTUOS3) |
656 |
{ |
657 |
input_report_key(dev, BTN_LEFT, data[8] & 0x01); |
658 |
input_report_key(dev, BTN_MIDDLE, data[8] & 0x02); |
659 |
input_report_key(dev, BTN_RIGHT, data[8] & 0x04); |
660 |
input_report_key(dev, BTN_SIDE, data[8] & 0x10); |
661 |
input_report_key(dev, BTN_EXTRA, data[8] & 0x08); |
516 |
} |
662 |
} |
517 |
} |
663 |
} |
518 |
|
664 |
|
Lines 528-558
Link Here
|
528 |
} |
674 |
} |
529 |
|
675 |
|
530 |
static struct wacom_features wacom_features[] = { |
676 |
static struct wacom_features wacom_features[] = { |
531 |
{ "Wacom Penpartner", 7, 5040, 3780, 255, 32, 0, wacom_penpartner_irq }, |
677 |
{ "Wacom Penpartner", 7, 5040, 3780, 255, 32, PENPARTNER, wacom_penpartner_irq }, |
532 |
{ "Wacom Graphire", 8, 10206, 7422, 511, 32, 1, wacom_graphire_irq }, |
678 |
{ "Wacom Graphire", 8, 10206, 7422, 511, 32, GRAPHIRE, wacom_graphire_irq }, |
533 |
{ "Wacom Graphire2 4x5", 8, 10206, 7422, 511, 32, 1, wacom_graphire_irq }, |
679 |
{ "Wacom Graphire2 4x5", 8, 10206, 7422, 511, 32, GRAPHIRE, wacom_graphire_irq }, |
534 |
{ "Wacom Graphire2 5x7", 8, 13918, 10206, 511, 32, 1, wacom_graphire_irq }, |
680 |
{ "Wacom Graphire2 5x7", 8, 13918, 10206, 511, 32, GRAPHIRE, wacom_graphire_irq }, |
535 |
{ "Wacom Graphire3", 8, 10208, 7424, 511, 32, 1, wacom_graphire_irq }, |
681 |
{ "Wacom Graphire3", 8, 10208, 7424, 511, 32, GRAPHIRE, wacom_graphire_irq }, |
536 |
{ "Wacom Graphire3 6x8", 8, 16704, 12064, 511, 32, 1, wacom_graphire_irq }, |
682 |
{ "Wacom Graphire3 6x8", 8, 16704, 12064, 511, 32, GRAPHIRE, wacom_graphire_irq }, |
537 |
{ "Wacom Intuos 4x5", 10, 12700, 10600, 1023, 15, 2, wacom_intuos_irq }, |
683 |
{ "Wacom Intuos 4x5", 10, 12700, 10600, 1023, 15, INTUOS, wacom_intuos_irq }, |
538 |
{ "Wacom Intuos 6x8", 10, 20320, 16240, 1023, 15, 2, wacom_intuos_irq }, |
684 |
{ "Wacom Intuos 6x8", 10, 20320, 16240, 1023, 15, INTUOS, wacom_intuos_irq }, |
539 |
{ "Wacom Intuos 9x12", 10, 30480, 24060, 1023, 15, 2, wacom_intuos_irq }, |
685 |
{ "Wacom Intuos 9x12", 10, 30480, 24060, 1023, 15, INTUOS, wacom_intuos_irq }, |
540 |
{ "Wacom Intuos 12x12", 10, 30480, 31680, 1023, 15, 2, wacom_intuos_irq }, |
686 |
{ "Wacom Intuos 12x12", 10, 30480, 31680, 1023, 15, INTUOS, wacom_intuos_irq }, |
541 |
{ "Wacom Intuos 12x18", 10, 45720, 31680, 1023, 15, 2, wacom_intuos_irq }, |
687 |
{ "Wacom Intuos 12x18", 10, 45720, 31680, 1023, 15, INTUOS, wacom_intuos_irq }, |
542 |
{ "Wacom PL400", 8, 5408, 4056, 255, 32, 3, wacom_pl_irq }, |
688 |
{ "Wacom PL400", 8, 5408, 4056, 255, 32, PL, wacom_pl_irq }, |
543 |
{ "Wacom PL500", 8, 6144, 4608, 255, 32, 3, wacom_pl_irq }, |
689 |
{ "Wacom PL500", 8, 6144, 4608, 255, 32, PL, wacom_pl_irq }, |
544 |
{ "Wacom PL600", 8, 6126, 4604, 255, 32, 3, wacom_pl_irq }, |
690 |
{ "Wacom PL600", 8, 6126, 4604, 255, 32, PL, wacom_pl_irq }, |
545 |
{ "Wacom PL600SX", 8, 6260, 5016, 255, 32, 3, wacom_pl_irq }, |
691 |
{ "Wacom PL600SX", 8, 6260, 5016, 255, 32, PL, wacom_pl_irq }, |
546 |
{ "Wacom PL550", 8, 6144, 4608, 511, 32, 3, wacom_pl_irq }, |
692 |
{ "Wacom PL550", 8, 6144, 4608, 511, 32, PL, wacom_pl_irq }, |
547 |
{ "Wacom PL800", 8, 7220, 5780, 511, 32, 3, wacom_pl_irq }, |
693 |
{ "Wacom PL800", 8, 7220, 5780, 511, 32, PL, wacom_pl_irq }, |
548 |
{ "Wacom Intuos2 4x5", 10, 12700, 10600, 1023, 15, 2, wacom_intuos_irq }, |
694 |
{ "Wacom Intuos2 4x5", 10, 12700, 10600, 1023, 15, INTUOS, wacom_intuos_irq }, |
549 |
{ "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 15, 2, wacom_intuos_irq }, |
695 |
{ "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 15, INTUOS, wacom_intuos_irq }, |
550 |
{ "Wacom Intuos2 9x12", 10, 30480, 24060, 1023, 15, 2, wacom_intuos_irq }, |
696 |
{ "Wacom Intuos2 9x12", 10, 30480, 24060, 1023, 15, INTUOS, wacom_intuos_irq }, |
551 |
{ "Wacom Intuos2 12x12", 10, 30480, 31680, 1023, 15, 2, wacom_intuos_irq }, |
697 |
{ "Wacom Intuos2 12x12", 10, 30480, 31680, 1023, 15, INTUOS, wacom_intuos_irq }, |
552 |
{ "Wacom Intuos2 12x18", 10, 45720, 31680, 1023, 15, 2, wacom_intuos_irq }, |
698 |
{ "Wacom Intuos2 12x18", 10, 45720, 31680, 1023, 15, INTUOS, wacom_intuos_irq }, |
553 |
{ "Wacom Volito", 8, 5104, 3712, 511, 32, 1, wacom_graphire_irq }, |
699 |
{ "Wacom Volito", 8, 5104, 3712, 511, 32, GRAPHIRE, wacom_graphire_irq }, |
554 |
{ "Wacom Cintiq Partner",8, 20480, 15360, 511, 32, 3, wacom_ptu_irq }, |
700 |
{ "Wacom Volito2", 8, 5104, 3712, 511, 32, GRAPHIRE, wacom_graphire_irq }, |
555 |
{ "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 15, 2, wacom_intuos_irq }, |
701 |
{ "Wacom Cintiq Partner",8, 20480, 15360, 511, 32, PL, wacom_ptu_irq }, |
|
|
702 |
{ "Wacom Intuos3 4x5", 10, 25400, 20320, 1023, 15, INTUOS3, wacom_intuos_irq }, |
703 |
{ "Wacom Intuos3 6x8", 10, 40640, 30480, 1023, 15, INTUOS3, wacom_intuos_irq }, |
704 |
{ "Wacom Intuos3 9x12", 10, 60960, 45720, 1023, 15, INTUOS3, wacom_intuos_irq }, |
705 |
{ "Wacom Cintiq 21UX", 10, 87200, 65600, 1023, 15, CINTIQ, wacom_intuos_irq }, |
706 |
{ "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 15, INTUOS, wacom_intuos_irq }, |
556 |
{ } |
707 |
{ } |
557 |
}; |
708 |
}; |
558 |
|
709 |
|
Lines 580-586
Link Here
|
580 |
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x44) }, |
731 |
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x44) }, |
581 |
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x45) }, |
732 |
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x45) }, |
582 |
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x60) }, |
733 |
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x60) }, |
583 |
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x03) }, |
734 |
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x62) }, |
|
|
735 |
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x03) }, |
736 |
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB0) }, |
737 |
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB1) }, |
738 |
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB2) }, |
739 |
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x3F) }, |
584 |
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x47) }, |
740 |
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x47) }, |
585 |
{ } |
741 |
{ } |
586 |
}; |
742 |
}; |
Lines 643-649
Link Here
|
643 |
wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_PEN) | BIT(BTN_TOUCH) | BIT(BTN_STYLUS); |
799 |
wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_PEN) | BIT(BTN_TOUCH) | BIT(BTN_STYLUS); |
644 |
|
800 |
|
645 |
switch (wacom->features->type) { |
801 |
switch (wacom->features->type) { |
646 |
case 1: |
802 |
case GRAPHIRE: |
647 |
wacom->dev.evbit[0] |= BIT(EV_REL); |
803 |
wacom->dev.evbit[0] |= BIT(EV_REL); |
648 |
wacom->dev.relbit[0] |= BIT(REL_WHEEL); |
804 |
wacom->dev.relbit[0] |= BIT(REL_WHEEL); |
649 |
wacom->dev.absbit[0] |= BIT(ABS_DISTANCE); |
805 |
wacom->dev.absbit[0] |= BIT(ABS_DISTANCE); |
Lines 651-668
Link Here
|
651 |
wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_RUBBER) | BIT(BTN_TOOL_MOUSE) | BIT(BTN_STYLUS2); |
807 |
wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_RUBBER) | BIT(BTN_TOOL_MOUSE) | BIT(BTN_STYLUS2); |
652 |
break; |
808 |
break; |
653 |
|
809 |
|
654 |
case 2: |
810 |
case INTUOS3: |
|
|
811 |
case CINTIQ: |
812 |
wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_FINGER); |
813 |
wacom->dev.keybit[LONG(BTN_LEFT)] |= BIT(BTN_0) | BIT(BTN_1) | BIT(BTN_2) | BIT(BTN_3) | BIT(BTN_4) | BIT(BTN_5) | BIT(BTN_6) | BIT(BTN_7); |
814 |
wacom->dev.absbit[0] |= BIT(ABS_RX) | BIT(ABS_RY); |
815 |
/* fall through */ |
816 |
|
817 |
case INTUOS: |
655 |
wacom->dev.evbit[0] |= BIT(EV_MSC) | BIT(EV_REL); |
818 |
wacom->dev.evbit[0] |= BIT(EV_MSC) | BIT(EV_REL); |
656 |
wacom->dev.mscbit[0] |= BIT(MSC_SERIAL); |
819 |
wacom->dev.mscbit[0] |= BIT(MSC_SERIAL); |
657 |
wacom->dev.relbit[0] |= BIT(REL_WHEEL); |
820 |
wacom->dev.relbit[0] |= BIT(REL_WHEEL); |
658 |
wacom->dev.keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE) | BIT(BTN_SIDE) | BIT(BTN_EXTRA); |
821 |
wacom->dev.keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE) | BIT(BTN_SIDE) | BIT(BTN_EXTRA); |
659 |
wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_RUBBER) | BIT(BTN_TOOL_MOUSE) | BIT(BTN_TOOL_BRUSH) |
822 |
wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_RUBBER) | BIT(BTN_TOOL_MOUSE) | BIT(BTN_TOOL_BRUSH) |
660 |
| BIT(BTN_TOOL_PENCIL) | BIT(BTN_TOOL_AIRBRUSH) | BIT(BTN_TOOL_LENS) | BIT(BTN_STYLUS2); |
823 |
| BIT(BTN_TOOL_PENCIL) | BIT(BTN_TOOL_AIRBRUSH) | BIT(BTN_TOOL_LENS) | BIT(BTN_STYLUS2); |
661 |
wacom->dev.absbit[0] |= BIT(ABS_DISTANCE) | BIT(ABS_WHEEL) | BIT(ABS_TILT_X) | BIT(ABS_TILT_Y) | BIT(ABS_RZ) | BIT(ABS_THROTTLE); |
824 |
wacom->dev.absbit[0] |= BIT(ABS_DISTANCE) | BIT(ABS_WHEEL) | BIT(ABS_TILT_X) | BIT(ABS_TILT_Y) | BIT(ABS_RZ) | BIT(ABS_THROTTLE); |
662 |
break; |
825 |
break; |
663 |
|
826 |
|
664 |
case 3: |
827 |
case PL: |
665 |
wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_STYLUS2); |
828 |
wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_STYLUS2) | BIT(BTN_TOOL_RUBBER); |
666 |
break; |
829 |
break; |
667 |
} |
830 |
} |
668 |
|
831 |
|
Lines 674-679
Link Here
|
674 |
wacom->dev.absmax[ABS_TILT_Y] = 127; |
837 |
wacom->dev.absmax[ABS_TILT_Y] = 127; |
675 |
wacom->dev.absmax[ABS_WHEEL] = 1023; |
838 |
wacom->dev.absmax[ABS_WHEEL] = 1023; |
676 |
|
839 |
|
|
|
840 |
wacom->dev.absmax[ABS_RX] = 4097; |
841 |
wacom->dev.absmax[ABS_RY] = 4097; |
677 |
wacom->dev.absmin[ABS_RZ] = -900; |
842 |
wacom->dev.absmin[ABS_RZ] = -900; |
678 |
wacom->dev.absmax[ABS_RZ] = 899; |
843 |
wacom->dev.absmax[ABS_RZ] = 899; |
679 |
wacom->dev.absmin[ABS_THROTTLE] = -1023; |
844 |
wacom->dev.absmin[ABS_THROTTLE] = -1023; |
Lines 712-720
Link Here
|
712 |
|
877 |
|
713 |
input_register_device(&wacom->dev); |
878 |
input_register_device(&wacom->dev); |
714 |
|
879 |
|
|
|
880 |
/* ask the tablet to report tablet data */ |
881 |
usb_set_report(intf, 3, 2, rep_data, 2); |
882 |
/* repeat once (not sure why the first call often fails) */ |
715 |
usb_set_report(intf, 3, 2, rep_data, 2); |
883 |
usb_set_report(intf, 3, 2, rep_data, 2); |
716 |
usb_set_report(intf, 3, 5, rep_data, 0); |
|
|
717 |
usb_set_report(intf, 3, 6, rep_data, 0); |
718 |
|
884 |
|
719 |
printk(KERN_INFO "input: %s on %s\n", wacom->features->name, path); |
885 |
printk(KERN_INFO "input: %s on %s\n", wacom->features->name, path); |
720 |
|
886 |
|