linux-input.vger.kernel.org archive mirror
 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 5/5] HID: multitouch: detect serial protocol
Date: Tue,  6 Mar 2012 17:57:06 +0100	[thread overview]
Message-ID: <1331053026-21272-6-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>

Microsoft's documentation about multitouch protocols tells that
if a device presents one touch per report, then it should be treated
as a serial protocol.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@enac.fr>
---
 drivers/hid/hid-multitouch.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index a61ba42..6fb46d7 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -81,6 +81,9 @@ struct mt_device {
 	__u8 num_received;	/* how many contacts we received */
 	__u8 num_expected;	/* expected last contact index */
 	__u8 maxcontacts;
+	__u8 touches_by_report;	/* how many touches are present in one report:
+				* 1 means we should use a serial protocol
+				* > 1 means hybrid (multitouch) protocol */
 	bool curvalid;		/* is the current contact valid? */
 	struct mt_slot *slots;
 };
@@ -365,6 +368,7 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
 			input_mt_init_slots(hi->input, td->maxcontacts);
 			td->last_slot_field = usage->hid;
 			td->last_field_index = field->index;
+			td->touches_by_report++;
 			return 1;
 		case HID_DG_WIDTH:
 			hid_map_usage(hi, usage, bit, max,
@@ -670,6 +674,15 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
 	if (ret)
 		goto fail;
 
+	if (!id && td->touches_by_report == 1) {
+		/* the device has been sent by hid-generic */
+		mtclass = &td->mtclass;
+		mtclass->quirks |= MT_QUIRK_ALWAYS_VALID;
+		mtclass->quirks &= ~MT_QUIRK_NOT_SEEN_MEANS_UP;
+		mtclass->quirks &= ~MT_QUIRK_VALID_IS_INRANGE;
+		mtclass->quirks &= ~MT_QUIRK_VALID_IS_CONFIDENCE;
+	}
+
 	td->slots = kzalloc(td->maxcontacts * sizeof(struct mt_slot),
 				GFP_KERNEL);
 	if (!td->slots) {
-- 
1.7.7.6

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

Thread overview: 27+ 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 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 ` [PATCH 3/5] HID: handle all multitouch devices through hid-multitouch benjamin.tissoires
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:30         ` Henrik Rydberg
2012-03-08 11:48           ` Stéphane Chatty
2012-03-08 12:23             ` Henrik Rydberg
2012-03-08 22:47               ` Stéphane Chatty
2012-03-12 16:18                 ` Jiri Kosina
2012-03-12 15:57         ` Jiri Kosina
     [not found]           ` <alpine.LNX.2.00.1203121650500.18356-ztGlSCb7Y1iN3ZZ/Hiejyg@public.gmane.org>
2012-03-12 17:42             ` Marcel Holtmann
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 16:13                     ` Jiri Kosina
     [not found]                       ` <alpine.LNX.2.00.1203131710120.18356-ztGlSCb7Y1iN3ZZ/Hiejyg@public.gmane.org>
2012-03-13 18:14                         ` Stéphane Chatty
2012-03-16 11:26   ` Jiri Kosina
2012-03-06 16:57 ` benjamin.tissoires [this message]

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-6-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).