diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2011-11-01 10:26:31 -0400 |
|---|---|---|
| committer | Jiri Kosina <jkosina@suse.cz> | 2011-11-01 10:26:31 -0400 |
| commit | d682bd7f38b73e5dff0b5584c8ec301ccf76e4db (patch) | |
| tree | 0ab9d28fedd5430393e50a6e69f433962f3f2f3d | |
| parent | 8052ee5f5fd9be153129eaa06ced4a786415abc1 (diff) | |
Revert "HID: multitouch: decide if hid-multitouch needs to handle mt devices"
This reverts commit 0db3bfc72adf0c (""HID: multitouch: decide if hid-multitouch
needs to handle mt devices").
The generic detection of hid-mt devices has two major flaws, and was
merged prematurely. Firstly, the hid-multitouch gets loaded even when
the device is handled by a special device. Secondly, the patch only
partially duplicates the device whitelist already present in hid-core,
effectively rendering a number of devices non-functional.
Reported-by: Sean Young <sean@mess.org>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
| -rw-r--r-- | drivers/hid/hid-multitouch.c | 47 |
1 files changed, 4 insertions, 43 deletions
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index fa5d7a1ffa9e..f1c909f1b239 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c | |||
| @@ -291,7 +291,6 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, | |||
| 291 | td->last_slot_field = usage->hid; | 291 | td->last_slot_field = usage->hid; |
| 292 | td->last_field_index = field->index; | 292 | td->last_field_index = field->index; |
| 293 | td->last_mt_collection = usage->collection_index; | 293 | td->last_mt_collection = usage->collection_index; |
| 294 | hdev->quirks &= ~HID_QUIRK_MULTITOUCH; | ||
| 295 | return 1; | 294 | return 1; |
| 296 | case HID_DG_WIDTH: | 295 | case HID_DG_WIDTH: |
| 297 | hid_map_usage(hi, usage, bit, max, | 296 | hid_map_usage(hi, usage, bit, max, |
| @@ -530,44 +529,12 @@ static void mt_set_input_mode(struct hid_device *hdev) | |||
| 530 | } | 529 | } |
| 531 | } | 530 | } |
| 532 | 531 | ||
| 533 | /* a list of devices for which there is a specialized multitouch driver */ | ||
| 534 | static const struct hid_device_id mt_have_special_driver[] = { | ||
| 535 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, 0x0001) }, | ||
| 536 | { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, 0x0006) }, | ||
| 537 | { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA, | ||
| 538 | USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN) }, | ||
| 539 | { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA, | ||
| 540 | USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH) }, | ||
| 541 | { } | ||
| 542 | }; | ||
| 543 | |||
| 544 | static bool mt_match_one_id(struct hid_device *hdev, | ||
| 545 | const struct hid_device_id *id) | ||
| 546 | { | ||
| 547 | return id->bus == hdev->bus && | ||
| 548 | (id->vendor == HID_ANY_ID || id->vendor == hdev->vendor) && | ||
| 549 | (id->product == HID_ANY_ID || id->product == hdev->product); | ||
| 550 | } | ||
| 551 | |||
| 552 | static const struct hid_device_id *mt_match_id(struct hid_device *hdev, | ||
| 553 | const struct hid_device_id *id) | ||
| 554 | { | ||
| 555 | for (; id->bus; id++) | ||
| 556 | if (mt_match_one_id(hdev, id)) | ||
| 557 | return id; | ||
| 558 | |||
| 559 | return NULL; | ||
| 560 | } | ||
| 561 | |||
| 562 | static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) | 532 | static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) |
| 563 | { | 533 | { |
| 564 | int ret, i; | 534 | int ret, i; |
| 565 | struct mt_device *td; | 535 | struct mt_device *td; |
| 566 | struct mt_class *mtclass = mt_classes; /* MT_CLS_DEFAULT */ | 536 | struct mt_class *mtclass = mt_classes; /* MT_CLS_DEFAULT */ |
| 567 | 537 | ||
| 568 | if (mt_match_id(hdev, mt_have_special_driver)) | ||
| 569 | return -ENODEV; | ||
| 570 | |||
| 571 | for (i = 0; mt_classes[i].name ; i++) { | 538 | for (i = 0; mt_classes[i].name ; i++) { |
| 572 | if (id->driver_data == mt_classes[i].name) { | 539 | if (id->driver_data == mt_classes[i].name) { |
| 573 | mtclass = &(mt_classes[i]); | 540 | mtclass = &(mt_classes[i]); |
| @@ -575,6 +542,10 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
| 575 | } | 542 | } |
| 576 | } | 543 | } |
| 577 | 544 | ||
| 545 | /* This allows the driver to correctly support devices | ||
| 546 | * that emit events over several HID messages. | ||
| 547 | */ | ||
| 548 | hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC; | ||
| 578 | 549 | ||
| 579 | td = kzalloc(sizeof(struct mt_device), GFP_KERNEL); | 550 | td = kzalloc(sizeof(struct mt_device), GFP_KERNEL); |
| 580 | if (!td) { | 551 | if (!td) { |
| @@ -590,16 +561,10 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
| 590 | if (ret != 0) | 561 | if (ret != 0) |
| 591 | goto fail; | 562 | goto fail; |
| 592 | 563 | ||
| 593 | hdev->quirks |= HID_QUIRK_MULTITOUCH; | ||
| 594 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); | 564 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); |
| 595 | if (ret) | 565 | if (ret) |
| 596 | goto fail; | 566 | goto fail; |
| 597 | 567 | ||
| 598 | /* This allows the driver to correctly support devices | ||
| 599 | * that emit events over several HID messages. | ||
| 600 | */ | ||
| 601 | hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC; | ||
| 602 | |||
| 603 | td->slots = kzalloc(td->maxcontacts * sizeof(struct mt_slot), | 568 | td->slots = kzalloc(td->maxcontacts * sizeof(struct mt_slot), |
| 604 | GFP_KERNEL); | 569 | GFP_KERNEL); |
| 605 | if (!td->slots) { | 570 | if (!td->slots) { |
| @@ -793,10 +758,6 @@ static const struct hid_device_id mt_devices[] = { | |||
| 793 | HID_USB_DEVICE(USB_VENDOR_ID_XAT, | 758 | HID_USB_DEVICE(USB_VENDOR_ID_XAT, |
| 794 | USB_DEVICE_ID_XAT_CSR) }, | 759 | USB_DEVICE_ID_XAT_CSR) }, |
| 795 | 760 | ||
| 796 | /* Rest of the world */ | ||
| 797 | { .driver_data = MT_CLS_DEFAULT, | ||
| 798 | HID_USB_DEVICE(HID_ANY_ID, HID_ANY_ID) }, | ||
| 799 | |||
| 800 | { } | 761 | { } |
| 801 | }; | 762 | }; |
| 802 | MODULE_DEVICE_TABLE(hid, mt_devices); | 763 | MODULE_DEVICE_TABLE(hid, mt_devices); |
