aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/tablet
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2010-12-16 12:17:48 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2010-12-16 12:17:48 -0500
commit67b989a0c17e34a7c2c095e58a2f3d1b4408e3cb (patch)
treec076d2f0b5d4ae8726a50206042d3e3a41620fe4 /drivers/input/tablet
parent56a8bd6dcf81693e61a712097216904f3a4ab536 (diff)
parent69479f8da68f1930b2078b2ebf6533fb00339918 (diff)
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rydberg/input-mt into next
Conflicts: drivers/input/Makefile
Diffstat (limited to 'drivers/input/tablet')
-rw-r--r--drivers/input/tablet/wacom_wac.c26
-rw-r--r--drivers/input/tablet/wacom_wac.h4
2 files changed, 7 insertions, 23 deletions
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index b3252ef1e27..0b052548671 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);
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h
index 00ca01541d8..b1310ec9720 100644
--- a/drivers/input/tablet/wacom_wac.h
+++ b/drivers/input/tablet/wacom_wac.h
@@ -42,9 +42,6 @@
42#define WACOM_QUIRK_MULTI_INPUT 0x0001 42#define WACOM_QUIRK_MULTI_INPUT 0x0001
43#define WACOM_QUIRK_BBTOUCH_LOWRES 0x0002 43#define WACOM_QUIRK_BBTOUCH_LOWRES 0x0002
44 44
45/* largest reported tracking id */
46#define MAX_TRACKING_ID 0xfff
47
48enum { 45enum {
49 PENPARTNER = 0, 46 PENPARTNER = 0,
50 GRAPHIRE, 47 GRAPHIRE,
@@ -100,7 +97,6 @@ struct wacom_wac {
100 int id[3]; 97 int id[3];
101 __u32 serial[2]; 98 __u32 serial[2];
102 int last_finger; 99 int last_finger;
103 int trk_id;
104 struct wacom_features features; 100 struct wacom_features features;
105 struct wacom_shared *shared; 101 struct wacom_shared *shared;
106 struct input_dev *input; 102 struct input_dev *input;