aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-multitouch.c
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2012-05-01 02:40:01 -0400
committerJiri Kosina <jkosina@suse.cz>2012-05-01 06:54:55 -0400
commit4fa3a5837b8427faab9b064b1948795eb77b9f8d (patch)
tree4aaa5fffb375f0b44e5c0a44726948ac016f53bf /drivers/hid/hid-multitouch.c
parent070748ed0b52399858a5967026a452bbb903a64c (diff)
HID: hid-multitouch: Switch to device groups
Switch the driver over to device group handling. By adding the HID_GROUP_MULTITOUCH group to hid-core, hid-generic will no longer match multitouch devices. By adding the HID_GROUP_MULTITOUCH entry to the device list, hid-multitouch will match all unknown multitouch devices, and udev will automatically load the module. Since HID_QUIRK_MULTITOUCH never gets set, the special quirks handling can be removed. Since all HID MT devices have HID_DG_CONTACTID, they can be removed from the hid_have_special_driver list. With this patch, the unknown device ids are no longer NULL, so the code is modified to check for the generic entry instead. Signed-off-by: Henrik Rydberg <rydberg@euromail.se> Acked-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-multitouch.c')
-rw-r--r--drivers/hid/hid-multitouch.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index 1d5b94167b52..ea465f1ceae9 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -635,6 +635,21 @@ static void mt_set_maxcontacts(struct hid_device *hdev)
635 } 635 }
636} 636}
637 637
638static void mt_post_parse_default_settings(struct mt_device *td)
639{
640 __s32 quirks = td->mtclass.quirks;
641
642 /* unknown serial device needs special quirks */
643 if (td->touches_by_report == 1) {
644 quirks |= MT_QUIRK_ALWAYS_VALID;
645 quirks &= ~MT_QUIRK_NOT_SEEN_MEANS_UP;
646 quirks &= ~MT_QUIRK_VALID_IS_INRANGE;
647 quirks &= ~MT_QUIRK_VALID_IS_CONFIDENCE;
648 }
649
650 td->mtclass.quirks = quirks;
651}
652
638static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) 653static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
639{ 654{
640 int ret, i; 655 int ret, i;
@@ -654,7 +669,6 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
654 * that emit events over several HID messages. 669 * that emit events over several HID messages.
655 */ 670 */
656 hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC; 671 hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC;
657 hdev->quirks &= ~HID_QUIRK_MULTITOUCH;
658 672
659 td = kzalloc(sizeof(struct mt_device), GFP_KERNEL); 673 td = kzalloc(sizeof(struct mt_device), GFP_KERNEL);
660 if (!td) { 674 if (!td) {
@@ -674,14 +688,8 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
674 if (ret) 688 if (ret)
675 goto fail; 689 goto fail;
676 690
677 if (!id && td->touches_by_report == 1) { 691 if (id->vendor == HID_ANY_ID && id->product == HID_ANY_ID)
678 /* the device has been sent by hid-generic */ 692 mt_post_parse_default_settings(td);
679 mtclass = &td->mtclass;
680 mtclass->quirks |= MT_QUIRK_ALWAYS_VALID;
681 mtclass->quirks &= ~MT_QUIRK_NOT_SEEN_MEANS_UP;
682 mtclass->quirks &= ~MT_QUIRK_VALID_IS_INRANGE;
683 mtclass->quirks &= ~MT_QUIRK_VALID_IS_CONFIDENCE;
684 }
685 693
686 td->slots = kzalloc(td->maxcontacts * sizeof(struct mt_slot), 694 td->slots = kzalloc(td->maxcontacts * sizeof(struct mt_slot),
687 GFP_KERNEL); 695 GFP_KERNEL);
@@ -999,6 +1007,8 @@ static const struct hid_device_id mt_devices[] = {
999 HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, 1007 HID_USB_DEVICE(USB_VENDOR_ID_XIROKU,
1000 USB_DEVICE_ID_XIROKU_CSR2) }, 1008 USB_DEVICE_ID_XIROKU_CSR2) },
1001 1009
1010 /* Generic MT device */
1011 { HID_DEVICE(HID_BUS_ANY, HID_GROUP_MULTITOUCH, HID_ANY_ID, HID_ANY_ID) },
1002 { } 1012 { }
1003}; 1013};
1004MODULE_DEVICE_TABLE(hid, mt_devices); 1014MODULE_DEVICE_TABLE(hid, mt_devices);