diff options
author | Henrik Rydberg <rydberg@euromail.se> | 2010-07-16 02:10:10 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2010-07-16 02:52:03 -0400 |
commit | 40d007e7df1dab17bf1ecf91e718218354d963d7 (patch) | |
tree | d8c12e13e71f411b4f66aa44ec9b23935156e49d /include/linux/input.h | |
parent | a8aef622929bbba4d89498fb41dd445c14fae1f7 (diff) |
Input: introduce MT event slots
With the rapidly increasing number of intelligent multi-contact and
multi-user devices, the need to send digested, filtered information
from a set of different sources within the same device is imminent.
This patch adds the concept of slots to the MT protocol. The slots
enumerate a set of identified sources, such that all MT events
can be passed independently and selectively per identified source.
The protocol works like this: Instead of sending a SYN_MT_REPORT
event immediately after the contact data, one sends an ABS_MT_SLOT
event immediately before the contact data. The input core will only
emit events for slots with modified MT events. It is assumed that
the same slot is used for the duration of an initiated contact.
Acked-by: Ping Cheng <pingc@wacom.com>
Acked-by: Chase Douglas <chase.douglas@canonical.com>
Acked-by: Rafi Rubin <rafi@seas.upenn.edu>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'include/linux/input.h')
-rw-r--r-- | include/linux/input.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/include/linux/input.h b/include/linux/input.h index cc524c8b6703..a14de64ed16a 100644 --- a/include/linux/input.h +++ b/include/linux/input.h | |||
@@ -691,9 +691,12 @@ struct input_absinfo { | |||
691 | #define ABS_TILT_X 0x1a | 691 | #define ABS_TILT_X 0x1a |
692 | #define ABS_TILT_Y 0x1b | 692 | #define ABS_TILT_Y 0x1b |
693 | #define ABS_TOOL_WIDTH 0x1c | 693 | #define ABS_TOOL_WIDTH 0x1c |
694 | |||
694 | #define ABS_VOLUME 0x20 | 695 | #define ABS_VOLUME 0x20 |
696 | |||
695 | #define ABS_MISC 0x28 | 697 | #define ABS_MISC 0x28 |
696 | 698 | ||
699 | #define ABS_MT_SLOT 0x2f /* MT slot being modified */ | ||
697 | #define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */ | 700 | #define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */ |
698 | #define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */ | 701 | #define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */ |
699 | #define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */ | 702 | #define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */ |
@@ -706,6 +709,12 @@ struct input_absinfo { | |||
706 | #define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */ | 709 | #define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */ |
707 | #define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */ | 710 | #define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */ |
708 | 711 | ||
712 | #ifdef __KERNEL__ | ||
713 | /* Implementation details, userspace should not care about these */ | ||
714 | #define ABS_MT_FIRST ABS_MT_TOUCH_MAJOR | ||
715 | #define ABS_MT_LAST ABS_MT_PRESSURE | ||
716 | #endif | ||
717 | |||
709 | #define ABS_MAX 0x3f | 718 | #define ABS_MAX 0x3f |
710 | #define ABS_CNT (ABS_MAX+1) | 719 | #define ABS_CNT (ABS_MAX+1) |
711 | 720 | ||
@@ -1048,6 +1057,14 @@ struct ff_effect { | |||
1048 | #include <linux/mod_devicetable.h> | 1057 | #include <linux/mod_devicetable.h> |
1049 | 1058 | ||
1050 | /** | 1059 | /** |
1060 | * struct input_mt_slot - represents the state of an input MT slot | ||
1061 | * @abs: holds current values of ABS_MT axes for this slot | ||
1062 | */ | ||
1063 | struct input_mt_slot { | ||
1064 | int abs[ABS_MT_LAST - ABS_MT_FIRST + 1]; | ||
1065 | }; | ||
1066 | |||
1067 | /** | ||
1051 | * struct input_dev - represents an input device | 1068 | * struct input_dev - represents an input device |
1052 | * @name: name of the device | 1069 | * @name: name of the device |
1053 | * @phys: physical path to the device in the system hierarchy | 1070 | * @phys: physical path to the device in the system hierarchy |
@@ -1085,6 +1102,10 @@ struct ff_effect { | |||
1085 | * @sync: set to 1 when there were no new events since last EV_SYNC | 1102 | * @sync: set to 1 when there were no new events since last EV_SYNC |
1086 | * @abs: current values for reports from absolute axes | 1103 | * @abs: current values for reports from absolute axes |
1087 | * @rep: current values for autorepeat parameters (delay, rate) | 1104 | * @rep: current values for autorepeat parameters (delay, rate) |
1105 | * @mt: pointer to array of struct input_mt_slot holding current values | ||
1106 | * of tracked contacts | ||
1107 | * @mtsize: number of MT slots the device uses | ||
1108 | * @slot: MT slot currently being transmitted | ||
1088 | * @key: reflects current state of device's keys/buttons | 1109 | * @key: reflects current state of device's keys/buttons |
1089 | * @led: reflects current state of device's LEDs | 1110 | * @led: reflects current state of device's LEDs |
1090 | * @snd: reflects current state of sound effects | 1111 | * @snd: reflects current state of sound effects |
@@ -1164,6 +1185,10 @@ struct input_dev { | |||
1164 | int abs[ABS_CNT]; | 1185 | int abs[ABS_CNT]; |
1165 | int rep[REP_MAX + 1]; | 1186 | int rep[REP_MAX + 1]; |
1166 | 1187 | ||
1188 | struct input_mt_slot *mt; | ||
1189 | int mtsize; | ||
1190 | int slot; | ||
1191 | |||
1167 | unsigned long key[BITS_TO_LONGS(KEY_CNT)]; | 1192 | unsigned long key[BITS_TO_LONGS(KEY_CNT)]; |
1168 | unsigned long led[BITS_TO_LONGS(LED_CNT)]; | 1193 | unsigned long led[BITS_TO_LONGS(LED_CNT)]; |
1169 | unsigned long snd[BITS_TO_LONGS(SND_CNT)]; | 1194 | unsigned long snd[BITS_TO_LONGS(SND_CNT)]; |
@@ -1412,6 +1437,11 @@ static inline void input_mt_sync(struct input_dev *dev) | |||
1412 | input_event(dev, EV_SYN, SYN_MT_REPORT, 0); | 1437 | input_event(dev, EV_SYN, SYN_MT_REPORT, 0); |
1413 | } | 1438 | } |
1414 | 1439 | ||
1440 | static inline void input_mt_slot(struct input_dev *dev, int slot) | ||
1441 | { | ||
1442 | input_event(dev, EV_ABS, ABS_MT_SLOT, slot); | ||
1443 | } | ||
1444 | |||
1415 | void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code); | 1445 | void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code); |
1416 | 1446 | ||
1417 | /** | 1447 | /** |
@@ -1506,5 +1536,8 @@ int input_ff_erase(struct input_dev *dev, int effect_id, struct file *file); | |||
1506 | int input_ff_create_memless(struct input_dev *dev, void *data, | 1536 | int input_ff_create_memless(struct input_dev *dev, void *data, |
1507 | int (*play_effect)(struct input_dev *, void *, struct ff_effect *)); | 1537 | int (*play_effect)(struct input_dev *, void *, struct ff_effect *)); |
1508 | 1538 | ||
1539 | int input_mt_create_slots(struct input_dev *dev, unsigned int num_slots); | ||
1540 | void input_mt_destroy_slots(struct input_dev *dev); | ||
1541 | |||
1509 | #endif | 1542 | #endif |
1510 | #endif | 1543 | #endif |