aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorBenjamin Tissoires <benjamin.tissoires@gmail.com>2011-09-21 10:56:55 -0400
committerJiri Kosina <jkosina@suse.cz>2011-09-26 08:19:02 -0400
commit0db3bfc72adf0cb70f08dfe92e4040f64e25e205 (patch)
treea1c3134b94b3961b7105dd46566f61f339f843ba /drivers/hid
parentb77c3920e90e96103e4f41442999402925fe5f73 (diff)
HID: multitouch: decide if hid-multitouch needs to handle mt devices
Now that hid-generic ignores all win7 compatible multitouch devices, this patch allows hid-multitouch to catch them. The idea is to rely on the quirk HID_QUIRK_MULTITOUCH to drop the device if no ContactID is given. There is the need for a blacklist here as other devices may need a special driver (ntrig for instance). Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-multitouch.c47
1 files changed, 43 insertions, 4 deletions
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index f1c909f1b239..fa5d7a1ffa9e 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -291,6 +291,7 @@ 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;
294 return 1; 295 return 1;
295 case HID_DG_WIDTH: 296 case HID_DG_WIDTH:
296 hid_map_usage(hi, usage, bit, max, 297 hid_map_usage(hi, usage, bit, max,
@@ -529,12 +530,44 @@ static void mt_set_input_mode(struct hid_device *hdev)
529 } 530 }
530} 531}
531 532
533/* a list of devices for which there is a specialized multitouch driver */
534static 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
544static 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
552static 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
532static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) 562static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
533{ 563{
534 int ret, i; 564 int ret, i;
535 struct mt_device *td; 565 struct mt_device *td;
536 struct mt_class *mtclass = mt_classes; /* MT_CLS_DEFAULT */ 566 struct mt_class *mtclass = mt_classes; /* MT_CLS_DEFAULT */
537 567
568 if (mt_match_id(hdev, mt_have_special_driver))
569 return -ENODEV;
570
538 for (i = 0; mt_classes[i].name ; i++) { 571 for (i = 0; mt_classes[i].name ; i++) {
539 if (id->driver_data == mt_classes[i].name) { 572 if (id->driver_data == mt_classes[i].name) {
540 mtclass = &(mt_classes[i]); 573 mtclass = &(mt_classes[i]);
@@ -542,10 +575,6 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
542 } 575 }
543 } 576 }
544 577
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;
549 578
550 td = kzalloc(sizeof(struct mt_device), GFP_KERNEL); 579 td = kzalloc(sizeof(struct mt_device), GFP_KERNEL);
551 if (!td) { 580 if (!td) {
@@ -561,10 +590,16 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
561 if (ret != 0) 590 if (ret != 0)
562 goto fail; 591 goto fail;
563 592
593 hdev->quirks |= HID_QUIRK_MULTITOUCH;
564 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); 594 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
565 if (ret) 595 if (ret)
566 goto fail; 596 goto fail;
567 597
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
568 td->slots = kzalloc(td->maxcontacts * sizeof(struct mt_slot), 603 td->slots = kzalloc(td->maxcontacts * sizeof(struct mt_slot),
569 GFP_KERNEL); 604 GFP_KERNEL);
570 if (!td->slots) { 605 if (!td->slots) {
@@ -758,6 +793,10 @@ static const struct hid_device_id mt_devices[] = {
758 HID_USB_DEVICE(USB_VENDOR_ID_XAT, 793 HID_USB_DEVICE(USB_VENDOR_ID_XAT,
759 USB_DEVICE_ID_XAT_CSR) }, 794 USB_DEVICE_ID_XAT_CSR) },
760 795
796 /* Rest of the world */
797 { .driver_data = MT_CLS_DEFAULT,
798 HID_USB_DEVICE(HID_ANY_ID, HID_ANY_ID) },
799
761 { } 800 { }
762}; 801};
763MODULE_DEVICE_TABLE(hid, mt_devices); 802MODULE_DEVICE_TABLE(hid, mt_devices);