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.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index 435b0af401e4..518782999fea 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -14,6 +14,7 @@
14 14
15#include "wacom_wac.h" 15#include "wacom_wac.h"
16#include "wacom.h" 16#include "wacom.h"
17#include <linux/input/mt.h>
17 18
18static int wacom_penpartner_irq(struct wacom_wac *wacom) 19static int wacom_penpartner_irq(struct wacom_wac *wacom)
19{ 20{
@@ -862,19 +863,21 @@ static int wacom_bpt_touch(struct wacom_wac *wacom)
862 struct wacom_features *features = &wacom->features; 863 struct wacom_features *features = &wacom->features;
863 struct input_dev *input = wacom->input; 864 struct input_dev *input = wacom->input;
864 unsigned char *data = wacom->data; 865 unsigned char *data = wacom->data;
865 int sp = 0, sx = 0, sy = 0, count = 0;
866 int i; 866 int i;
867 867
868 for (i = 0; i < 2; i++) { 868 for (i = 0; i < 2; i++) {
869 int p = data[9 * i + 2]; 869 int p = data[9 * i + 2];
870 bool touch = p && !wacom->shared->stylus_in_proximity;
871
870 input_mt_slot(input, i); 872 input_mt_slot(input, i);
873 input_mt_report_slot_state(input, MT_TOOL_FINGER, touch);
871 /* 874 /*
872 * Touch events need to be disabled while stylus is 875 * Touch events need to be disabled while stylus is
873 * in proximity because user's hand is resting on touchpad 876 * in proximity because user's hand is resting on touchpad
874 * and sending unwanted events. User expects tablet buttons 877 * and sending unwanted events. User expects tablet buttons
875 * to continue working though. 878 * to continue working though.
876 */ 879 */
877 if (p && !wacom->shared->stylus_in_proximity) { 880 if (touch) {
878 int x = get_unaligned_be16(&data[9 * i + 3]) & 0x7ff; 881 int x = get_unaligned_be16(&data[9 * i + 3]) & 0x7ff;
879 int y = get_unaligned_be16(&data[9 * i + 5]) & 0x7ff; 882 int y = get_unaligned_be16(&data[9 * i + 5]) & 0x7ff;
880 if (features->quirks & WACOM_QUIRK_BBTOUCH_LOWRES) { 883 if (features->quirks & WACOM_QUIRK_BBTOUCH_LOWRES) {
@@ -884,23 +887,10 @@ static int wacom_bpt_touch(struct wacom_wac *wacom)
884 input_report_abs(input, ABS_MT_PRESSURE, p); 887 input_report_abs(input, ABS_MT_PRESSURE, p);
885 input_report_abs(input, ABS_MT_POSITION_X, x); 888 input_report_abs(input, ABS_MT_POSITION_X, x);
886 input_report_abs(input, ABS_MT_POSITION_Y, y); 889 input_report_abs(input, ABS_MT_POSITION_Y, y);
887 if (wacom->id[i] < 0)
888 wacom->id[i] = wacom->trk_id++ & MAX_TRACKING_ID;
889 if (!count++)
890 sp = p, sx = x, sy = y;
891 } else {
892 wacom->id[i] = -1;
893 } 890 }
894 input_report_abs(input, ABS_MT_TRACKING_ID, wacom->id[i]);
895 } 891 }
896 892
897 input_report_key(input, BTN_TOUCH, count > 0); 893 input_mt_report_pointer_emulation(input, true);
898 input_report_key(input, BTN_TOOL_FINGER, count == 1);
899 input_report_key(input, BTN_TOOL_DOUBLETAP, count == 2);
900
901 input_report_abs(input, ABS_PRESSURE, sp);
902 input_report_abs(input, ABS_X, sx);
903 input_report_abs(input, ABS_Y, sy);
904 894
905 input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0); 895 input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
906 input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0); 896 input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0);
@@ -1272,7 +1262,7 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
1272 __set_bit(BTN_TOOL_FINGER, input_dev->keybit); 1262 __set_bit(BTN_TOOL_FINGER, input_dev->keybit);
1273 __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); 1263 __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit);
1274 1264
1275 input_mt_create_slots(input_dev, 2); 1265 input_mt_init_slots(input_dev, 2);
1276 input_set_abs_params(input_dev, ABS_MT_POSITION_X, 1266 input_set_abs_params(input_dev, ABS_MT_POSITION_X,
1277 0, features->x_max, 1267 0, features->x_max,
1278 features->x_fuzz, 0); 1268 features->x_fuzz, 0);
@@ -1282,8 +1272,6 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
1282 input_set_abs_params(input_dev, ABS_MT_PRESSURE, 1272 input_set_abs_params(input_dev, ABS_MT_PRESSURE,
1283 0, features->pressure_max, 1273 0, features->pressure_max,
1284 features->pressure_fuzz, 0); 1274 features->pressure_fuzz, 0);
1285 input_set_abs_params(input_dev, ABS_MT_TRACKING_ID, 0,
1286 MAX_TRACKING_ID, 0, 0);
1287 } else if (features->device_type == BTN_TOOL_PEN) { 1275 } else if (features->device_type == BTN_TOOL_PEN) {
1288 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); 1276 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
1289 __set_bit(BTN_TOOL_PEN, input_dev->keybit); 1277 __set_bit(BTN_TOOL_PEN, input_dev->keybit);
@@ -1444,11 +1432,17 @@ static struct wacom_features wacom_features_0xDA =
1444 { "Wacom Bamboo 2FG 4x5 SE", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT }; 1432 { "Wacom Bamboo 2FG 4x5 SE", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT };
1445static struct wacom_features wacom_features_0xDB = 1433static struct wacom_features wacom_features_0xDB =
1446 { "Wacom Bamboo 2FG 6x8 SE", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT }; 1434 { "Wacom Bamboo 2FG 6x8 SE", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT };
1435static const struct wacom_features wacom_features_0x6004 =
1436 { "ISD-V4", WACOM_PKGLEN_GRAPHIRE, 12800, 8000, 255, 0, TABLETPC };
1447 1437
1448#define USB_DEVICE_WACOM(prod) \ 1438#define USB_DEVICE_WACOM(prod) \
1449 USB_DEVICE(USB_VENDOR_ID_WACOM, prod), \ 1439 USB_DEVICE(USB_VENDOR_ID_WACOM, prod), \
1450 .driver_info = (kernel_ulong_t)&wacom_features_##prod 1440 .driver_info = (kernel_ulong_t)&wacom_features_##prod
1451 1441
1442#define USB_DEVICE_LENOVO(prod) \
1443 USB_DEVICE(USB_VENDOR_ID_LENOVO, prod), \
1444 .driver_info = (kernel_ulong_t)&wacom_features_##prod
1445
1452const struct usb_device_id wacom_ids[] = { 1446const struct usb_device_id wacom_ids[] = {
1453 { USB_DEVICE_WACOM(0x00) }, 1447 { USB_DEVICE_WACOM(0x00) },
1454 { USB_DEVICE_WACOM(0x10) }, 1448 { USB_DEVICE_WACOM(0x10) },
@@ -1525,6 +1519,7 @@ const struct usb_device_id wacom_ids[] = {
1525 { USB_DEVICE_WACOM(0xE2) }, 1519 { USB_DEVICE_WACOM(0xE2) },
1526 { USB_DEVICE_WACOM(0xE3) }, 1520 { USB_DEVICE_WACOM(0xE3) },
1527 { USB_DEVICE_WACOM(0x47) }, 1521 { USB_DEVICE_WACOM(0x47) },
1522 { USB_DEVICE_LENOVO(0x6004) },
1528 { } 1523 { }
1529}; 1524};
1530MODULE_DEVICE_TABLE(usb, wacom_ids); 1525MODULE_DEVICE_TABLE(usb, wacom_ids);