Commit 8ff21f44 authored by Dmitry Torokhov's avatar Dmitry Torokhov

Input: fix used slots detection breakage

Commit f8ec8949 allowed external callers
use slot dropping logic, unfortunately it also broke external users of
input_mt_is_used() as we stopped incrementing frame count unless input
device was set up to automatically drop unused slots.

Fixes: f8ec8949 ("Input: MT - make slot cleanup callable outside
mt_sync_frame()")
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=83081Reported-by: default avatarGabriele Mazzotta <gabriele.mzt@gmail.com>
Tested-by: default avatarGabriele Mazzotta <gabriele.mzt@gmail.com>
Reviewed-by: default avatarHenrik Rydberg <rydberg@euromail.se>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent fb92be7b
...@@ -236,28 +236,32 @@ void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count) ...@@ -236,28 +236,32 @@ void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count)
} }
EXPORT_SYMBOL(input_mt_report_pointer_emulation); EXPORT_SYMBOL(input_mt_report_pointer_emulation);
/** static void __input_mt_drop_unused(struct input_dev *dev, struct input_mt *mt)
* input_mt_drop_unused() - Inactivate slots not seen in this frame
* @dev: input device with allocated MT slots
*
* Lift all slots not seen since the last call to this function.
*/
void input_mt_drop_unused(struct input_dev *dev)
{ {
struct input_mt *mt = dev->mt;
int i; int i;
if (!mt)
return;
for (i = 0; i < mt->num_slots; i++) { for (i = 0; i < mt->num_slots; i++) {
if (!input_mt_is_used(mt, &mt->slots[i])) { if (!input_mt_is_used(mt, &mt->slots[i])) {
input_mt_slot(dev, i); input_mt_slot(dev, i);
input_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); input_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
} }
} }
}
/**
* input_mt_drop_unused() - Inactivate slots not seen in this frame
* @dev: input device with allocated MT slots
*
* Lift all slots not seen since the last call to this function.
*/
void input_mt_drop_unused(struct input_dev *dev)
{
struct input_mt *mt = dev->mt;
if (mt) {
__input_mt_drop_unused(dev, mt);
mt->frame++; mt->frame++;
}
} }
EXPORT_SYMBOL(input_mt_drop_unused); EXPORT_SYMBOL(input_mt_drop_unused);
...@@ -278,12 +282,14 @@ void input_mt_sync_frame(struct input_dev *dev) ...@@ -278,12 +282,14 @@ void input_mt_sync_frame(struct input_dev *dev)
return; return;
if (mt->flags & INPUT_MT_DROP_UNUSED) if (mt->flags & INPUT_MT_DROP_UNUSED)
input_mt_drop_unused(dev); __input_mt_drop_unused(dev, mt);
if ((mt->flags & INPUT_MT_POINTER) && !(mt->flags & INPUT_MT_SEMI_MT)) if ((mt->flags & INPUT_MT_POINTER) && !(mt->flags & INPUT_MT_SEMI_MT))
use_count = true; use_count = true;
input_mt_report_pointer_emulation(dev, use_count); input_mt_report_pointer_emulation(dev, use_count);
mt->frame++;
} }
EXPORT_SYMBOL(input_mt_sync_frame); EXPORT_SYMBOL(input_mt_sync_frame);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment