diff options
author | Henrik Rydberg <rydberg@euromail.se> | 2009-04-28 10:47:33 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2009-04-28 12:36:24 -0400 |
commit | 5e5ee686e3c0f8a3cbe9b75c2690326bf91af10d (patch) | |
tree | cfa1e26391f1252a8e47fe82cc2a76ef23e95502 | |
parent | 61994a61bcedf328cb1d6e96c393fc91ce64563d (diff) |
Input: add detailed multi-touch finger data report protocol
In order to utilize the full power of the new multi-touch devices, a
way to report detailed finger data to user space is needed. This patch
adds a multi-touch (MT) protocol which allows drivers to report details
for an arbitrary number of fingers.
The driver sends a SYN_MT_REPORT event via the input_mt_sync() function
when a complete finger has been reported.
In order to stay compatible with existing applications, the data
reported in a finger packet must not be recognized as single-touch
events. In addition, all finger data must bypass input filtering,
since subsequent events of the same type refer to different fingers.
A set of ABS_MT events with the desired properties are defined. The
events are divided into categories, to allow for partial implementation.
The minimum set consists of ABS_MT_TOUCH_MAJOR, ABS_MT_POSITION_X and
ABS_MT_POSITION_Y, which allows for multiple fingers to be tracked.
If the device supports it, the ABS_MT_WIDTH_MAJOR may be used to provide
the size of the approaching finger. Anisotropy and direction may be
specified with ABS_MT_TOUCH_MINOR, ABS_MT_WIDTH_MINOR and
ABS_MT_ORIENTATION. Devices with more granular information may specify
general shapes as blobs, i.e., as a sequence of rectangular shapes
grouped together by a ABS_MT_BLOB_ID. Finally, the ABS_MT_TOOL_TYPE
may be used to specify whether the touching tool is a finger or a pen.
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
-rw-r--r-- | drivers/input/input.c | 13 | ||||
-rw-r--r-- | include/linux/input.h | 23 |
2 files changed, 36 insertions, 0 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c index 8ff92aa13a0a..e54e002665b0 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
@@ -33,6 +33,15 @@ MODULE_LICENSE("GPL"); | |||
33 | * EV_ABS events which should not be cached are listed here. | 33 | * EV_ABS events which should not be cached are listed here. |
34 | */ | 34 | */ |
35 | static unsigned int input_abs_bypass_init_data[] __initdata = { | 35 | static unsigned int input_abs_bypass_init_data[] __initdata = { |
36 | ABS_MT_TOUCH_MAJOR, | ||
37 | ABS_MT_TOUCH_MINOR, | ||
38 | ABS_MT_WIDTH_MAJOR, | ||
39 | ABS_MT_WIDTH_MINOR, | ||
40 | ABS_MT_ORIENTATION, | ||
41 | ABS_MT_POSITION_X, | ||
42 | ABS_MT_POSITION_Y, | ||
43 | ABS_MT_TOOL_TYPE, | ||
44 | ABS_MT_BLOB_ID, | ||
36 | 0 | 45 | 0 |
37 | }; | 46 | }; |
38 | static unsigned long input_abs_bypass[BITS_TO_LONGS(ABS_CNT)]; | 47 | static unsigned long input_abs_bypass[BITS_TO_LONGS(ABS_CNT)]; |
@@ -169,6 +178,10 @@ static void input_handle_event(struct input_dev *dev, | |||
169 | disposition = INPUT_PASS_TO_HANDLERS; | 178 | disposition = INPUT_PASS_TO_HANDLERS; |
170 | } | 179 | } |
171 | break; | 180 | break; |
181 | case SYN_MT_REPORT: | ||
182 | dev->sync = 0; | ||
183 | disposition = INPUT_PASS_TO_HANDLERS; | ||
184 | break; | ||
172 | } | 185 | } |
173 | break; | 186 | break; |
174 | 187 | ||
diff --git a/include/linux/input.h b/include/linux/input.h index 32cb825939be..0e6ff5de3588 100644 --- a/include/linux/input.h +++ b/include/linux/input.h | |||
@@ -106,6 +106,7 @@ struct input_absinfo { | |||
106 | 106 | ||
107 | #define SYN_REPORT 0 | 107 | #define SYN_REPORT 0 |
108 | #define SYN_CONFIG 1 | 108 | #define SYN_CONFIG 1 |
109 | #define SYN_MT_REPORT 2 | ||
109 | 110 | ||
110 | /* | 111 | /* |
111 | * Keys and buttons | 112 | * Keys and buttons |
@@ -645,6 +646,17 @@ struct input_absinfo { | |||
645 | #define ABS_TOOL_WIDTH 0x1c | 646 | #define ABS_TOOL_WIDTH 0x1c |
646 | #define ABS_VOLUME 0x20 | 647 | #define ABS_VOLUME 0x20 |
647 | #define ABS_MISC 0x28 | 648 | #define ABS_MISC 0x28 |
649 | |||
650 | #define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */ | ||
651 | #define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */ | ||
652 | #define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */ | ||
653 | #define ABS_MT_WIDTH_MINOR 0x33 /* Minor axis (omit if circular) */ | ||
654 | #define ABS_MT_ORIENTATION 0x34 /* Ellipse orientation */ | ||
655 | #define ABS_MT_POSITION_X 0x35 /* Center X ellipse position */ | ||
656 | #define ABS_MT_POSITION_Y 0x36 /* Center Y ellipse position */ | ||
657 | #define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */ | ||
658 | #define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */ | ||
659 | |||
648 | #define ABS_MAX 0x3f | 660 | #define ABS_MAX 0x3f |
649 | #define ABS_CNT (ABS_MAX+1) | 661 | #define ABS_CNT (ABS_MAX+1) |
650 | 662 | ||
@@ -744,6 +756,12 @@ struct input_absinfo { | |||
744 | #define BUS_ATARI 0x1B | 756 | #define BUS_ATARI 0x1B |
745 | 757 | ||
746 | /* | 758 | /* |
759 | * MT_TOOL types | ||
760 | */ | ||
761 | #define MT_TOOL_FINGER 0 | ||
762 | #define MT_TOOL_PEN 1 | ||
763 | |||
764 | /* | ||
747 | * Values describing the status of a force-feedback effect | 765 | * Values describing the status of a force-feedback effect |
748 | */ | 766 | */ |
749 | #define FF_STATUS_STOPPED 0x00 | 767 | #define FF_STATUS_STOPPED 0x00 |
@@ -1312,6 +1330,11 @@ static inline void input_sync(struct input_dev *dev) | |||
1312 | input_event(dev, EV_SYN, SYN_REPORT, 0); | 1330 | input_event(dev, EV_SYN, SYN_REPORT, 0); |
1313 | } | 1331 | } |
1314 | 1332 | ||
1333 | static inline void input_mt_sync(struct input_dev *dev) | ||
1334 | { | ||
1335 | input_event(dev, EV_SYN, SYN_MT_REPORT, 0); | ||
1336 | } | ||
1337 | |||
1315 | void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code); | 1338 | void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code); |
1316 | 1339 | ||
1317 | static inline void input_set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat) | 1340 | static inline void input_set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat) |