Skip to content

Commit d3e69b9

Browse files
bleungatchromiumJiri Kosina
authored andcommitted
HID: multitouch: Release all touch slots on reset_resume
When resetting a device (especially after power loss) it is unlikely that the firmware will keep the contact tracking data for the previous touches and will be able to reconcile it with the new contacts, so let's release all slots on reset resume as start anew. Signed-off-by: Benson Leung <[email protected]> Signed-off-by: Dmitry Torokhov <[email protected]> Reviewed-by: Benjamin Tissoires <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 45c5c68 commit d3e69b9

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

drivers/hid/hid-multitouch.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,8 +1150,30 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
11501150
}
11511151

11521152
#ifdef CONFIG_PM
1153+
static void mt_release_contacts(struct hid_device *hid)
1154+
{
1155+
struct hid_input *hidinput;
1156+
1157+
list_for_each_entry(hidinput, &hid->inputs, list) {
1158+
struct input_dev *input_dev = hidinput->input;
1159+
struct input_mt *mt = input_dev->mt;
1160+
int i;
1161+
1162+
if (mt) {
1163+
for (i = 0; i < mt->num_slots; i++) {
1164+
input_mt_slot(input_dev, i);
1165+
input_mt_report_slot_state(input_dev,
1166+
MT_TOOL_FINGER,
1167+
false);
1168+
}
1169+
input_sync(input_dev);
1170+
}
1171+
}
1172+
}
1173+
11531174
static int mt_reset_resume(struct hid_device *hdev)
11541175
{
1176+
mt_release_contacts(hdev);
11551177
mt_set_maxcontacts(hdev);
11561178
mt_set_input_mode(hdev);
11571179
return 0;

0 commit comments

Comments
 (0)