提交 ba4d695a 编写于 作者: H Henrik Rydberg 提交者: Dmitry Torokhov

Input: MT - initialize slots to unused

For MT slots, the ABS_MT_TRACKING_ID determines whether a slot is in use,
but currently leaves initialization up to the drivers. This patch sets the
slot state to unused upon creation.
Signed-off-by: NHenrik Rydberg <rydberg@euromail.se>
Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
上级 2c4e9671
...@@ -1599,11 +1599,14 @@ EXPORT_SYMBOL(input_free_device); ...@@ -1599,11 +1599,14 @@ EXPORT_SYMBOL(input_free_device);
* @dev: input device supporting MT events and finger tracking * @dev: input device supporting MT events and finger tracking
* @num_slots: number of slots used by the device * @num_slots: number of slots used by the device
* *
* This function allocates all necessary memory for MT slot handling * This function allocates all necessary memory for MT slot handling in the
* in the input device, and adds ABS_MT_SLOT to the device capabilities. * input device, and adds ABS_MT_SLOT to the device capabilities. All slots
* are initially marked as unused iby setting ABS_MT_TRACKING_ID to -1.
*/ */
int input_mt_create_slots(struct input_dev *dev, unsigned int num_slots) int input_mt_create_slots(struct input_dev *dev, unsigned int num_slots)
{ {
int i;
if (!num_slots) if (!num_slots)
return 0; return 0;
...@@ -1614,6 +1617,10 @@ int input_mt_create_slots(struct input_dev *dev, unsigned int num_slots) ...@@ -1614,6 +1617,10 @@ int input_mt_create_slots(struct input_dev *dev, unsigned int num_slots)
dev->mtsize = num_slots; dev->mtsize = num_slots;
input_set_abs_params(dev, ABS_MT_SLOT, 0, num_slots - 1, 0, 0); input_set_abs_params(dev, ABS_MT_SLOT, 0, num_slots - 1, 0, 0);
/* Mark slots as 'unused' */
for (i = 0; i < num_slots; i++)
dev->mt[i].abs[ABS_MT_TRACKING_ID - ABS_MT_FIRST] = -1;
return 0; return 0;
} }
EXPORT_SYMBOL(input_mt_create_slots); EXPORT_SYMBOL(input_mt_create_slots);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册