diff options
author | Ping Cheng <pingc@wacom.com> | 2005-06-06 03:25:50 -0400 |
---|---|---|
committer | Dmitry Torokhov <dtor_core@ameritech.net> | 2005-06-06 03:25:50 -0400 |
commit | b2f86369e3e999a70f98e2a812aa5ec1b3c7bd0b (patch) | |
tree | 5bed04a24c349223d7e57bfb798b2a78a907d11a /drivers/usb/input | |
parent | 53880546979605dae20ee0404a0e998e188fe7ad (diff) |
Input: Wacom driver update
- add support for Cintiq 21UX
- fix a Graphire bug
- merge wacom_intuos3_irq into wacom_intuos_irq
Signed-off-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/usb/input')
-rw-r--r-- | drivers/usb/input/wacom.c | 336 |
1 files changed, 153 insertions, 183 deletions
diff --git a/drivers/usb/input/wacom.c b/drivers/usb/input/wacom.c index e37d31b57b23..60df242ba67f 100644 --- a/drivers/usb/input/wacom.c +++ b/drivers/usb/input/wacom.c | |||
@@ -9,7 +9,7 @@ | |||
9 | * Copyright (c) 2000 Daniel Egger <egger@suse.de> | 9 | * Copyright (c) 2000 Daniel Egger <egger@suse.de> |
10 | * Copyright (c) 2001 Frederic Lepied <flepied@mandrakesoft.com> | 10 | * Copyright (c) 2001 Frederic Lepied <flepied@mandrakesoft.com> |
11 | * Copyright (c) 2004 Panagiotis Issaris <panagiotis.issaris@mech.kuleuven.ac.be> | 11 | * Copyright (c) 2004 Panagiotis Issaris <panagiotis.issaris@mech.kuleuven.ac.be> |
12 | * Copyright (c) 2002-2004 Ping Cheng <pingc@wacom.com> | 12 | * Copyright (c) 2002-2005 Ping Cheng <pingc@wacom.com> |
13 | * | 13 | * |
14 | * ChangeLog: | 14 | * ChangeLog: |
15 | * v0.1 (vp) - Initial release | 15 | * v0.1 (vp) - Initial release |
@@ -51,6 +51,9 @@ | |||
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 | * v1.43 (pc) - Added support for Cintiq 21UX | ||
55 | - Fixed a Graphire bug | ||
56 | - Merged wacom_intuos3_irq into wacom_intuos_irq | ||
54 | */ | 57 | */ |
55 | 58 | ||
56 | /* | 59 | /* |
@@ -72,7 +75,7 @@ | |||
72 | /* | 75 | /* |
73 | * Version Information | 76 | * Version Information |
74 | */ | 77 | */ |
75 | #define DRIVER_VERSION "v1.40" | 78 | #define DRIVER_VERSION "v1.43" |
76 | #define DRIVER_AUTHOR "Vojtech Pavlik <vojtech@ucw.cz>" | 79 | #define DRIVER_AUTHOR "Vojtech Pavlik <vojtech@ucw.cz>" |
77 | #define DRIVER_DESC "USB Wacom Graphire and Wacom Intuos tablet driver" | 80 | #define DRIVER_DESC "USB Wacom Graphire and Wacom Intuos tablet driver" |
78 | #define DRIVER_LICENSE "GPL" | 81 | #define DRIVER_LICENSE "GPL" |
@@ -83,6 +86,16 @@ MODULE_LICENSE(DRIVER_LICENSE); | |||
83 | 86 | ||
84 | #define USB_VENDOR_ID_WACOM 0x056a | 87 | #define USB_VENDOR_ID_WACOM 0x056a |
85 | 88 | ||
89 | enum { | ||
90 | PENPARTNER = 0, | ||
91 | GRAPHIRE, | ||
92 | PL, | ||
93 | INTUOS, | ||
94 | INTUOS3, | ||
95 | CINTIQ, | ||
96 | MAX_TYPE | ||
97 | }; | ||
98 | |||
86 | struct wacom_features { | 99 | struct wacom_features { |
87 | char *name; | 100 | char *name; |
88 | int pktlen; | 101 | int pktlen; |
@@ -181,8 +194,8 @@ static void wacom_pl_irq(struct urb *urb, struct pt_regs *regs) | |||
181 | wacom->tool[1] = BTN_TOOL_PEN; | 194 | wacom->tool[1] = BTN_TOOL_PEN; |
182 | } | 195 | } |
183 | input_report_key(dev, wacom->tool[1], prox); /* report in proximity for tool */ | 196 | input_report_key(dev, wacom->tool[1], prox); /* report in proximity for tool */ |
184 | input_report_abs(dev, ABS_X, data[3] | ((__u32)data[2] << 7) | ((__u32)(data[1] & 0x03) << 14)); | 197 | input_report_abs(dev, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14)); |
185 | input_report_abs(dev, ABS_Y, data[6] | ((__u32)data[5] << 7) | ((__u32)(data[4] & 0x03) << 14)); | 198 | input_report_abs(dev, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14)); |
186 | input_report_abs(dev, ABS_PRESSURE, pressure); | 199 | input_report_abs(dev, ABS_PRESSURE, pressure); |
187 | 200 | ||
188 | input_report_key(dev, BTN_TOUCH, data[4] & 0x08); | 201 | input_report_key(dev, BTN_TOUCH, data[4] & 0x08); |
@@ -339,44 +352,44 @@ static void wacom_graphire_irq(struct urb *urb, struct pt_regs *regs) | |||
339 | 352 | ||
340 | input_regs(dev, regs); | 353 | input_regs(dev, regs); |
341 | 354 | ||
342 | switch ((data[1] >> 5) & 3) { | 355 | if ( data[1] & 0x10 ) /* in prox */ |
343 | 356 | { | |
344 | case 0: /* Pen */ | 357 | switch ((data[1] >> 5) & 3) { |
345 | input_report_key(dev, BTN_TOOL_PEN, data[1] & 0x80); | ||
346 | break; | ||
347 | |||
348 | case 1: /* Rubber */ | ||
349 | input_report_key(dev, BTN_TOOL_RUBBER, data[1] & 0x80); | ||
350 | break; | ||
351 | 358 | ||
352 | case 2: /* Mouse with wheel */ | 359 | case 0: /* Pen */ |
353 | input_report_key(dev, BTN_MIDDLE, data[1] & 0x04); | 360 | wacom->tool[0] = BTN_TOOL_PEN; |
354 | input_report_rel(dev, REL_WHEEL, (signed char) data[6]); | 361 | break; |
355 | /* fall through */ | ||
356 | 362 | ||
357 | case 3: /* Mouse without wheel */ | 363 | case 1: /* Rubber */ |
358 | input_report_key(dev, BTN_TOOL_MOUSE, data[7] > 24); | 364 | wacom->tool[0] = BTN_TOOL_RUBBER; |
359 | input_report_key(dev, BTN_LEFT, data[1] & 0x01); | 365 | break; |
360 | input_report_key(dev, BTN_RIGHT, data[1] & 0x02); | ||
361 | input_report_abs(dev, ABS_DISTANCE, data[7]); | ||
362 | 366 | ||
363 | input_report_abs(dev, ABS_X, x); | 367 | case 2: /* Mouse with wheel */ |
364 | input_report_abs(dev, ABS_Y, y); | 368 | input_report_key(dev, BTN_MIDDLE, data[1] & 0x04); |
369 | input_report_rel(dev, REL_WHEEL, (signed char) data[6]); | ||
370 | /* fall through */ | ||
365 | 371 | ||
366 | input_sync(dev); | 372 | case 3: /* Mouse without wheel */ |
367 | goto exit; | 373 | wacom->tool[0] = BTN_TOOL_MOUSE; |
374 | input_report_key(dev, BTN_LEFT, data[1] & 0x01); | ||
375 | input_report_key(dev, BTN_RIGHT, data[1] & 0x02); | ||
376 | input_report_abs(dev, ABS_DISTANCE, data[7]); | ||
377 | break; | ||
378 | } | ||
368 | } | 379 | } |
369 | 380 | ||
370 | if (data[1] & 0x80) { | 381 | if (data[1] & 0x80) { |
371 | input_report_abs(dev, ABS_X, x); | 382 | input_report_abs(dev, ABS_X, x); |
372 | input_report_abs(dev, ABS_Y, y); | 383 | input_report_abs(dev, ABS_Y, y); |
373 | } | 384 | } |
385 | if (wacom->tool[0] != BTN_TOOL_MOUSE) { | ||
386 | input_report_abs(dev, ABS_PRESSURE, le16_to_cpu(*(__le16 *) &data[6])); | ||
387 | input_report_key(dev, BTN_TOUCH, data[1] & 0x01); | ||
388 | input_report_key(dev, BTN_STYLUS, data[1] & 0x02); | ||
389 | input_report_key(dev, BTN_STYLUS2, data[1] & 0x04); | ||
390 | } | ||
374 | 391 | ||
375 | input_report_abs(dev, ABS_PRESSURE, le16_to_cpu(*(__le16 *) &data[6])); | 392 | input_report_key(dev, wacom->tool[0], data[1] & 0x10); |
376 | input_report_key(dev, BTN_TOUCH, data[1] & 0x01); | ||
377 | input_report_key(dev, BTN_STYLUS, data[1] & 0x02); | ||
378 | input_report_key(dev, BTN_STYLUS2, data[1] & 0x04); | ||
379 | |||
380 | input_sync(dev); | 393 | input_sync(dev); |
381 | 394 | ||
382 | exit: | 395 | exit: |
@@ -400,11 +413,11 @@ static int wacom_intuos_inout(struct urb *urb) | |||
400 | if ((data[1] & 0xfc) == 0xc0) | 413 | if ((data[1] & 0xfc) == 0xc0) |
401 | { | 414 | { |
402 | /* serial number of the tool */ | 415 | /* serial number of the tool */ |
403 | wacom->serial[idx] = ((__u32)(data[3] & 0x0f) << 28) + | 416 | wacom->serial[idx] = ((data[3] & 0x0f) << 28) + |
404 | ((__u32)data[4] << 20) + ((__u32)data[5] << 12) + | 417 | (data[4] << 20) + (data[5] << 12) + |
405 | ((__u32)data[6] << 4) + (data[7] >> 4); | 418 | (data[6] << 4) + (data[7] >> 4); |
406 | 419 | ||
407 | switch (((__u32)data[2] << 4) | (data[3] >> 4)) { | 420 | switch ((data[2] << 4) | (data[3] >> 4)) { |
408 | case 0x812: /* Inking pen */ | 421 | case 0x812: /* Inking pen */ |
409 | case 0x801: /* Intuos3 Inking pen */ | 422 | case 0x801: /* Intuos3 Inking pen */ |
410 | case 0x012: | 423 | case 0x012: |
@@ -448,7 +461,7 @@ static int wacom_intuos_inout(struct urb *urb) | |||
448 | case 0x112: | 461 | case 0x112: |
449 | case 0x913: /* Intuos3 Airbrush */ | 462 | case 0x913: /* Intuos3 Airbrush */ |
450 | wacom->tool[idx] = BTN_TOOL_AIRBRUSH; | 463 | wacom->tool[idx] = BTN_TOOL_AIRBRUSH; |
451 | break; /* Airbrush */ | 464 | break; |
452 | default: /* Unknown tool */ | 465 | default: /* Unknown tool */ |
453 | wacom->tool[idx] = BTN_TOOL_PEN; | 466 | wacom->tool[idx] = BTN_TOOL_PEN; |
454 | } | 467 | } |
@@ -479,7 +492,7 @@ static void wacom_intuos_general(struct urb *urb) | |||
479 | /* general pen packet */ | 492 | /* general pen packet */ |
480 | if ((data[1] & 0xb8) == 0xa0) | 493 | if ((data[1] & 0xb8) == 0xa0) |
481 | { | 494 | { |
482 | t = ((__u32)data[6] << 2) | ((data[7] >> 6) & 3); | 495 | t = (data[6] << 2) | ((data[7] >> 6) & 3); |
483 | input_report_abs(dev, ABS_PRESSURE, t); | 496 | input_report_abs(dev, ABS_PRESSURE, t); |
484 | input_report_abs(dev, ABS_TILT_X, | 497 | input_report_abs(dev, ABS_TILT_X, |
485 | ((data[7] << 1) & 0x7e) | (data[8] >> 7)); | 498 | ((data[7] << 1) & 0x7e) | (data[8] >> 7)); |
@@ -493,7 +506,7 @@ static void wacom_intuos_general(struct urb *urb) | |||
493 | if ((data[1] & 0xbc) == 0xb4) | 506 | if ((data[1] & 0xbc) == 0xb4) |
494 | { | 507 | { |
495 | input_report_abs(dev, ABS_WHEEL, | 508 | input_report_abs(dev, ABS_WHEEL, |
496 | ((__u32)data[6] << 2) | ((data[7] >> 6) & 3)); | 509 | (data[6] << 2) | ((data[7] >> 6) & 3)); |
497 | input_report_abs(dev, ABS_TILT_X, | 510 | input_report_abs(dev, ABS_TILT_X, |
498 | ((data[7] << 1) & 0x7e) | (data[8] >> 7)); | 511 | ((data[7] << 1) & 0x7e) | (data[8] >> 7)); |
499 | input_report_abs(dev, ABS_TILT_Y, data[8] & 0x7f); | 512 | input_report_abs(dev, ABS_TILT_Y, data[8] & 0x7f); |
@@ -525,7 +538,7 @@ static void wacom_intuos_irq(struct urb *urb, struct pt_regs *regs) | |||
525 | goto exit; | 538 | goto exit; |
526 | } | 539 | } |
527 | 540 | ||
528 | if (data[0] != 2 && data[0] != 5 && data[0] != 6) { | 541 | if (data[0] != 2 && data[0] != 5 && data[0] != 6 && data[0] != 12) { |
529 | dbg("wacom_intuos_irq: received unknown report #%d", data[0]); | 542 | dbg("wacom_intuos_irq: received unknown report #%d", data[0]); |
530 | goto exit; | 543 | goto exit; |
531 | } | 544 | } |
@@ -535,101 +548,6 @@ static void wacom_intuos_irq(struct urb *urb, struct pt_regs *regs) | |||
535 | /* tool number */ | 548 | /* tool number */ |
536 | idx = data[1] & 0x01; | 549 | idx = data[1] & 0x01; |
537 | 550 | ||
538 | /* process in/out prox events */ | ||
539 | if (wacom_intuos_inout(urb)) goto exit; | ||
540 | |||
541 | input_report_abs(dev, ABS_X, be16_to_cpu(*(__be16 *) &data[2])); | ||
542 | input_report_abs(dev, ABS_Y, be16_to_cpu(*(__be16 *) &data[4])); | ||
543 | input_report_abs(dev, ABS_DISTANCE, data[9]); | ||
544 | |||
545 | /* process general packets */ | ||
546 | wacom_intuos_general(urb); | ||
547 | |||
548 | if ((data[1] & 0xbc) == 0xa8 || (data[1] & 0xbe) == 0xb0) { /* 4D mouse or Lens cursor packets */ | ||
549 | |||
550 | if (data[1] & 0x02) { /* Rotation packet */ | ||
551 | |||
552 | t = ((__u32)data[6] << 3) | ((data[7] >> 5) & 7); | ||
553 | input_report_abs(dev, ABS_RZ, (data[7] & 0x20) ? ((t - 1) / 2) : -t / 2); | ||
554 | |||
555 | } else { | ||
556 | |||
557 | if ((data[1] & 0x10) == 0) { /* 4D mouse packets */ | ||
558 | |||
559 | input_report_key(dev, BTN_LEFT, data[8] & 0x01); | ||
560 | input_report_key(dev, BTN_MIDDLE, data[8] & 0x02); | ||
561 | input_report_key(dev, BTN_RIGHT, data[8] & 0x04); | ||
562 | |||
563 | input_report_key(dev, BTN_SIDE, data[8] & 0x20); | ||
564 | input_report_key(dev, BTN_EXTRA, data[8] & 0x10); | ||
565 | t = ((__u32)data[6] << 2) | ((data[7] >> 6) & 3); | ||
566 | input_report_abs(dev, ABS_THROTTLE, (data[8] & 0x08) ? -t : t); | ||
567 | |||
568 | } else { | ||
569 | if (wacom->tool[idx] == BTN_TOOL_MOUSE) { /* 2D mouse packets */ | ||
570 | input_report_key(dev, BTN_LEFT, data[8] & 0x04); | ||
571 | input_report_key(dev, BTN_MIDDLE, data[8] & 0x08); | ||
572 | input_report_key(dev, BTN_RIGHT, data[8] & 0x10); | ||
573 | input_report_rel(dev, REL_WHEEL, | ||
574 | (-(__u32)(data[8] & 0x01) + (__u32)((data[8] & 0x02) >> 1))); | ||
575 | } | ||
576 | else { /* Lens cursor packets */ | ||
577 | input_report_key(dev, BTN_LEFT, data[8] & 0x01); | ||
578 | input_report_key(dev, BTN_MIDDLE, data[8] & 0x02); | ||
579 | input_report_key(dev, BTN_RIGHT, data[8] & 0x04); | ||
580 | input_report_key(dev, BTN_SIDE, data[8] & 0x10); | ||
581 | input_report_key(dev, BTN_EXTRA, data[8] & 0x08); | ||
582 | } | ||
583 | } | ||
584 | } | ||
585 | } | ||
586 | |||
587 | input_report_key(dev, wacom->tool[idx], 1); | ||
588 | input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]); | ||
589 | input_sync(dev); | ||
590 | |||
591 | exit: | ||
592 | retval = usb_submit_urb (urb, GFP_ATOMIC); | ||
593 | if (retval) | ||
594 | err ("%s - usb_submit_urb failed with result %d", | ||
595 | __FUNCTION__, retval); | ||
596 | } | ||
597 | |||
598 | static void wacom_intuos3_irq(struct urb *urb, struct pt_regs *regs) | ||
599 | { | ||
600 | struct wacom *wacom = urb->context; | ||
601 | unsigned char *data = wacom->data; | ||
602 | struct input_dev *dev = &wacom->dev; | ||
603 | unsigned int t; | ||
604 | int idx, retval; | ||
605 | |||
606 | switch (urb->status) { | ||
607 | case 0: | ||
608 | /* success */ | ||
609 | break; | ||
610 | case -ECONNRESET: | ||
611 | case -ENOENT: | ||
612 | case -ESHUTDOWN: | ||
613 | /* this urb is terminated, clean up */ | ||
614 | dbg("%s - urb shutting down with status: %d", __FUNCTION__, urb->status); | ||
615 | return; | ||
616 | default: | ||
617 | dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status); | ||
618 | goto exit; | ||
619 | } | ||
620 | |||
621 | /* check for valid report */ | ||
622 | if (data[0] != 2 && data[0] != 5 && data[0] != 12) | ||
623 | { | ||
624 | printk(KERN_INFO "wacom_intuos3_irq: received unknown report #%d\n", data[0]); | ||
625 | goto exit; | ||
626 | } | ||
627 | |||
628 | input_regs(dev, regs); | ||
629 | |||
630 | /* tool index is always 0 here since there is no dual input tool */ | ||
631 | idx = data[1] & 0x01; | ||
632 | |||
633 | /* pad packets. Works as a second tool and is always in prox */ | 551 | /* pad packets. Works as a second tool and is always in prox */ |
634 | if (data[0] == 12) | 552 | if (data[0] == 12) |
635 | { | 553 | { |
@@ -657,35 +575,84 @@ static void wacom_intuos3_irq(struct urb *urb, struct pt_regs *regs) | |||
657 | /* process in/out prox events */ | 575 | /* process in/out prox events */ |
658 | if (wacom_intuos_inout(urb)) goto exit; | 576 | if (wacom_intuos_inout(urb)) goto exit; |
659 | 577 | ||
660 | input_report_abs(dev, ABS_X, ((__u32)data[2] << 9) | ((__u32)data[3] << 1) | ((data[9] >> 1) & 1)); | 578 | /* Cintiq doesn't send data when RDY bit isn't set */ |
661 | input_report_abs(dev, ABS_Y, ((__u32)data[4] << 9) | ((__u32)data[5] << 1) | (data[9] & 1)); | 579 | if ((wacom->features->type == CINTIQ) && !(data[1] & 0x40)) return; |
662 | input_report_abs(dev, ABS_DISTANCE, ((data[9] >> 2) & 0x3f)); | 580 | |
581 | if(wacom->features->type >= INTUOS3) | ||
582 | { | ||
583 | input_report_abs(dev, ABS_X, (data[2] << 9) | (data[3] << 1) | ((data[9] >> 1) & 1)); | ||
584 | input_report_abs(dev, ABS_Y, (data[4] << 9) | (data[5] << 1) | (data[9] & 1)); | ||
585 | input_report_abs(dev, ABS_DISTANCE, ((data[9] >> 2) & 0x3f)); | ||
586 | } | ||
587 | else | ||
588 | { | ||
589 | input_report_abs(dev, ABS_X, be16_to_cpu(*(__be16 *) &data[2])); | ||
590 | input_report_abs(dev, ABS_Y, be16_to_cpu(*(__be16 *) &data[4])); | ||
591 | input_report_abs(dev, ABS_DISTANCE, ((data[9] >> 3) & 0x1f)); | ||
592 | } | ||
663 | 593 | ||
664 | /* process general packets */ | 594 | /* process general packets */ |
665 | wacom_intuos_general(urb); | 595 | wacom_intuos_general(urb); |
666 | 596 | ||
667 | if ((data[1] & 0xbc) == 0xa8 || (data[1] & 0xbe) == 0xb0) | 597 | /* 4D mouse, 2D mouse, marker pen rotation, or Lens cursor packets */ |
668 | { | 598 | if ((data[1] & 0xbc) == 0xa8 || (data[1] & 0xbe) == 0xb0) { |
669 | /* Marker pen rotation packet. Reported as wheel due to valuator limitation */ | 599 | /* Rotation packet */ |
670 | if (data[1] & 0x02) | 600 | if (data[1] & 0x02) |
671 | { | 601 | { |
672 | t = ((__u32)data[6] << 3) | ((data[7] >> 5) & 7); | 602 | if(wacom->features->type >= INTUOS3) |
673 | t = (data[7] & 0x20) ? ((t > 900) ? ((t-1) / 2 - 1350) : | 603 | { |
674 | ((t-1) / 2 + 450)) : (450 - t / 2) ; | 604 | /* I3 marker pen rotation reported as wheel |
675 | input_report_abs(dev, ABS_WHEEL, t); | 605 | * due to valuator limitation |
606 | */ | ||
607 | t = (data[6] << 3) | ((data[7] >> 5) & 7); | ||
608 | t = (data[7] & 0x20) ? ((t > 900) ? ((t-1) / 2 - 1350) : | ||
609 | ((t-1) / 2 + 450)) : (450 - t / 2) ; | ||
610 | input_report_abs(dev, ABS_WHEEL, t); | ||
611 | } | ||
612 | else | ||
613 | { | ||
614 | /* 4D mouse rotation packet */ | ||
615 | t = (data[6] << 3) | ((data[7] >> 5) & 7); | ||
616 | input_report_abs(dev, ABS_RZ, (data[7] & 0x20) ? | ||
617 | ((t - 1) / 2) : -t / 2); | ||
618 | } | ||
619 | } | ||
620 | /* 4D mouse packets */ | ||
621 | else if ( !(data[1] & 0x10) && wacom->features->type < INTUOS3) | ||
622 | { | ||
623 | input_report_key(dev, BTN_LEFT, data[8] & 0x01); | ||
624 | input_report_key(dev, BTN_MIDDLE, data[8] & 0x02); | ||
625 | input_report_key(dev, BTN_RIGHT, data[8] & 0x04); | ||
626 | |||
627 | input_report_key(dev, BTN_SIDE, data[8] & 0x20); | ||
628 | input_report_key(dev, BTN_EXTRA, data[8] & 0x10); | ||
629 | t = (data[6] << 2) | ((data[7] >> 6) & 3); | ||
630 | input_report_abs(dev, ABS_THROTTLE, (data[8] & 0x08) ? -t : t); | ||
676 | } | 631 | } |
677 | |||
678 | /* 2D mouse packets */ | 632 | /* 2D mouse packets */ |
679 | if (wacom->tool[idx] == BTN_TOOL_MOUSE) | 633 | else if (wacom->tool[idx] == BTN_TOOL_MOUSE) |
680 | { | 634 | { |
681 | input_report_key(dev, BTN_LEFT, data[8] & 0x04); | 635 | input_report_key(dev, BTN_LEFT, data[8] & 0x04); |
682 | input_report_key(dev, BTN_MIDDLE, data[8] & 0x08); | 636 | input_report_key(dev, BTN_MIDDLE, data[8] & 0x08); |
683 | input_report_key(dev, BTN_RIGHT, data[8] & 0x10); | 637 | input_report_key(dev, BTN_RIGHT, data[8] & 0x10); |
684 | input_report_key(dev, BTN_SIDE, data[8] & 0x40); | 638 | input_report_rel(dev, REL_WHEEL, ((data[8] & 0x02) >> 1) |
685 | input_report_key(dev, BTN_EXTRA, data[8] & 0x20); | 639 | - (data[8] & 0x01)); |
686 | /* mouse wheel is positive when rolled backwards */ | 640 | |
687 | input_report_rel(dev, REL_WHEEL, ((__u32)((data[8] & 0x02) >> 1) | 641 | /* I3 2D mouse side buttons */ |
688 | - (__u32)(data[8] & 0x01))); | 642 | if (wacom->features->type == INTUOS3) |
643 | { | ||
644 | input_report_key(dev, BTN_SIDE, data[8] & 0x40); | ||
645 | input_report_key(dev, BTN_EXTRA, data[8] & 0x20); | ||
646 | } | ||
647 | } | ||
648 | /* Lens cursor packets */ | ||
649 | else if (wacom->features->type < INTUOS3) | ||
650 | { | ||
651 | input_report_key(dev, BTN_LEFT, data[8] & 0x01); | ||
652 | input_report_key(dev, BTN_MIDDLE, data[8] & 0x02); | ||
653 | input_report_key(dev, BTN_RIGHT, data[8] & 0x04); | ||
654 | input_report_key(dev, BTN_SIDE, data[8] & 0x10); | ||
655 | input_report_key(dev, BTN_EXTRA, data[8] & 0x08); | ||
689 | } | 656 | } |
690 | } | 657 | } |
691 | 658 | ||
@@ -701,34 +668,35 @@ exit: | |||
701 | } | 668 | } |
702 | 669 | ||
703 | static struct wacom_features wacom_features[] = { | 670 | static struct wacom_features wacom_features[] = { |
704 | { "Wacom Penpartner", 7, 5040, 3780, 255, 32, 0, wacom_penpartner_irq }, | 671 | { "Wacom Penpartner", 7, 5040, 3780, 255, 32, PENPARTNER, wacom_penpartner_irq }, |
705 | { "Wacom Graphire", 8, 10206, 7422, 511, 32, 1, wacom_graphire_irq }, | 672 | { "Wacom Graphire", 8, 10206, 7422, 511, 32, GRAPHIRE, wacom_graphire_irq }, |
706 | { "Wacom Graphire2 4x5", 8, 10206, 7422, 511, 32, 1, wacom_graphire_irq }, | 673 | { "Wacom Graphire2 4x5", 8, 10206, 7422, 511, 32, GRAPHIRE, wacom_graphire_irq }, |
707 | { "Wacom Graphire2 5x7", 8, 13918, 10206, 511, 32, 1, wacom_graphire_irq }, | 674 | { "Wacom Graphire2 5x7", 8, 13918, 10206, 511, 32, GRAPHIRE, wacom_graphire_irq }, |
708 | { "Wacom Graphire3", 8, 10208, 7424, 511, 32, 1, wacom_graphire_irq }, | 675 | { "Wacom Graphire3", 8, 10208, 7424, 511, 32, GRAPHIRE, wacom_graphire_irq }, |
709 | { "Wacom Graphire3 6x8", 8, 16704, 12064, 511, 32, 1, wacom_graphire_irq }, | 676 | { "Wacom Graphire3 6x8", 8, 16704, 12064, 511, 32, GRAPHIRE, wacom_graphire_irq }, |
710 | { "Wacom Intuos 4x5", 10, 12700, 10600, 1023, 15, 2, wacom_intuos_irq }, | 677 | { "Wacom Intuos 4x5", 10, 12700, 10600, 1023, 15, INTUOS, wacom_intuos_irq }, |
711 | { "Wacom Intuos 6x8", 10, 20320, 16240, 1023, 15, 2, wacom_intuos_irq }, | 678 | { "Wacom Intuos 6x8", 10, 20320, 16240, 1023, 15, INTUOS, wacom_intuos_irq }, |
712 | { "Wacom Intuos 9x12", 10, 30480, 24060, 1023, 15, 2, wacom_intuos_irq }, | 679 | { "Wacom Intuos 9x12", 10, 30480, 24060, 1023, 15, INTUOS, wacom_intuos_irq }, |
713 | { "Wacom Intuos 12x12", 10, 30480, 31680, 1023, 15, 2, wacom_intuos_irq }, | 680 | { "Wacom Intuos 12x12", 10, 30480, 31680, 1023, 15, INTUOS, wacom_intuos_irq }, |
714 | { "Wacom Intuos 12x18", 10, 45720, 31680, 1023, 15, 2, wacom_intuos_irq }, | 681 | { "Wacom Intuos 12x18", 10, 45720, 31680, 1023, 15, INTUOS, wacom_intuos_irq }, |
715 | { "Wacom PL400", 8, 5408, 4056, 255, 32, 3, wacom_pl_irq }, | 682 | { "Wacom PL400", 8, 5408, 4056, 255, 32, PL, wacom_pl_irq }, |
716 | { "Wacom PL500", 8, 6144, 4608, 255, 32, 3, wacom_pl_irq }, | 683 | { "Wacom PL500", 8, 6144, 4608, 255, 32, PL, wacom_pl_irq }, |
717 | { "Wacom PL600", 8, 6126, 4604, 255, 32, 3, wacom_pl_irq }, | 684 | { "Wacom PL600", 8, 6126, 4604, 255, 32, PL, wacom_pl_irq }, |
718 | { "Wacom PL600SX", 8, 6260, 5016, 255, 32, 3, wacom_pl_irq }, | 685 | { "Wacom PL600SX", 8, 6260, 5016, 255, 32, PL, wacom_pl_irq }, |
719 | { "Wacom PL550", 8, 6144, 4608, 511, 32, 3, wacom_pl_irq }, | 686 | { "Wacom PL550", 8, 6144, 4608, 511, 32, PL, wacom_pl_irq }, |
720 | { "Wacom PL800", 8, 7220, 5780, 511, 32, 3, wacom_pl_irq }, | 687 | { "Wacom PL800", 8, 7220, 5780, 511, 32, PL, wacom_pl_irq }, |
721 | { "Wacom Intuos2 4x5", 10, 12700, 10600, 1023, 15, 2, wacom_intuos_irq }, | 688 | { "Wacom Intuos2 4x5", 10, 12700, 10600, 1023, 15, INTUOS, wacom_intuos_irq }, |
722 | { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 15, 2, wacom_intuos_irq }, | 689 | { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 15, INTUOS, wacom_intuos_irq }, |
723 | { "Wacom Intuos2 9x12", 10, 30480, 24060, 1023, 15, 2, wacom_intuos_irq }, | 690 | { "Wacom Intuos2 9x12", 10, 30480, 24060, 1023, 15, INTUOS, wacom_intuos_irq }, |
724 | { "Wacom Intuos2 12x12", 10, 30480, 31680, 1023, 15, 2, wacom_intuos_irq }, | 691 | { "Wacom Intuos2 12x12", 10, 30480, 31680, 1023, 15, INTUOS, wacom_intuos_irq }, |
725 | { "Wacom Intuos2 12x18", 10, 45720, 31680, 1023, 15, 2, wacom_intuos_irq }, | 692 | { "Wacom Intuos2 12x18", 10, 45720, 31680, 1023, 15, INTUOS, wacom_intuos_irq }, |
726 | { "Wacom Volito", 8, 5104, 3712, 511, 32, 1, wacom_graphire_irq }, | 693 | { "Wacom Volito", 8, 5104, 3712, 511, 32, GRAPHIRE, wacom_graphire_irq }, |
727 | { "Wacom Cintiq Partner",8, 20480, 15360, 511, 32, 3, wacom_ptu_irq }, | 694 | { "Wacom Cintiq Partner",8, 20480, 15360, 511, 32, PL, wacom_ptu_irq }, |
728 | { "Wacom Intuos3 4x5", 10, 25400, 20320, 1023, 15, 4, wacom_intuos3_irq }, | 695 | { "Wacom Intuos3 4x5", 10, 25400, 20320, 1023, 15, INTUOS3, wacom_intuos_irq }, |
729 | { "Wacom Intuos3 6x8", 10, 40640, 30480, 1023, 15, 4, wacom_intuos3_irq }, | 696 | { "Wacom Intuos3 6x8", 10, 40640, 30480, 1023, 15, INTUOS3, wacom_intuos_irq }, |
730 | { "Wacom Intuos3 9x12", 10, 60960, 45720, 1023, 15, 4, wacom_intuos3_irq }, | 697 | { "Wacom Intuos3 9x12", 10, 60960, 45720, 1023, 15, INTUOS3, wacom_intuos_irq }, |
731 | { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 15, 2, wacom_intuos_irq }, | 698 | { "Wacom Cintiq 21UX", 10, 87200, 65600, 1023, 15, CINTIQ, wacom_intuos_irq }, |
699 | { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 15, INTUOS, wacom_intuos_irq }, | ||
732 | { } | 700 | { } |
733 | }; | 701 | }; |
734 | 702 | ||
@@ -760,6 +728,7 @@ static struct usb_device_id wacom_ids[] = { | |||
760 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB0) }, | 728 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB0) }, |
761 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB1) }, | 729 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB1) }, |
762 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB2) }, | 730 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB2) }, |
731 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x3F) }, | ||
763 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x47) }, | 732 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x47) }, |
764 | { } | 733 | { } |
765 | }; | 734 | }; |
@@ -816,7 +785,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
816 | wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_PEN) | BIT(BTN_TOUCH) | BIT(BTN_STYLUS); | 785 | wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_PEN) | BIT(BTN_TOUCH) | BIT(BTN_STYLUS); |
817 | 786 | ||
818 | switch (wacom->features->type) { | 787 | switch (wacom->features->type) { |
819 | case 1: | 788 | case GRAPHIRE: |
820 | wacom->dev.evbit[0] |= BIT(EV_REL); | 789 | wacom->dev.evbit[0] |= BIT(EV_REL); |
821 | wacom->dev.relbit[0] |= BIT(REL_WHEEL); | 790 | wacom->dev.relbit[0] |= BIT(REL_WHEEL); |
822 | wacom->dev.absbit[0] |= BIT(ABS_DISTANCE); | 791 | wacom->dev.absbit[0] |= BIT(ABS_DISTANCE); |
@@ -824,13 +793,14 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
824 | wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_RUBBER) | BIT(BTN_TOOL_MOUSE) | BIT(BTN_STYLUS2); | 793 | wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_RUBBER) | BIT(BTN_TOOL_MOUSE) | BIT(BTN_STYLUS2); |
825 | break; | 794 | break; |
826 | 795 | ||
827 | case 4: /* new functions for Intuos3 */ | 796 | case INTUOS3: |
797 | case CINTIQ: | ||
828 | wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_FINGER); | 798 | wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_FINGER); |
829 | 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); | 799 | 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); |
830 | wacom->dev.absbit[0] |= BIT(ABS_RX) | BIT(ABS_RY); | 800 | wacom->dev.absbit[0] |= BIT(ABS_RX) | BIT(ABS_RY); |
831 | /* fall through */ | 801 | /* fall through */ |
832 | 802 | ||
833 | case 2: | 803 | case INTUOS: |
834 | wacom->dev.evbit[0] |= BIT(EV_MSC) | BIT(EV_REL); | 804 | wacom->dev.evbit[0] |= BIT(EV_MSC) | BIT(EV_REL); |
835 | wacom->dev.mscbit[0] |= BIT(MSC_SERIAL); | 805 | wacom->dev.mscbit[0] |= BIT(MSC_SERIAL); |
836 | wacom->dev.relbit[0] |= BIT(REL_WHEEL); | 806 | wacom->dev.relbit[0] |= BIT(REL_WHEEL); |
@@ -840,7 +810,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
840 | wacom->dev.absbit[0] |= BIT(ABS_DISTANCE) | BIT(ABS_WHEEL) | BIT(ABS_TILT_X) | BIT(ABS_TILT_Y) | BIT(ABS_RZ) | BIT(ABS_THROTTLE); | 810 | wacom->dev.absbit[0] |= BIT(ABS_DISTANCE) | BIT(ABS_WHEEL) | BIT(ABS_TILT_X) | BIT(ABS_TILT_Y) | BIT(ABS_RZ) | BIT(ABS_THROTTLE); |
841 | break; | 811 | break; |
842 | 812 | ||
843 | case 3: | 813 | case PL: |
844 | wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_STYLUS2) | BIT(BTN_TOOL_RUBBER); | 814 | wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_STYLUS2) | BIT(BTN_TOOL_RUBBER); |
845 | break; | 815 | break; |
846 | } | 816 | } |