Skip to content

Commit 9b61aa8

Browse files
PinglinuxJiri Kosina
authored andcommitted
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 <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 33e5df0 commit 9b61aa8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/hid/wacom_wac.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,7 +1042,7 @@ static int wacom_24hdt_irq(struct wacom_wac *wacom)
10421042

10431043
for (i = 0; i < contacts_to_send; i++) {
10441044
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;
10461046
int slot = input_mt_get_slot_by_key(input, data[offset + 1]);
10471047

10481048
if (slot < 0)
@@ -1072,6 +1072,7 @@ static int wacom_24hdt_irq(struct wacom_wac *wacom)
10721072
if (wacom->num_contacts_left <= 0)
10731073
wacom->num_contacts_left = 0;
10741074

1075+
wacom->shared->touch_down = (wacom->num_contacts_left > 0);
10751076
return 1;
10761077
}
10771078

@@ -1100,7 +1101,7 @@ static int wacom_mt_touch(struct wacom_wac *wacom)
11001101

11011102
for (i = 0; i < contacts_to_send; i++) {
11021103
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;
11041105
int id = get_unaligned_le16(&data[offset + 1]);
11051106
int slot = input_mt_get_slot_by_key(input, id);
11061107

@@ -1122,6 +1123,7 @@ static int wacom_mt_touch(struct wacom_wac *wacom)
11221123
if (wacom->num_contacts_left < 0)
11231124
wacom->num_contacts_left = 0;
11241125

1126+
wacom->shared->touch_down = (wacom->num_contacts_left > 0);
11251127
return 1;
11261128
}
11271129

0 commit comments

Comments
 (0)