aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/tablet/wacom_wac.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/tablet/wacom_wac.c')
-rw-r--r--drivers/input/tablet/wacom_wac.c94
1 files changed, 90 insertions, 4 deletions
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index d1ced325939d..164bb55064de 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -836,6 +836,64 @@ static int wacom_bpt_touch(struct wacom_wac *wacom)
836 return 0; 836 return 0;
837} 837}
838 838
839static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data)
840{
841 struct input_dev *input = wacom->input;
842 int slot_id = data[0] - 2; /* data[0] is between 2 and 17 */
843 bool touch = data[1] & 0x80;
844
845 touch = touch && !wacom->shared->stylus_in_proximity;
846
847 input_mt_slot(input, slot_id);
848 input_mt_report_slot_state(input, MT_TOOL_FINGER, touch);
849
850 if (touch) {
851 int x = (data[2] << 4) | (data[4] >> 4);
852 int y = (data[3] << 4) | (data[4] & 0x0f);
853 int w = data[6];
854
855 input_report_abs(input, ABS_MT_POSITION_X, x);
856 input_report_abs(input, ABS_MT_POSITION_Y, y);
857 input_report_abs(input, ABS_MT_TOUCH_MAJOR, w);
858 }
859}
860
861static void wacom_bpt3_button_msg(struct wacom_wac *wacom, unsigned char *data)
862{
863 struct input_dev *input = wacom->input;
864
865 input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
866 input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0);
867 input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0);
868 input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0);
869}
870
871static int wacom_bpt3_touch(struct wacom_wac *wacom)
872{
873 struct input_dev *input = wacom->input;
874 unsigned char *data = wacom->data;
875 int count = data[1] & 0x03;
876 int i;
877
878 /* data has up to 7 fixed sized 8-byte messages starting at data[2] */
879 for (i = 0; i < count; i++) {
880 int offset = (8 * i) + 2;
881 int msg_id = data[offset];
882
883 if (msg_id >= 2 && msg_id <= 17)
884 wacom_bpt3_touch_msg(wacom, data + offset);
885 else if (msg_id == 128)
886 wacom_bpt3_button_msg(wacom, data + offset);
887
888 }
889
890 input_mt_report_pointer_emulation(input, true);
891
892 input_sync(input);
893
894 return 0;
895}
896
839static int wacom_bpt_pen(struct wacom_wac *wacom) 897static int wacom_bpt_pen(struct wacom_wac *wacom)
840{ 898{
841 struct input_dev *input = wacom->input; 899 struct input_dev *input = wacom->input;
@@ -906,7 +964,9 @@ static int wacom_bpt_irq(struct wacom_wac *wacom, size_t len)
906{ 964{
907 if (len == WACOM_PKGLEN_BBTOUCH) 965 if (len == WACOM_PKGLEN_BBTOUCH)
908 return wacom_bpt_touch(wacom); 966 return wacom_bpt_touch(wacom);
909 else if (len == WACOM_PKGLEN_BBFUN) 967 else if (len == WACOM_PKGLEN_BBTOUCH3)
968 return wacom_bpt3_touch(wacom);
969 else if (len == WACOM_PKGLEN_BBFUN || len == WACOM_PKGLEN_BBPEN)
910 return wacom_bpt_pen(wacom); 970 return wacom_bpt_pen(wacom);
911 971
912 return 0; 972 return 0;
@@ -1025,9 +1085,9 @@ void wacom_setup_device_quirks(struct wacom_features *features)
1025 features->type == BAMBOO_PT) 1085 features->type == BAMBOO_PT)
1026 features->quirks |= WACOM_QUIRK_MULTI_INPUT; 1086 features->quirks |= WACOM_QUIRK_MULTI_INPUT;
1027 1087
1028 /* quirks for bamboo touch */ 1088 /* quirk for bamboo touch with 2 low res touches */
1029 if (features->type == BAMBOO_PT && 1089 if (features->type == BAMBOO_PT &&
1030 features->device_type == BTN_TOOL_DOUBLETAP) { 1090 features->pktlen == WACOM_PKGLEN_BBTOUCH) {
1031 features->x_max <<= 5; 1091 features->x_max <<= 5;
1032 features->y_max <<= 5; 1092 features->y_max <<= 5;
1033 features->x_fuzz <<= 5; 1093 features->x_fuzz <<= 5;
@@ -1213,7 +1273,21 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
1213 __set_bit(BTN_TOOL_FINGER, input_dev->keybit); 1273 __set_bit(BTN_TOOL_FINGER, input_dev->keybit);
1214 __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); 1274 __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit);
1215 1275
1216 input_mt_init_slots(input_dev, 2); 1276 if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) {
1277 __set_bit(BTN_TOOL_TRIPLETAP,
1278 input_dev->keybit);
1279 __set_bit(BTN_TOOL_QUADTAP,
1280 input_dev->keybit);
1281
1282 input_mt_init_slots(input_dev, 16);
1283
1284 input_set_abs_params(input_dev,
1285 ABS_MT_TOUCH_MAJOR,
1286 0, 255, 0, 0);
1287 } else {
1288 input_mt_init_slots(input_dev, 2);
1289 }
1290
1217 input_set_abs_params(input_dev, ABS_MT_POSITION_X, 1291 input_set_abs_params(input_dev, ABS_MT_POSITION_X,
1218 0, features->x_max, 1292 0, features->x_max,
1219 features->x_fuzz, 0); 1293 features->x_fuzz, 0);
@@ -1479,6 +1553,15 @@ static const struct wacom_features wacom_features_0xDA =
1479static struct wacom_features wacom_features_0xDB = 1553static struct wacom_features wacom_features_0xDB =
1480 { "Wacom Bamboo 2FG 6x8 SE", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023, 1554 { "Wacom Bamboo 2FG 6x8 SE", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023,
1481 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1555 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1556static const struct wacom_features wacom_features_0xDD =
1557 { "Wacom Bamboo Connect", WACOM_PKGLEN_BBPEN, 14720, 9200, 1023,
1558 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1559static const struct wacom_features wacom_features_0xDE =
1560 { "Wacom Bamboo 16FG 4x5", WACOM_PKGLEN_BBPEN, 14720, 9200, 1023,
1561 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1562static const struct wacom_features wacom_features_0xDF =
1563 { "Wacom Bamboo 16FG 6x8", WACOM_PKGLEN_BBPEN, 21648, 13700, 1023,
1564 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
1482static const struct wacom_features wacom_features_0x6004 = 1565static const struct wacom_features wacom_features_0x6004 =
1483 { "ISD-V4", WACOM_PKGLEN_GRAPHIRE, 12800, 8000, 255, 1566 { "ISD-V4", WACOM_PKGLEN_GRAPHIRE, 12800, 8000, 255,
1484 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 1567 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
@@ -1574,6 +1657,9 @@ const struct usb_device_id wacom_ids[] = {
1574 { USB_DEVICE_WACOM(0xD8) }, 1657 { USB_DEVICE_WACOM(0xD8) },
1575 { USB_DEVICE_WACOM(0xDA) }, 1658 { USB_DEVICE_WACOM(0xDA) },
1576 { USB_DEVICE_WACOM(0xDB) }, 1659 { USB_DEVICE_WACOM(0xDB) },
1660 { USB_DEVICE_WACOM(0xDD) },
1661 { USB_DEVICE_WACOM(0xDE) },
1662 { USB_DEVICE_WACOM(0xDF) },
1577 { USB_DEVICE_WACOM(0xF0) }, 1663 { USB_DEVICE_WACOM(0xF0) },
1578 { USB_DEVICE_WACOM(0xCC) }, 1664 { USB_DEVICE_WACOM(0xCC) },
1579 { USB_DEVICE_WACOM(0x90) }, 1665 { USB_DEVICE_WACOM(0x90) },