aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorBenjamin Tissoires <benjamin.tissoires@enac.fr>2012-03-06 11:57:04 -0500
committerJiri Kosina <jkosina@suse.cz>2012-03-12 06:27:07 -0400
commit8d179a9ef25a64b451e2bbd46f6a6c16c6a72eb1 (patch)
tree0085e1c271a4795447120dbc488b524aa93d229e /drivers/hid
parented9d5c96147b3bed6178252e8e04b27b7d32edd0 (diff)
HID: handle all multitouch devices through hid-multitouch
When the quirk HID_QUIRK_MULTITOUCH is present and when hid-multitouch is loaded, let's pass the device to hid-multitouch even if it has not been registered in hid-multitouch. If any other driver wants to take precedence over hid-multitouch, the usual way of adding it to hid_have_special_driver will work as the quirk HID_QUIRK_MULTITOUCH won't be set by the generic hid layer. 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-core.c12
-rw-r--r--drivers/hid/hid-multitouch.c11
2 files changed, 16 insertions, 7 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 4f4143cc789b..05a0c9a35bf2 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1232,7 +1232,6 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask)
1232 hdev->claimed |= HID_CLAIMED_INPUT; 1232 hdev->claimed |= HID_CLAIMED_INPUT;
1233 if (hdev->quirks & HID_QUIRK_MULTITOUCH) { 1233 if (hdev->quirks & HID_QUIRK_MULTITOUCH) {
1234 /* this device should be handled by hid-multitouch, skip it */ 1234 /* this device should be handled by hid-multitouch, skip it */
1235 hdev->quirks &= ~HID_QUIRK_MULTITOUCH;
1236 return -ENODEV; 1235 return -ENODEV;
1237 } 1236 }
1238 1237
@@ -1667,6 +1666,10 @@ static int hid_bus_match(struct device *dev, struct device_driver *drv)
1667 struct hid_driver *hdrv = container_of(drv, struct hid_driver, driver); 1666 struct hid_driver *hdrv = container_of(drv, struct hid_driver, driver);
1668 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 1667 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
1669 1668
1669 if ((hdev->quirks & HID_QUIRK_MULTITOUCH) &&
1670 !strncmp(hdrv->name, "hid-multitouch", 14))
1671 return 1;
1672
1670 if (!hid_match_device(hdev, hdrv)) 1673 if (!hid_match_device(hdev, hdrv))
1671 return 0; 1674 return 0;
1672 1675
@@ -1691,8 +1694,11 @@ static int hid_device_probe(struct device *dev)
1691 if (!hdev->driver) { 1694 if (!hdev->driver) {
1692 id = hid_match_device(hdev, hdrv); 1695 id = hid_match_device(hdev, hdrv);
1693 if (id == NULL) { 1696 if (id == NULL) {
1694 ret = -ENODEV; 1697 if (!((hdev->quirks & HID_QUIRK_MULTITOUCH) &&
1695 goto unlock; 1698 !strncmp(hdrv->name, "hid-multitouch", 14))) {
1699 ret = -ENODEV;
1700 goto unlock;
1701 }
1696 } 1702 }
1697 1703
1698 hdev->driver = hdrv; 1704 hdev->driver = hdrv;
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index 2088ab4e5db5..a61ba42e1bff 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -637,10 +637,12 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
637 struct mt_device *td; 637 struct mt_device *td;
638 struct mt_class *mtclass = mt_classes; /* MT_CLS_DEFAULT */ 638 struct mt_class *mtclass = mt_classes; /* MT_CLS_DEFAULT */
639 639
640 for (i = 0; mt_classes[i].name ; i++) { 640 if (id) {
641 if (id->driver_data == mt_classes[i].name) { 641 for (i = 0; mt_classes[i].name ; i++) {
642 mtclass = &(mt_classes[i]); 642 if (id->driver_data == mt_classes[i].name) {
643 break; 643 mtclass = &(mt_classes[i]);
644 break;
645 }
644 } 646 }
645 } 647 }
646 648
@@ -648,6 +650,7 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
648 * that emit events over several HID messages. 650 * that emit events over several HID messages.
649 */ 651 */
650 hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC; 652 hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC;
653 hdev->quirks &= ~HID_QUIRK_MULTITOUCH;
651 654
652 td = kzalloc(sizeof(struct mt_device), GFP_KERNEL); 655 td = kzalloc(sizeof(struct mt_device), GFP_KERNEL);
653 if (!td) { 656 if (!td) {