aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPing Cheng <pinglinux@gmail.com>2011-03-12 23:35:18 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2011-03-12 23:37:25 -0500
commit84eb5aa6ccb2a62c40722b8c5fb1338ea12155a3 (patch)
treef2ca5e0c39adcf594ba713a02f2742d960038767
parenta43c7c53835ba1ff4e488806d0f8b98e9dce9b0e (diff)
Input: wacom - support 2FGT in MT format
Reviewed-by: Henrik Rydberg <rydberg@euromail.se> Reviewed-by: Chris Bagwell <chris@cnpbagwell.com> Signed-off-by: Ping Cheng <pingc@wacom.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
-rw-r--r--drivers/input/tablet/wacom_sys.c12
-rw-r--r--drivers/input/tablet/wacom_wac.c59
2 files changed, 53 insertions, 18 deletions
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index fc381498b798..b97665f9765e 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -193,16 +193,16 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi
193 case HID_USAGE_X: 193 case HID_USAGE_X:
194 if (usage == WCM_DESKTOP) { 194 if (usage == WCM_DESKTOP) {
195 if (finger) { 195 if (finger) {
196 features->device_type = BTN_TOOL_DOUBLETAP; 196 features->device_type = BTN_TOOL_FINGER;
197 if (features->type == TABLETPC2FG) { 197 if (features->type == TABLETPC2FG) {
198 /* need to reset back */ 198 /* need to reset back */
199 features->pktlen = WACOM_PKGLEN_TPC2FG; 199 features->pktlen = WACOM_PKGLEN_TPC2FG;
200 features->device_type = BTN_TOOL_TRIPLETAP; 200 features->device_type = BTN_TOOL_DOUBLETAP;
201 } 201 }
202 if (features->type == BAMBOO_PT) { 202 if (features->type == BAMBOO_PT) {
203 /* need to reset back */ 203 /* need to reset back */
204 features->pktlen = WACOM_PKGLEN_BBTOUCH; 204 features->pktlen = WACOM_PKGLEN_BBTOUCH;
205 features->device_type = BTN_TOOL_TRIPLETAP; 205 features->device_type = BTN_TOOL_DOUBLETAP;
206 features->x_phy = 206 features->x_phy =
207 get_unaligned_le16(&report[i + 5]); 207 get_unaligned_le16(&report[i + 5]);
208 features->x_max = 208 features->x_max =
@@ -241,11 +241,11 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi
241 case HID_USAGE_Y: 241 case HID_USAGE_Y:
242 if (usage == WCM_DESKTOP) { 242 if (usage == WCM_DESKTOP) {
243 if (finger) { 243 if (finger) {
244 features->device_type = BTN_TOOL_DOUBLETAP; 244 features->device_type = BTN_TOOL_FINGER;
245 if (features->type == TABLETPC2FG) { 245 if (features->type == TABLETPC2FG) {
246 /* need to reset back */ 246 /* need to reset back */
247 features->pktlen = WACOM_PKGLEN_TPC2FG; 247 features->pktlen = WACOM_PKGLEN_TPC2FG;
248 features->device_type = BTN_TOOL_TRIPLETAP; 248 features->device_type = BTN_TOOL_DOUBLETAP;
249 features->y_max = 249 features->y_max =
250 get_unaligned_le16(&report[i + 3]); 250 get_unaligned_le16(&report[i + 3]);
251 features->y_phy = 251 features->y_phy =
@@ -254,7 +254,7 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi
254 } else if (features->type == BAMBOO_PT) { 254 } else if (features->type == BAMBOO_PT) {
255 /* need to reset back */ 255 /* need to reset back */
256 features->pktlen = WACOM_PKGLEN_BBTOUCH; 256 features->pktlen = WACOM_PKGLEN_BBTOUCH;
257 features->device_type = BTN_TOOL_TRIPLETAP; 257 features->device_type = BTN_TOOL_DOUBLETAP;
258 features->y_phy = 258 features->y_phy =
259 get_unaligned_le16(&report[i + 3]); 259 get_unaligned_le16(&report[i + 3]);
260 features->y_max = 260 features->y_max =
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index adf8946e8f0d..5597637cfd41 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -675,6 +675,37 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
675 return 1; 675 return 1;
676} 676}
677 677
678static int wacom_tpc_mt_touch(struct wacom_wac *wacom)
679{
680 struct input_dev *input = wacom->input;
681 unsigned char *data = wacom->data;
682 int contact_with_no_pen_down_count = 0;
683 int i;
684
685 for (i = 0; i < 2; i++) {
686 int p = data[1] & (1 << i);
687 bool touch = p && !wacom->shared->stylus_in_proximity;
688
689 input_mt_slot(input, i);
690 input_mt_report_slot_state(input, MT_TOOL_FINGER, touch);
691 if (touch) {
692 int x = le16_to_cpup((__le16 *)&data[i * 2 + 2]) & 0x7fff;
693 int y = le16_to_cpup((__le16 *)&data[i * 2 + 6]) & 0x7fff;
694
695 input_report_abs(input, ABS_MT_POSITION_X, x);
696 input_report_abs(input, ABS_MT_POSITION_Y, y);
697 contact_with_no_pen_down_count++;
698 }
699 }
700
701 /* keep touch state for pen event */
702 wacom->shared->touch_down = (contact_with_no_pen_down_count > 0);
703
704 input_mt_report_pointer_emulation(input, true);
705
706 return 1;
707}
708
678static int wacom_tpc_single_touch(struct wacom_wac *wacom, size_t len) 709static int wacom_tpc_single_touch(struct wacom_wac *wacom, size_t len)
679{ 710{
680 char *data = wacom->data; 711 char *data = wacom->data;
@@ -749,6 +780,8 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len)
749 780
750 if (len == WACOM_PKGLEN_TPC1FG || data[0] == WACOM_REPORT_TPC1FG) 781 if (len == WACOM_PKGLEN_TPC1FG || data[0] == WACOM_REPORT_TPC1FG)
751 return wacom_tpc_single_touch(wacom, len); 782 return wacom_tpc_single_touch(wacom, len);
783 else if (data[0] == WACOM_REPORT_TPC2FG)
784 return wacom_tpc_mt_touch(wacom);
752 else if (data[0] == WACOM_REPORT_PENABLED) 785 else if (data[0] == WACOM_REPORT_PENABLED)
753 return wacom_tpc_pen(wacom); 786 return wacom_tpc_pen(wacom);
754 787
@@ -975,7 +1008,7 @@ void wacom_setup_device_quirks(struct wacom_features *features)
975{ 1008{
976 1009
977 /* touch device found but size is not defined. use default */ 1010 /* touch device found but size is not defined. use default */
978 if (features->device_type == BTN_TOOL_DOUBLETAP && !features->x_max) { 1011 if (features->device_type == BTN_TOOL_FINGER && !features->x_max) {
979 features->x_max = 1023; 1012 features->x_max = 1023;
980 features->y_max = 1023; 1013 features->y_max = 1023;
981 } 1014 }
@@ -987,7 +1020,7 @@ void wacom_setup_device_quirks(struct wacom_features *features)
987 1020
988 /* quirks for bamboo touch */ 1021 /* quirks for bamboo touch */
989 if (features->type == BAMBOO_PT && 1022 if (features->type == BAMBOO_PT &&
990 features->device_type == BTN_TOOL_TRIPLETAP) { 1023 features->device_type == BTN_TOOL_DOUBLETAP) {
991 features->x_max <<= 5; 1024 features->x_max <<= 5;
992 features->y_max <<= 5; 1025 features->y_max <<= 5;
993 features->x_fuzz <<= 5; 1026 features->x_fuzz <<= 5;
@@ -1123,28 +1156,30 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
1123 break; 1156 break;
1124 1157
1125 case TABLETPC2FG: 1158 case TABLETPC2FG:
1126 if (features->device_type == BTN_TOOL_TRIPLETAP) { 1159 if (features->device_type == BTN_TOOL_DOUBLETAP) {
1127 __set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit); 1160
1128 input_set_capability(input_dev, EV_MSC, MSC_SERIAL); 1161 input_mt_init_slots(input_dev, 2);
1162 input_set_abs_params(input_dev, ABS_MT_TOOL_TYPE,
1163 0, MT_TOOL_MAX, 0, 0);
1164 input_set_abs_params(input_dev, ABS_MT_POSITION_X,
1165 0, features->x_max, 0, 0);
1166 input_set_abs_params(input_dev, ABS_MT_POSITION_Y,
1167 0, features->y_max, 0, 0);
1129 } 1168 }
1130 /* fall through */ 1169 /* fall through */
1131 1170
1132 case TABLETPC: 1171 case TABLETPC:
1133 __clear_bit(ABS_MISC, input_dev->absbit); 1172 __clear_bit(ABS_MISC, input_dev->absbit);
1134 1173
1135 if (features->device_type == BTN_TOOL_DOUBLETAP || 1174 if (features->device_type != BTN_TOOL_PEN) {
1136 features->device_type == BTN_TOOL_TRIPLETAP) {
1137 input_abs_set_res(input_dev, ABS_X, 1175 input_abs_set_res(input_dev, ABS_X,
1138 wacom_calculate_touch_res(features->x_max, 1176 wacom_calculate_touch_res(features->x_max,
1139 features->x_phy)); 1177 features->x_phy));
1140 input_abs_set_res(input_dev, ABS_Y, 1178 input_abs_set_res(input_dev, ABS_Y,
1141 wacom_calculate_touch_res(features->y_max, 1179 wacom_calculate_touch_res(features->y_max,
1142 features->y_phy)); 1180 features->y_phy));
1143 }
1144
1145 if (features->device_type != BTN_TOOL_PEN)
1146 break; /* no need to process stylus stuff */ 1181 break; /* no need to process stylus stuff */
1147 1182 }
1148 /* fall through */ 1183 /* fall through */
1149 1184
1150 case PL: 1185 case PL:
@@ -1162,7 +1197,7 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
1162 case BAMBOO_PT: 1197 case BAMBOO_PT:
1163 __clear_bit(ABS_MISC, input_dev->absbit); 1198 __clear_bit(ABS_MISC, input_dev->absbit);
1164 1199
1165 if (features->device_type == BTN_TOOL_TRIPLETAP) { 1200 if (features->device_type == BTN_TOOL_DOUBLETAP) {
1166 __set_bit(BTN_LEFT, input_dev->keybit); 1201 __set_bit(BTN_LEFT, input_dev->keybit);
1167 __set_bit(BTN_FORWARD, input_dev->keybit); 1202 __set_bit(BTN_FORWARD, input_dev->keybit);
1168 __set_bit(BTN_BACK, input_dev->keybit); 1203 __set_bit(BTN_BACK, input_dev->keybit);