aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/tablet/wacom_wac.c84
-rw-r--r--drivers/input/tablet/wacom_wac.h5
2 files changed, 10 insertions, 79 deletions
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 367fa82a607e..5488c6172621 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -675,40 +675,6 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
675 return 1; 675 return 1;
676} 676}
677 677
678
679static void wacom_tpc_finger_in(struct wacom_wac *wacom, char *data, int idx)
680{
681 struct input_dev *input = wacom->input;
682 int finger = idx + 1;
683 int x = le16_to_cpup((__le16 *)&data[finger * 2]) & 0x7fff;
684 int y = le16_to_cpup((__le16 *)&data[4 + finger * 2]) & 0x7fff;
685
686 /*
687 * Work around input core suppressing "duplicate" events since
688 * we are abusing ABS_X/ABS_Y to transmit multi-finger data.
689 * This should go away once we switch to true multitouch
690 * protocol.
691 */
692 if (wacom->last_finger != finger) {
693 if (x == input_abs_get_val(input, ABS_X))
694 x++;
695
696 if (y == input_abs_get_val(input, ABS_Y))
697 y++;
698 }
699
700 input_report_abs(input, ABS_X, x);
701 input_report_abs(input, ABS_Y, y);
702 input_report_abs(input, ABS_MISC, wacom->id[0]);
703 input_report_key(input, wacom->tool[finger], 1);
704 if (!idx)
705 input_report_key(input, BTN_TOUCH, 1);
706 input_event(input, EV_MSC, MSC_SERIAL, finger);
707 input_sync(input);
708
709 wacom->last_finger = finger;
710}
711
712static void wacom_tpc_touch_out(struct wacom_wac *wacom, int idx) 678static void wacom_tpc_touch_out(struct wacom_wac *wacom, int idx)
713{ 679{
714 struct input_dev *input = wacom->input; 680 struct input_dev *input = wacom->input;
@@ -731,7 +697,6 @@ static void wacom_tpc_touch_in(struct wacom_wac *wacom, size_t len)
731 697
732 wacom->tool[1] = BTN_TOOL_DOUBLETAP; 698 wacom->tool[1] = BTN_TOOL_DOUBLETAP;
733 wacom->id[0] = TOUCH_DEVICE_ID; 699 wacom->id[0] = TOUCH_DEVICE_ID;
734 wacom->tool[2] = BTN_TOOL_TRIPLETAP;
735 700
736 if (len != WACOM_PKGLEN_TPC1FG) { 701 if (len != WACOM_PKGLEN_TPC1FG) {
737 702
@@ -746,18 +711,6 @@ static void wacom_tpc_touch_in(struct wacom_wac *wacom, size_t len)
746 input_report_key(input, wacom->tool[1], 1); 711 input_report_key(input, wacom->tool[1], 1);
747 input_sync(input); 712 input_sync(input);
748 break; 713 break;
749
750 case WACOM_REPORT_TPC2FG:
751 if (data[1] & 0x01)
752 wacom_tpc_finger_in(wacom, data, 0);
753 else if (wacom->id[1] & 0x01)
754 wacom_tpc_touch_out(wacom, 0);
755
756 if (data[1] & 0x02)
757 wacom_tpc_finger_in(wacom, data, 1);
758 else if (wacom->id[1] & 0x02)
759 wacom_tpc_touch_out(wacom, 1);
760 break;
761 } 714 }
762 } else { 715 } else {
763 input_report_abs(input, ABS_X, get_unaligned_le16(&data[1])); 716 input_report_abs(input, ABS_X, get_unaligned_le16(&data[1]));
@@ -779,47 +732,26 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len)
779 732
780 dbg("wacom_tpc_irq: received report #%d", data[0]); 733 dbg("wacom_tpc_irq: received report #%d", data[0]);
781 734
782 if (len == WACOM_PKGLEN_TPC1FG || /* single touch */ 735 if (len == WACOM_PKGLEN_TPC1FG ||
783 data[0] == WACOM_REPORT_TPC1FG || /* single touch */ 736 data[0] == WACOM_REPORT_TPC1FG) { /* single touch */
784 data[0] == WACOM_REPORT_TPC2FG) { /* 2FG touch */
785 737
786 if (wacom->shared->stylus_in_proximity) { 738 if (wacom->shared->stylus_in_proximity) {
787 if (wacom->id[1] & 0x01) 739 if (wacom->id[1] & 0x01)
788 wacom_tpc_touch_out(wacom, 0); 740 wacom_tpc_touch_out(wacom, 0);
789 741
790 if (wacom->id[1] & 0x02)
791 wacom_tpc_touch_out(wacom, 1);
792
793 wacom->id[1] = 0; 742 wacom->id[1] = 0;
794 return 0; 743 return 0;
795 } 744 }
796 745
797 if (len == WACOM_PKGLEN_TPC1FG) { /* with touch */ 746 if (len == WACOM_PKGLEN_TPC1FG)
798 prox = data[0] & 0x01; 747 prox = data[0] & 0x01;
799 } else { /* with capacity */ 748 else /* with capacity */
800 if (data[0] == WACOM_REPORT_TPC1FG) 749 prox = data[1] & 0x01;
801 /* single touch */
802 prox = data[1] & 0x01;
803 else
804 /* 2FG touch data */
805 prox = data[1] & 0x03;
806 }
807 750
808 if (prox) { 751 if (prox)
809 if (!wacom->id[1])
810 wacom->last_finger = 1;
811 wacom_tpc_touch_in(wacom, len); 752 wacom_tpc_touch_in(wacom, len);
812 } else { 753 else {
813 if (data[0] == WACOM_REPORT_TPC2FG) { 754 wacom_tpc_touch_out(wacom, 0);
814 /* 2FGT out-prox */
815 if (wacom->id[1] & 0x01)
816 wacom_tpc_touch_out(wacom, 0);
817
818 if (wacom->id[1] & 0x02)
819 wacom_tpc_touch_out(wacom, 1);
820 } else
821 /* one finger touch */
822 wacom_tpc_touch_out(wacom, 0);
823 755
824 wacom->id[0] = 0; 756 wacom->id[0] = 0;
825 } 757 }
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
index b1310ec9720c..8f747dd1214e 100644
--- a/drivers/input/tablet/wacom_wac.h
+++ b/drivers/input/tablet/wacom_wac.h
@@ -93,10 +93,9 @@ struct wacom_shared {
93struct wacom_wac { 93struct wacom_wac {
94 char name[64]; 94 char name[64];
95 unsigned char *data; 95 unsigned char *data;
96 int tool[3]; 96 int tool[2];
97 int id[3]; 97 int id[2];
98 __u32 serial[2]; 98 __u32 serial[2];
99 int last_finger;
100 struct wacom_features features; 99 struct wacom_features features;
101 struct wacom_shared *shared; 100 struct wacom_shared *shared;
102 struct input_dev *input; 101 struct input_dev *input;