diff options
author | Benjamin Tissoires <benjamin.tissoires@enac.fr> | 2011-06-21 09:01:53 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2011-06-24 07:39:51 -0400 |
commit | 50bc03ab5c7529fdfe4e01621efca7d26439ea00 (patch) | |
tree | 854f8e300c7f157e56725410e0648f56439fb7c7 /drivers/hid | |
parent | 56299378726d5f2ba8d3c8cbbd13cb280ba45e4f (diff) |
HID: hid-multitouch: ensure slots are initialized
In case a device does not provide the feature "Maximum Contact Count",
or set it at 0, the maxcontacts field may be at 0 while calling
input_mt_init_slots.
This patch ensures that hid-multitouch will allways report
ABS_MT_SLOT and ABS_MT_TRACKING_ID to the user space.
This corrects a bug found with some Ilitek devices that has been
integrated in 3.0-rc0.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@enac.fr>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-multitouch.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 0b2dcd0ee591..386765654cf6 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c | |||
@@ -271,6 +271,8 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, | |||
271 | } | 271 | } |
272 | return 1; | 272 | return 1; |
273 | case HID_DG_CONTACTID: | 273 | case HID_DG_CONTACTID: |
274 | if (!td->maxcontacts) | ||
275 | td->maxcontacts = MT_DEFAULT_MAXCONTACT; | ||
274 | input_mt_init_slots(hi->input, td->maxcontacts); | 276 | input_mt_init_slots(hi->input, td->maxcontacts); |
275 | td->last_slot_field = usage->hid; | 277 | td->last_slot_field = usage->hid; |
276 | td->last_field_index = field->index; | 278 | td->last_field_index = field->index; |
@@ -547,9 +549,6 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
547 | if (ret) | 549 | if (ret) |
548 | goto fail; | 550 | goto fail; |
549 | 551 | ||
550 | if (!td->maxcontacts) | ||
551 | td->maxcontacts = MT_DEFAULT_MAXCONTACT; | ||
552 | |||
553 | td->slots = kzalloc(td->maxcontacts * sizeof(struct mt_slot), | 552 | td->slots = kzalloc(td->maxcontacts * sizeof(struct mt_slot), |
554 | GFP_KERNEL); | 553 | GFP_KERNEL); |
555 | if (!td->slots) { | 554 | if (!td->slots) { |