All of lore.kernel.org
 help / color / mirror / Atom feed
From: "benjamin.tissoires" <benjamin.tissoires@gmail.com>
To: "benjamin.tissoires" <benjamin.tissoires@gmail.com>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Henrik Rydberg <rydberg@euromail.se>,
	Jiri Kosina <jkosina@suse.cz>, Stephane Chatty <chatty@enac.fr>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 3/5] HID: handle all multitouch devices through hid-multitouch
Date: Tue,  6 Mar 2012 17:57:04 +0100	[thread overview]
Message-ID: <1331053026-21272-4-git-send-email-benjamin.tissoires@gmail.com> (raw)
In-Reply-To: <1331053026-21272-1-git-send-email-benjamin.tissoires@gmail.com>

From: Benjamin Tissoires <benjamin.tissoires@enac.fr>

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>
---
 drivers/hid/hid-core.c       |   12 +++++++++---
 drivers/hid/hid-multitouch.c |   11 +++++++----
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 171e6ed..2390e00 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1230,7 +1230,6 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask)
 		hdev->claimed |= HID_CLAIMED_INPUT;
 	if (hdev->quirks & HID_QUIRK_MULTITOUCH) {
 		/* this device should be handled by hid-multitouch, skip it */
-		hdev->quirks &= ~HID_QUIRK_MULTITOUCH;
 		return -ENODEV;
 	}
 
@@ -1663,6 +1662,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_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))
 		return 0;
 
@@ -1687,8 +1690,11 @@ static int hid_device_probe(struct device *dev)
 	if (!hdev->driver) {
 		id = hid_match_device(hdev, hdrv);
 		if (id == NULL) {
-			ret = -ENODEV;
-			goto unlock;
+			if (!((hdev->quirks & HID_QUIRK_MULTITOUCH) &&
+				!strncmp(hdrv->name, "hid-multitouch", 14))) {
+				ret = -ENODEV;
+				goto unlock;
+			}
 		}
 
 		hdev->driver = hdrv;
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index 2088ab4..a61ba42 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)
 	struct mt_device *td;
 	struct mt_class *mtclass = mt_classes; /* MT_CLS_DEFAULT */
 
-	for (i = 0; mt_classes[i].name ; i++) {
-		if (id->driver_data == mt_classes[i].name) {
-			mtclass = &(mt_classes[i]);
-			break;
+	if (id) {
+		for (i = 0; mt_classes[i].name ; i++) {
+			if (id->driver_data == mt_classes[i].name) {
+				mtclass = &(mt_classes[i]);
+				break;
+			}
 		}
 	}
 
@@ -648,6 +650,7 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
 	 * that emit events over several HID messages.
 	 */
 	hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC;
+	hdev->quirks &= ~HID_QUIRK_MULTITOUCH;
 
 	td = kzalloc(sizeof(struct mt_device), GFP_KERNEL);
 	if (!td) {
-- 
1.7.7.6

  parent reply	other threads:[~2012-03-06 16:57 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-06 16:57 [patch 0/5] Autohandling of multitouch devices through hid-multitouch benjamin.tissoires
2012-03-06 16:57 ` [PATCH 1/5] HID: multitouch: add support for eGalax 0x722a benjamin.tissoires
2012-03-09 12:29   ` Jiri Kosina
2012-03-10  6:31     ` Benjamin Tissoires
2012-03-12 12:40       ` Jiri Kosina
2012-03-12 12:40         ` Jiri Kosina
2012-03-12 13:02         ` Henrik Rydberg
2012-03-06 16:57 ` [PATCH 2/5] HID: multitouch: fix handling of buggy reports descriptors for Dell ST2220T benjamin.tissoires
2012-03-12 10:25   ` Jiri Kosina
2012-03-06 16:57 ` benjamin.tissoires [this message]
2012-03-06 16:57 ` [PATCH 4/5] HID: autoload hid-multitouch as needed benjamin.tissoires
2012-03-07 21:36   ` Jiri Kosina
2012-03-08 10:57     ` Henrik Rydberg
2012-03-08 11:21       ` Stéphane Chatty
2012-03-08 11:21         ` Stéphane Chatty
2012-03-08 11:30         ` Henrik Rydberg
2012-03-08 11:30           ` Henrik Rydberg
2012-03-08 11:48           ` Stéphane Chatty
2012-03-08 11:48             ` Stéphane Chatty
2012-03-08 12:23             ` Henrik Rydberg
2012-03-08 12:23               ` Henrik Rydberg
2012-03-08 22:47               ` Stéphane Chatty
2012-03-08 22:47                 ` Stéphane Chatty
2012-03-12 16:18                 ` Jiri Kosina
2012-03-12 15:57         ` Jiri Kosina
2012-03-12 15:57           ` Jiri Kosina
2012-03-12 17:42           ` Marcel Holtmann
2012-03-12 17:42             ` Marcel Holtmann
2012-03-12 20:47             ` Stéphane Chatty
2012-03-12 20:47               ` Stéphane Chatty
2012-03-12 22:21               ` Jiri Kosina
2012-03-13 10:17                 ` Stéphane Chatty
2012-03-13 10:17                   ` Stéphane Chatty
2012-03-13 10:17                   ` Stéphane Chatty
2012-03-13 16:13                   ` Jiri Kosina
2012-03-13 16:13                     ` Jiri Kosina
2012-03-13 18:14                     ` Stéphane Chatty
2012-03-13 18:14                       ` Stéphane Chatty
2012-03-13 18:14                       ` Stéphane Chatty
2012-03-16 11:26   ` Jiri Kosina
2012-03-06 16:57 ` [PATCH 5/5] HID: multitouch: detect serial protocol benjamin.tissoires

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1331053026-21272-4-git-send-email-benjamin.tissoires@gmail.com \
    --to=benjamin.tissoires@gmail.com \
    --cc=chatty@enac.fr \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jkosina@suse.cz \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rydberg@euromail.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.