aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/tablet
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2010-12-15 07:50:34 -0500
committerHenrik Rydberg <rydberg@euromail.se>2010-12-16 04:41:38 -0500
commitc5f4dec1ceb6ab773bbbefbe64a7c990c7d6b17f (patch)
treefdc8b67537b73474bd34b65d0d1c5bc7a9de3c7a /drivers/input/tablet
parent8cde81001626c4c60b26ef2eb5fc522885ed9fd0 (diff)
input: mt: Move tracking and pointer emulation to input-mt
The drivers using the type B protocol all report tracking information the same way. The contact id is semantically equivalent to ABS_MT_SLOT, and the handling of ABS_MT_TRACKING_ID only complicates the driver. The situation can be improved upon by providing a common pointer emulation code, thereby removing the need for the tracking id in the driver. This patch moves all tracking event handling over to the input core, simplifying both the existing drivers and the ones currently in preparation. Acked-by: Ping Cheng <pingc@wacom.com> Acked-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'drivers/input/tablet')
-rw-r--r--drivers/input/tablet/wacom_wac.c23
-rw-r--r--drivers/input/tablet/wacom_wac.h4
2 files changed, 5 insertions, 22 deletions
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index f26e2238f6c..0b052548671 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);
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;