Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

HID: multitouch: fix sticky fingers

The sticky fingers quirk (MT_QUIRK_STICKY_FINGERS) was only considering
the case when slots were not released during the last report.
This can be problematic if the firmware forgets to release a finger
while others are still present.

This was observed on the Synaptics DLL0945 touchpad found on the Dell
XPS 9310 and the Dell Inspiron 5406.

Fixes: 4f4001bc76fd ("HID: multitouch: fix rare Win 8 cases when the touch up event gets missing")
Cc: stable@vger.kernel.org
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
Signed-off-by: Jiri Kosina <jkosina@suse.com>

authored by

Benjamin Tissoires and committed by
Jiri Kosina
46f781e0 aa4daea4

+14 -13
+14 -13
drivers/hid/hid-multitouch.c
··· 94 94 TOUCHPAD_REPORT_ALL = TOUCHPAD_REPORT_BUTTONS | TOUCHPAD_REPORT_CONTACTS, 95 95 }; 96 96 97 - #define MT_IO_FLAGS_RUNNING 0 98 - #define MT_IO_FLAGS_ACTIVE_SLOTS 1 99 - #define MT_IO_FLAGS_PENDING_SLOTS 2 97 + #define MT_IO_SLOTS_MASK GENMASK(7, 0) /* reserve first 8 bits for slot tracking */ 98 + #define MT_IO_FLAGS_RUNNING 32 100 99 101 100 static const bool mtrue = true; /* default for true */ 102 101 static const bool mfalse; /* default for false */ ··· 171 172 struct timer_list release_timer; /* to release sticky fingers */ 172 173 struct hid_haptic_device *haptic; /* haptic related configuration */ 173 174 struct hid_device *hdev; /* hid_device we're attached to */ 174 - unsigned long mt_io_flags; /* mt flags (MT_IO_FLAGS_*) */ 175 + unsigned long mt_io_flags; /* mt flags (MT_IO_FLAGS_RUNNING) 176 + * first 8 bits are reserved for keeping the slot 177 + * states, this is fine because we only support up 178 + * to 250 slots (MT_MAX_MAXCONTACT) 179 + */ 175 180 __u8 inputmode_value; /* InputMode HID feature value */ 176 181 __u8 maxcontacts; 177 182 bool is_buttonpad; /* is this device a button pad? */ ··· 989 986 990 987 for_each_set_bit(slotnum, app->pending_palm_slots, td->maxcontacts) { 991 988 clear_bit(slotnum, app->pending_palm_slots); 989 + clear_bit(slotnum, &td->mt_io_flags); 992 990 993 991 input_mt_slot(input, slotnum); 994 992 input_mt_report_slot_inactive(input); ··· 1023 1019 app->left_button_state = 0; 1024 1020 if (td->is_haptic_touchpad) 1025 1021 hid_haptic_pressure_reset(td->haptic); 1026 - 1027 - if (test_bit(MT_IO_FLAGS_ACTIVE_SLOTS, &td->mt_io_flags)) 1028 - set_bit(MT_IO_FLAGS_PENDING_SLOTS, &td->mt_io_flags); 1029 - else 1030 - clear_bit(MT_IO_FLAGS_PENDING_SLOTS, &td->mt_io_flags); 1031 - clear_bit(MT_IO_FLAGS_ACTIVE_SLOTS, &td->mt_io_flags); 1032 1022 } 1033 1023 1034 1024 static int mt_compute_timestamp(struct mt_application *app, __s32 value) ··· 1200 1202 input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, major); 1201 1203 input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, minor); 1202 1204 1203 - set_bit(MT_IO_FLAGS_ACTIVE_SLOTS, &td->mt_io_flags); 1205 + set_bit(slotnum, &td->mt_io_flags); 1206 + } else { 1207 + clear_bit(slotnum, &td->mt_io_flags); 1204 1208 } 1205 1209 1206 1210 return 0; ··· 1337 1337 * defect. 1338 1338 */ 1339 1339 if (app->quirks & MT_QUIRK_STICKY_FINGERS) { 1340 - if (test_bit(MT_IO_FLAGS_PENDING_SLOTS, &td->mt_io_flags)) 1340 + if (td->mt_io_flags & MT_IO_SLOTS_MASK) 1341 1341 mod_timer(&td->release_timer, 1342 1342 jiffies + msecs_to_jiffies(100)); 1343 1343 else ··· 1814 1814 for (i = 0; i < mt->num_slots; i++) { 1815 1815 input_mt_slot(input_dev, i); 1816 1816 input_mt_report_slot_inactive(input_dev); 1817 + clear_bit(i, &td->mt_io_flags); 1817 1818 } 1818 1819 input_mt_sync_frame(input_dev); 1819 1820 input_sync(input_dev); ··· 1837 1836 */ 1838 1837 if (test_and_set_bit_lock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags)) 1839 1838 return; 1840 - if (test_bit(MT_IO_FLAGS_PENDING_SLOTS, &td->mt_io_flags)) 1839 + if (td->mt_io_flags & MT_IO_SLOTS_MASK) 1841 1840 mt_release_contacts(hdev); 1842 1841 clear_bit_unlock(MT_IO_FLAGS_RUNNING, &td->mt_io_flags); 1843 1842 }