Skip to content

Commit a831776

Browse files
bgamaridtor
authored andcommitted
Input: ALPS - handle 0-pressure 1F events
While a button is held SS5 hardware will give us single-finger packets with x, y, and pressure equal to zero. This causes annoying jumps in pointer position if a touch is released while the button is held. Handle this by claiming zero contacts to ensure that no position events are provided to the user. Reviewed-by: Pali Rohár <pali.rohar@gmail.com> Tested-by: Michal Hocko <mhocko@suse.com> Signed-off-by: Ben Gamari <ben@smart-cactus.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent 4777ac2 commit a831776

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎drivers/input/mouse/alps.c‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,13 @@ static int alps_decode_ss4_v2(struct alps_fields *f,
11981198
f->mt[0].x = SS4_1F_X_V2(p);
11991199
f->mt[0].y = SS4_1F_Y_V2(p);
12001200
f->pressure = ((SS4_1F_Z_V2(p)) * 2) & 0x7f;
1201-
f->fingers = 1;
1201+
/*
1202+
* When a button is held the device will give us events
1203+
* with x, y, and pressure of 0. This causes annoying jumps
1204+
* if a touch is released while the button is held.
1205+
* Handle this by claiming zero contacts.
1206+
*/
1207+
f->fingers = f->pressure > 0 ? 1 : 0;
12021208
f->first_mp = 0;
12031209
f->is_mp = 0;
12041210
break;

0 commit comments

Comments
 (0)