aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/tablet/wacom_wac.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-12-25 07:51:46 -0500
committerIngo Molnar <mingo@elte.hu>2008-12-25 07:51:46 -0500
commit0b271ef4521756010675b1611bef20fd3096790d (patch)
tree2c9d22a2c74122a9904e533df27f41d63ffef394 /drivers/input/tablet/wacom_wac.c
parentb19b3c74c7bbec45a848631b8f970ac110665a01 (diff)
parent4a6908a3a050aacc9c3a2f36b276b46c0629ad91 (diff)
Merge commit 'v2.6.28' into core/core
Diffstat (limited to 'drivers/input/tablet/wacom_wac.c')
-rw-r--r--drivers/input/tablet/wacom_wac.c160
1 files changed, 146 insertions, 14 deletions
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index bf3d9a8b2c1b..8dc8d1e59bea 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -535,31 +535,147 @@ static int wacom_intuos_irq(struct wacom_wac *wacom, void *wcombo)
535 return 1; 535 return 1;
536} 536}
537 537
538int wacom_tpc_irq(struct wacom_wac *wacom, void *wcombo)
539{
540 char *data = wacom->data;
541 int prox = 0, pressure;
542 static int stylusInProx, touchInProx = 1, touchOut;
543 struct urb *urb = ((struct wacom_combo *)wcombo)->urb;
544
545 dbg("wacom_tpc_irq: received report #%d", data[0]);
546
547 if (urb->actual_length == 5 || data[0] == 6) { /* Touch data */
548 if (urb->actual_length == 5) { /* with touch */
549 prox = data[0] & 0x03;
550 } else { /* with capacity */
551 prox = data[1] & 0x03;
552 }
553
554 if (!stylusInProx) { /* stylus not in prox */
555 if (prox) {
556 if (touchInProx) {
557 wacom->tool[1] = BTN_TOOL_DOUBLETAP;
558 wacom->id[0] = TOUCH_DEVICE_ID;
559 if (urb->actual_length != 5) {
560 wacom_report_abs(wcombo, ABS_X, wacom_le16_to_cpu(&data[2]));
561 wacom_report_abs(wcombo, ABS_Y, wacom_le16_to_cpu(&data[4]));
562 wacom_report_abs(wcombo, ABS_PRESSURE, wacom_le16_to_cpu(&data[6]));
563 wacom_report_key(wcombo, BTN_TOUCH, wacom_le16_to_cpu(&data[6]));
564 } else {
565 wacom_report_abs(wcombo, ABS_X, wacom_le16_to_cpu(&data[1]));
566 wacom_report_abs(wcombo, ABS_Y, wacom_le16_to_cpu(&data[3]));
567 wacom_report_key(wcombo, BTN_TOUCH, 1);
568 }
569 wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]);
570 wacom_report_key(wcombo, wacom->tool[1], prox & 0x01);
571 touchOut = 1;
572 return 1;
573 }
574 } else {
575 wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]);
576 wacom_report_key(wcombo, wacom->tool[1], prox & 0x01);
577 wacom_report_key(wcombo, BTN_TOUCH, 0);
578 touchOut = 0;
579 touchInProx = 1;
580 return 1;
581 }
582 } else if (touchOut || !prox) { /* force touch out-prox */
583 wacom_report_abs(wcombo, ABS_MISC, TOUCH_DEVICE_ID);
584 wacom_report_key(wcombo, BTN_TOUCH, 0);
585 touchOut = 0;
586 touchInProx = 1;
587 return 1;
588 }
589 } else if (data[0] == 2) { /* Penabled */
590 prox = data[1] & 0x20;
591
592 touchInProx = 0;
593
594 wacom->id[0] = ERASER_DEVICE_ID;
595
596 /*
597 * if going from out of proximity into proximity select between the eraser
598 * and the pen based on the state of the stylus2 button, choose eraser if
599 * pressed else choose pen. if not a proximity change from out to in, send
600 * an out of proximity for previous tool then a in for new tool.
601 */
602 if (prox) { /* in prox */
603 if (!wacom->tool[0]) {
604 /* Going into proximity select tool */
605 wacom->tool[1] = (data[1] & 0x08) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN;
606 if (wacom->tool[1] == BTN_TOOL_PEN)
607 wacom->id[0] = STYLUS_DEVICE_ID;
608 } else if (wacom->tool[1] == BTN_TOOL_RUBBER && !(data[1] & 0x08)) {
609 /*
610 * was entered with stylus2 pressed
611 * report out proximity for previous tool
612 */
613 wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]);
614 wacom_report_key(wcombo, wacom->tool[1], 0);
615 wacom_input_sync(wcombo);
616
617 /* set new tool */
618 wacom->tool[1] = BTN_TOOL_PEN;
619 wacom->id[0] = STYLUS_DEVICE_ID;
620 return 0;
621 }
622 if (wacom->tool[1] != BTN_TOOL_RUBBER) {
623 /* Unknown tool selected default to pen tool */
624 wacom->tool[1] = BTN_TOOL_PEN;
625 wacom->id[0] = STYLUS_DEVICE_ID;
626 }
627 wacom_report_key(wcombo, BTN_STYLUS, data[1] & 0x02);
628 wacom_report_key(wcombo, BTN_STYLUS2, data[1] & 0x10);
629 wacom_report_abs(wcombo, ABS_X, wacom_le16_to_cpu(&data[2]));
630 wacom_report_abs(wcombo, ABS_Y, wacom_le16_to_cpu(&data[4]));
631 pressure = ((data[7] & 0x01) << 8) | data[6];
632 if (pressure < 0)
633 pressure = wacom->features->pressure_max + pressure + 1;
634 wacom_report_abs(wcombo, ABS_PRESSURE, pressure);
635 wacom_report_key(wcombo, BTN_TOUCH, pressure);
636 } else {
637 wacom_report_abs(wcombo, ABS_PRESSURE, 0);
638 wacom_report_key(wcombo, BTN_STYLUS, 0);
639 wacom_report_key(wcombo, BTN_STYLUS2, 0);
640 wacom_report_key(wcombo, BTN_TOUCH, 0);
641 }
642 wacom_report_key(wcombo, wacom->tool[1], prox);
643 wacom_report_abs(wcombo, ABS_MISC, wacom->id[0]);
644 stylusInProx = prox;
645 wacom->tool[0] = prox;
646 return 1;
647 }
648 return 0;
649}
650
538int wacom_wac_irq(struct wacom_wac *wacom_wac, void *wcombo) 651int wacom_wac_irq(struct wacom_wac *wacom_wac, void *wcombo)
539{ 652{
540 switch (wacom_wac->features->type) { 653 switch (wacom_wac->features->type) {
541 case PENPARTNER: 654 case PENPARTNER:
542 return (wacom_penpartner_irq(wacom_wac, wcombo)); 655 return wacom_penpartner_irq(wacom_wac, wcombo);
543 break; 656
544 case PL: 657 case PL:
545 return (wacom_pl_irq(wacom_wac, wcombo)); 658 return wacom_pl_irq(wacom_wac, wcombo);
546 break; 659
547 case WACOM_G4: 660 case WACOM_G4:
548 case GRAPHIRE: 661 case GRAPHIRE:
549 case WACOM_MO: 662 case WACOM_MO:
550 return (wacom_graphire_irq(wacom_wac, wcombo)); 663 return wacom_graphire_irq(wacom_wac, wcombo);
551 break; 664
552 case PTU: 665 case PTU:
553 return (wacom_ptu_irq(wacom_wac, wcombo)); 666 return wacom_ptu_irq(wacom_wac, wcombo);
554 break; 667
555 case INTUOS: 668 case INTUOS:
556 case INTUOS3S: 669 case INTUOS3S:
557 case INTUOS3: 670 case INTUOS3:
558 case INTUOS3L: 671 case INTUOS3L:
559 case CINTIQ: 672 case CINTIQ:
560 case WACOM_BEE: 673 case WACOM_BEE:
561 return (wacom_intuos_irq(wacom_wac, wcombo)); 674 return wacom_intuos_irq(wacom_wac, wcombo);
562 break; 675
676 case TABLETPC:
677 return wacom_tpc_irq(wacom_wac, wcombo);
678
563 default: 679 default:
564 return 0; 680 return 0;
565 } 681 }
@@ -586,13 +702,15 @@ void wacom_init_input_dev(struct input_dev *input_dev, struct wacom_wac *wacom_w
586 /* fall through */ 702 /* fall through */
587 case INTUOS3S: 703 case INTUOS3S:
588 input_dev_i3s(input_dev, wacom_wac); 704 input_dev_i3s(input_dev, wacom_wac);
705 /* fall through */
589 case INTUOS: 706 case INTUOS:
590 input_dev_i(input_dev, wacom_wac); 707 input_dev_i(input_dev, wacom_wac);
591 break; 708 break;
592 case PL: 709 case PL:
593 case PTU: 710 case PTU:
711 case TABLETPC:
594 input_dev_pl(input_dev, wacom_wac); 712 input_dev_pl(input_dev, wacom_wac);
595 break; 713 /* fall through */
596 case PENPARTNER: 714 case PENPARTNER:
597 input_dev_pt(input_dev, wacom_wac); 715 input_dev_pt(input_dev, wacom_wac);
598 break; 716 break;
@@ -611,6 +729,7 @@ static struct wacom_features wacom_features[] = {
611 { "Wacom Graphire4 6x8", 8, 16704, 12064, 511, 63, WACOM_G4 }, 729 { "Wacom Graphire4 6x8", 8, 16704, 12064, 511, 63, WACOM_G4 },
612 { "Wacom BambooFun 4x5", 9, 14760, 9225, 511, 63, WACOM_MO }, 730 { "Wacom BambooFun 4x5", 9, 14760, 9225, 511, 63, WACOM_MO },
613 { "Wacom BambooFun 6x8", 9, 21648, 13530, 511, 63, WACOM_MO }, 731 { "Wacom BambooFun 6x8", 9, 21648, 13530, 511, 63, WACOM_MO },
732 { "Wacom Bamboo1 Medium",8, 16704, 12064, 511, 63, GRAPHIRE },
614 { "Wacom Volito", 8, 5104, 3712, 511, 63, GRAPHIRE }, 733 { "Wacom Volito", 8, 5104, 3712, 511, 63, GRAPHIRE },
615 { "Wacom PenStation2", 8, 3250, 2320, 255, 63, GRAPHIRE }, 734 { "Wacom PenStation2", 8, 3250, 2320, 255, 63, GRAPHIRE },
616 { "Wacom Volito2 4x5", 8, 5104, 3712, 511, 63, GRAPHIRE }, 735 { "Wacom Volito2 4x5", 8, 5104, 3712, 511, 63, GRAPHIRE },
@@ -650,6 +769,10 @@ static struct wacom_features wacom_features[] = {
650 { "Wacom Cintiq 21UX", 10, 87200, 65600, 1023, 63, CINTIQ }, 769 { "Wacom Cintiq 21UX", 10, 87200, 65600, 1023, 63, CINTIQ },
651 { "Wacom Cintiq 20WSX", 10, 86680, 54180, 1023, 63, WACOM_BEE }, 770 { "Wacom Cintiq 20WSX", 10, 86680, 54180, 1023, 63, WACOM_BEE },
652 { "Wacom Cintiq 12WX", 10, 53020, 33440, 1023, 63, WACOM_BEE }, 771 { "Wacom Cintiq 12WX", 10, 53020, 33440, 1023, 63, WACOM_BEE },
772 { "Wacom DTU1931", 8, 37832, 30305, 511, 0, PL },
773 { "Wacom ISDv4 90", 8, 26202, 16325, 255, 0, TABLETPC },
774 { "Wacom ISDv4 93", 8, 26202, 16325, 255, 0, TABLETPC },
775 { "Wacom ISDv4 9A", 8, 26202, 16325, 255, 0, TABLETPC },
653 { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 31, INTUOS }, 776 { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 31, INTUOS },
654 { } 777 { }
655}; 778};
@@ -665,6 +788,7 @@ static struct usb_device_id wacom_ids[] = {
665 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x16) }, 788 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x16) },
666 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x17) }, 789 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x17) },
667 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x18) }, 790 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x18) },
791 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x19) },
668 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x60) }, 792 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x60) },
669 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x61) }, 793 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x61) },
670 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x62) }, 794 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x62) },
@@ -704,18 +828,26 @@ static struct usb_device_id wacom_ids[] = {
704 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x3F) }, 828 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x3F) },
705 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC5) }, 829 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC5) },
706 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC6) }, 830 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC6) },
831 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC7) },
832 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x90) },
833 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x93) },
834 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x9A) },
707 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x47) }, 835 { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x47) },
708 { } 836 { }
709}; 837};
710 838
711const struct usb_device_id * get_device_table(void) { 839const struct usb_device_id *get_device_table(void)
712 const struct usb_device_id * id_table = wacom_ids; 840{
841 const struct usb_device_id *id_table = wacom_ids;
842
713 return id_table; 843 return id_table;
714} 844}
715 845
716struct wacom_features * get_wacom_feature(const struct usb_device_id * id) { 846struct wacom_features * get_wacom_feature(const struct usb_device_id *id)
847{
717 int index = id - wacom_ids; 848 int index = id - wacom_ids;
718 struct wacom_features *wf = &wacom_features[index]; 849 struct wacom_features *wf = &wacom_features[index];
850
719 return wf; 851 return wf;
720} 852}
721 853