aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/input/input-mt.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/input/input-mt.c b/drivers/input/input-mt.c
index fbe29fcb15c5..f4b58f77c524 100644
--- a/drivers/input/input-mt.c
+++ b/drivers/input/input-mt.c
@@ -88,10 +88,13 @@ int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots,
88 goto err_mem; 88 goto err_mem;
89 } 89 }
90 90
91 /* Mark slots as 'unused' */ 91 /* Mark slots as 'inactive' */
92 for (i = 0; i < num_slots; i++) 92 for (i = 0; i < num_slots; i++)
93 input_mt_set_value(&mt->slots[i], ABS_MT_TRACKING_ID, -1); 93 input_mt_set_value(&mt->slots[i], ABS_MT_TRACKING_ID, -1);
94 94
95 /* Mark slots as 'unused' */
96 mt->frame = 1;
97
95 dev->mt = mt; 98 dev->mt = mt;
96 return 0; 99 return 0;
97err_mem: 100err_mem:
@@ -430,6 +433,8 @@ EXPORT_SYMBOL(input_mt_assign_slots);
430 * set the key on the first unused slot and return. 433 * set the key on the first unused slot and return.
431 * 434 *
432 * If no available slot can be found, -1 is returned. 435 * If no available slot can be found, -1 is returned.
436 * Note that for this function to work properly, input_mt_sync_frame() has
437 * to be called at each frame.
433 */ 438 */
434int input_mt_get_slot_by_key(struct input_dev *dev, int key) 439int input_mt_get_slot_by_key(struct input_dev *dev, int key)
435{ 440{
@@ -444,7 +449,7 @@ int input_mt_get_slot_by_key(struct input_dev *dev, int key)
444 return s - mt->slots; 449 return s - mt->slots;
445 450
446 for (s = mt->slots; s != mt->slots + mt->num_slots; s++) 451 for (s = mt->slots; s != mt->slots + mt->num_slots; s++)
447 if (!input_mt_is_active(s)) { 452 if (!input_mt_is_active(s) && !input_mt_is_used(mt, s)) {
448 s->key = key; 453 s->key = key;
449 return s - mt->slots; 454 return s - mt->slots;
450 } 455 }