diff options
| author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2014-08-25 14:31:02 -0400 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2014-08-25 17:59:48 -0400 |
| commit | 8ff21f44fa70d363477b63646847f8d08c0e20a2 (patch) | |
| tree | 8983acbc513f87c6c2aebc294538bbd10dd78afe /drivers/input | |
| parent | fb92be7ba8ca6be57b6595d2cb2d30a53b39417d (diff) | |
Input: fix used slots detection breakage
Commit f8ec894945e7d205ce62be59e55e72c4304e4739 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: f8ec894945e7d ("Input: MT - make slot cleanup callable outside
mt_sync_frame()")
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=83081
Reported-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
Tested-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
Reviewed-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
| -rw-r--r-- | drivers/input/input-mt.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/drivers/input/input-mt.c b/drivers/input/input-mt.c index c30204f2fa30..fbe29fcb15c5 100644 --- a/drivers/input/input-mt.c +++ b/drivers/input/input-mt.c | |||
| @@ -236,6 +236,18 @@ void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count) | |||
| 236 | } | 236 | } |
| 237 | EXPORT_SYMBOL(input_mt_report_pointer_emulation); | 237 | EXPORT_SYMBOL(input_mt_report_pointer_emulation); |
| 238 | 238 | ||
| 239 | static void __input_mt_drop_unused(struct input_dev *dev, struct input_mt *mt) | ||
| 240 | { | ||
| 241 | int i; | ||
| 242 | |||
| 243 | for (i = 0; i < mt->num_slots; i++) { | ||
| 244 | if (!input_mt_is_used(mt, &mt->slots[i])) { | ||
| 245 | input_mt_slot(dev, i); | ||
| 246 | input_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); | ||
| 247 | } | ||
| 248 | } | ||
| 249 | } | ||
| 250 | |||
| 239 | /** | 251 | /** |
| 240 | * input_mt_drop_unused() - Inactivate slots not seen in this frame | 252 | * input_mt_drop_unused() - Inactivate slots not seen in this frame |
| 241 | * @dev: input device with allocated MT slots | 253 | * @dev: input device with allocated MT slots |
| @@ -245,19 +257,11 @@ EXPORT_SYMBOL(input_mt_report_pointer_emulation); | |||
| 245 | void input_mt_drop_unused(struct input_dev *dev) | 257 | void input_mt_drop_unused(struct input_dev *dev) |
| 246 | { | 258 | { |
| 247 | struct input_mt *mt = dev->mt; | 259 | struct input_mt *mt = dev->mt; |
| 248 | int i; | ||
| 249 | 260 | ||
| 250 | if (!mt) | 261 | if (mt) { |
| 251 | return; | 262 | __input_mt_drop_unused(dev, mt); |
| 252 | 263 | mt->frame++; | |
| 253 | for (i = 0; i < mt->num_slots; i++) { | ||
| 254 | if (!input_mt_is_used(mt, &mt->slots[i])) { | ||
| 255 | input_mt_slot(dev, i); | ||
| 256 | input_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); | ||
| 257 | } | ||
| 258 | } | 264 | } |
| 259 | |||
| 260 | mt->frame++; | ||
| 261 | } | 265 | } |
| 262 | EXPORT_SYMBOL(input_mt_drop_unused); | 266 | EXPORT_SYMBOL(input_mt_drop_unused); |
| 263 | 267 | ||
| @@ -278,12 +282,14 @@ void input_mt_sync_frame(struct input_dev *dev) | |||
| 278 | return; | 282 | return; |
| 279 | 283 | ||
| 280 | if (mt->flags & INPUT_MT_DROP_UNUSED) | 284 | if (mt->flags & INPUT_MT_DROP_UNUSED) |
| 281 | input_mt_drop_unused(dev); | 285 | __input_mt_drop_unused(dev, mt); |
| 282 | 286 | ||
| 283 | if ((mt->flags & INPUT_MT_POINTER) && !(mt->flags & INPUT_MT_SEMI_MT)) | 287 | if ((mt->flags & INPUT_MT_POINTER) && !(mt->flags & INPUT_MT_SEMI_MT)) |
| 284 | use_count = true; | 288 | use_count = true; |
| 285 | 289 | ||
| 286 | input_mt_report_pointer_emulation(dev, use_count); | 290 | input_mt_report_pointer_emulation(dev, use_count); |
| 291 | |||
| 292 | mt->frame++; | ||
| 287 | } | 293 | } |
| 288 | EXPORT_SYMBOL(input_mt_sync_frame); | 294 | EXPORT_SYMBOL(input_mt_sync_frame); |
| 289 | 295 | ||
