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>
This commit is contained in:
Benjamin Tissoires 2012-03-06 17:57:04 +01:00 committed by Jiri Kosina
parent ed9d5c9614
commit 8d179a9ef2
2 changed files with 16 additions and 7 deletions

View File

@ -1232,7 +1232,6 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask)
hdev->claimed |= HID_CLAIMED_INPUT; hdev->claimed |= HID_CLAIMED_INPUT;
if (hdev->quirks & HID_QUIRK_MULTITOUCH) { if (hdev->quirks & HID_QUIRK_MULTITOUCH) {
/* this device should be handled by hid-multitouch, skip it */ /* this device should be handled by hid-multitouch, skip it */
hdev->quirks &= ~HID_QUIRK_MULTITOUCH;
return -ENODEV; return -ENODEV;
} }
@ -1667,6 +1666,10 @@ static int hid_bus_match(struct device *dev, struct device_driver *drv)
struct hid_driver *hdrv = container_of(drv, struct hid_driver, driver); struct hid_driver *hdrv = container_of(drv, struct hid_driver, driver);
struct hid_device *hdev = container_of(dev, struct hid_device, dev); struct hid_device *hdev = container_of(dev, struct hid_device, dev);
if ((hdev->quirks & HID_QUIRK_MULTITOUCH) &&
!strncmp(hdrv->name, "hid-multitouch", 14))
return 1;
if (!hid_match_device(hdev, hdrv)) if (!hid_match_device(hdev, hdrv))
return 0; return 0;
@ -1691,9 +1694,12 @@ static int hid_device_probe(struct device *dev)
if (!hdev->driver) { if (!hdev->driver) {
id = hid_match_device(hdev, hdrv); id = hid_match_device(hdev, hdrv);
if (id == NULL) { if (id == NULL) {
if (!((hdev->quirks & HID_QUIRK_MULTITOUCH) &&
!strncmp(hdrv->name, "hid-multitouch", 14))) {
ret = -ENODEV; ret = -ENODEV;
goto unlock; goto unlock;
} }
}
hdev->driver = hdrv; hdev->driver = hdrv;
if (hdrv->probe) { if (hdrv->probe) {

View File

@ -637,17 +637,20 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
struct mt_device *td; struct mt_device *td;
struct mt_class *mtclass = mt_classes; /* MT_CLS_DEFAULT */ struct mt_class *mtclass = mt_classes; /* MT_CLS_DEFAULT */
if (id) {
for (i = 0; mt_classes[i].name ; i++) { for (i = 0; mt_classes[i].name ; i++) {
if (id->driver_data == mt_classes[i].name) { if (id->driver_data == mt_classes[i].name) {
mtclass = &(mt_classes[i]); mtclass = &(mt_classes[i]);
break; break;
} }
} }
}
/* This allows the driver to correctly support devices /* This allows the driver to correctly support devices
* that emit events over several HID messages. * that emit events over several HID messages.
*/ */
hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC; hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC;
hdev->quirks &= ~HID_QUIRK_MULTITOUCH;
td = kzalloc(sizeof(struct mt_device), GFP_KERNEL); td = kzalloc(sizeof(struct mt_device), GFP_KERNEL);
if (!td) { if (!td) {