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.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index f26e2238f6ca..0b0525486711 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -863,19 +863,21 @@ static int wacom_bpt_touch(struct wacom_wac *wacom)
863 struct wacom_features *features = &wacom->features; 863 struct wacom_features *features = &wacom->features;
864 struct input_dev *input = wacom->input; 864 struct input_dev *input = wacom->input;
865 unsigned char *data = wacom->data; 865 unsigned char *data = wacom->data;
866 int sp = 0, sx = 0, sy = 0, count = 0;
867 int i; 866 int i;
868 867
869 for (i = 0; i < 2; i++) { 868 for (i = 0; i < 2; i++) {
870 int p = data[9 * i + 2]; 869 int p = data[9 * i + 2];
870 bool touch = p && !wacom->shared->stylus_in_proximity;
871
871 input_mt_slot(input, i); 872 input_mt_slot(input, i);
873 input_mt_report_slot_state(input, MT_TOOL_FINGER, touch);
872 /* 874 /*
873 * Touch events need to be disabled while stylus is 875 * Touch events need to be disabled while stylus is
874 * in proximity because user's hand is resting on touchpad 876 * in proximity because user's hand is resting on touchpad
875 * and sending unwanted events. User expects tablet buttons 877 * and sending unwanted events. User expects tablet buttons
876 * to continue working though. 878 * to continue working though.
877 */ 879 */
878 if (p && !wacom->shared->stylus_in_proximity) { 880 if (touch) {
879 int x = get_unaligned_be16(&data[9 * i + 3]) & 0x7ff; 881 int x = get_unaligned_be16(&data[9 * i + 3]) & 0x7ff;
880 int y = get_unaligned_be16(&data[9 * i + 5]) & 0x7ff; 882 int y = get_unaligned_be16(&data[9 * i + 5]) & 0x7ff;
881 if (features->quirks & WACOM_QUIRK_BBTOUCH_LOWRES) { 883 if (features->quirks & WACOM_QUIRK_BBTOUCH_LOWRES) {
@@ -885,23 +887,10 @@ static int wacom_bpt_touch(struct wacom_wac *wacom)
885 input_report_abs(input, ABS_MT_PRESSURE, p); 887 input_report_abs(input, ABS_MT_PRESSURE, p);
886 input_report_abs(input, ABS_MT_POSITION_X, x); 888 input_report_abs(input, ABS_MT_POSITION_X, x);
887 input_report_abs(input, ABS_MT_POSITION_Y, y); 889 input_report_abs(input, ABS_MT_POSITION_Y, y);
888 if (wacom->id[i] < 0)
889 wacom->id[i] = wacom->trk_id++ & MAX_TRACKING_ID;
890 if (!count++)
891 sp = p, sx = x, sy = y;
892 } else {
893 wacom->id[i] = -1;
894 } 890 }
895 input_report_abs(input, ABS_MT_TRACKING_ID, wacom->id[i]);
896 } 891 }
897 892
898 input_report_key(input, BTN_TOUCH, count > 0); 893 input_mt_report_pointer_emulation(input, true);
899 input_report_key(input, BTN_TOOL_FINGER, count == 1);
900 input_report_key(input, BTN_TOOL_DOUBLETAP, count == 2);
901
902 input_report_abs(input, ABS_PRESSURE, sp);
903 input_report_abs(input, ABS_X, sx);
904 input_report_abs(input, ABS_Y, sy);
905 894
906 input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0); 895 input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0);
907 input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0); 896 input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0);
@@ -1283,8 +1272,6 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev,
1283 input_set_abs_params(input_dev, ABS_MT_PRESSURE, 1272 input_set_abs_params(input_dev, ABS_MT_PRESSURE,
1284 0, features->pressure_max, 1273 0, features->pressure_max,
1285 features->pressure_fuzz, 0); 1274 features->pressure_fuzz, 0);
1286 input_set_abs_params(input_dev, ABS_MT_TRACKING_ID, 0,
1287 MAX_TRACKING_ID, 0, 0);
1288 } else if (features->device_type == BTN_TOOL_PEN) { 1275 } else if (features->device_type == BTN_TOOL_PEN) {
1289 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); 1276 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
1290 __set_bit(BTN_TOOL_PEN, input_dev->keybit); 1277 __set_bit(BTN_TOOL_PEN, input_dev->keybit);