aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPing Cheng <pinglinux@gmail.com>2015-01-28 12:42:59 -0500
committerJiri Kosina <jkosina@suse.cz>2015-01-29 08:05:04 -0500
commit9b61aa864ab6c2e12e463559eb83cf83cbd06889 (patch)
tree1637077aa9338b4ad3962f33bfc3429f21a86e8d
parent33e5df0e0e32027866e9fb00451952998fc957f2 (diff)
HID: wacom: make sure touch arbitration is applied consistently
stylus_in_proximity is used to make sure no touch event is sent while pen is in proximity. touch_down is used to make sure a touch up event is sent when pen comes into proximity while touch is down. Two touch routines didn't store touch_down. One touch routine forgot to check stylus_in_proximity before sending touch events. This patch fixes those issues. Signed-off-by: Ping Cheng <pingc@wacom.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--drivers/hid/wacom_wac.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
index f8861494f4e3..6d490f602cfd 100644
--- a/drivers/hid/wacom_wac.c
+++ b/drivers/hid/wacom_wac.c
@@ -1042,7 +1042,7 @@ static int wacom_24hdt_irq(struct wacom_wac *wacom)
1042 1042
1043 for (i = 0; i < contacts_to_send; i++) { 1043 for (i = 0; i < contacts_to_send; i++) {
1044 int offset = (WACOM_BYTES_PER_24HDT_PACKET * i) + 1; 1044 int offset = (WACOM_BYTES_PER_24HDT_PACKET * i) + 1;
1045 bool touch = data[offset] & 0x1 && !wacom->shared->stylus_in_proximity; 1045 bool touch = (data[offset] & 0x1) && !wacom->shared->stylus_in_proximity;
1046 int slot = input_mt_get_slot_by_key(input, data[offset + 1]); 1046 int slot = input_mt_get_slot_by_key(input, data[offset + 1]);
1047 1047
1048 if (slot < 0) 1048 if (slot < 0)
@@ -1072,6 +1072,7 @@ static int wacom_24hdt_irq(struct wacom_wac *wacom)
1072 if (wacom->num_contacts_left <= 0) 1072 if (wacom->num_contacts_left <= 0)
1073 wacom->num_contacts_left = 0; 1073 wacom->num_contacts_left = 0;
1074 1074
1075 wacom->shared->touch_down = (wacom->num_contacts_left > 0);
1075 return 1; 1076 return 1;
1076} 1077}
1077 1078
@@ -1100,7 +1101,7 @@ static int wacom_mt_touch(struct wacom_wac *wacom)
1100 1101
1101 for (i = 0; i < contacts_to_send; i++) { 1102 for (i = 0; i < contacts_to_send; i++) {
1102 int offset = (WACOM_BYTES_PER_MT_PACKET + x_offset) * i + 3; 1103 int offset = (WACOM_BYTES_PER_MT_PACKET + x_offset) * i + 3;
1103 bool touch = data[offset] & 0x1; 1104 bool touch = (data[offset] & 0x1) && !wacom->shared->stylus_in_proximity;
1104 int id = get_unaligned_le16(&data[offset + 1]); 1105 int id = get_unaligned_le16(&data[offset + 1]);
1105 int slot = input_mt_get_slot_by_key(input, id); 1106 int slot = input_mt_get_slot_by_key(input, id);
1106 1107
@@ -1122,6 +1123,7 @@ static int wacom_mt_touch(struct wacom_wac *wacom)
1122 if (wacom->num_contacts_left < 0) 1123 if (wacom->num_contacts_left < 0)
1123 wacom->num_contacts_left = 0; 1124 wacom->num_contacts_left = 0;
1124 1125
1126 wacom->shared->touch_down = (wacom->num_contacts_left > 0);
1125 return 1; 1127 return 1;
1126} 1128}
1127 1129