mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Benjamin Tissoires <benjamin.tissoires@enac.fr>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Henrik Rydberg <rydberg@euromail.se>,
	Benjamin Tissoires <benjamin.tissoires@enac.fr>,
	Jiri Kosina <jkosina@suse.cz>,
	Stephane Chatty <chatty@lii-enac.fr>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 3/8] hid-multitouch: cleanup eGalax quirks
Date: Wed, 23 Nov 2011 10:54:29 +0100	[thread overview]
Message-ID: <1322042074-3759-4-git-send-email-benjamin.tissoires@enac.fr> (raw)
In-Reply-To: <1322042074-3759-1-git-send-email-benjamin.tissoires@enac.fr>

The previous implementation of eGalax protocol was not satisfying as
we had to manually set x/y ranges as they were corrupted after reading
the report descriptor.
Indeed, the report descriptor provided a stylus input interface which
override the correct values.

This patch omits this input, thus leaving the correct value untouched,
and the MT_QUIRK_EGALAX_XYZ_FIXUP not required anymore.

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

diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index f41bcea..8250f3c 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -50,7 +50,6 @@ MODULE_LICENSE("GPL");
 #define MT_QUIRK_ALWAYS_VALID		(1 << 4)
 #define MT_QUIRK_VALID_IS_INRANGE	(1 << 5)
 #define MT_QUIRK_VALID_IS_CONFIDENCE	(1 << 6)
-#define MT_QUIRK_EGALAX_XYZ_FIXUP	(1 << 7)
 #define MT_QUIRK_SLOT_IS_CONTACTID_MINUS_ONE	(1 << 8)
 
 struct mt_slot {
@@ -171,8 +170,7 @@ static struct mt_class mt_classes[] = {
 		.maxcontacts = 10 },
 	{ .name = MT_CLS_EGALAX,
 		.quirks =  MT_QUIRK_SLOT_IS_CONTACTID |
-			MT_QUIRK_VALID_IS_INRANGE |
-			MT_QUIRK_EGALAX_XYZ_FIXUP,
+			MT_QUIRK_VALID_IS_INRANGE,
 		.maxcontacts = 2,
 		.sn_move = 4096,
 		.sn_pressure = 32,
@@ -253,7 +251,6 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
 {
 	struct mt_device *td = hid_get_drvdata(hdev);
 	struct mt_class *cls = &td->mtclass;
-	__s32 quirks = cls->quirks;
 
 	/* Only map fields from TouchScreen or TouchPad collections.
          * We need to ignore fields that belong to other collections
@@ -265,13 +262,17 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
 	else
 		return 0;
 
+	/* eGalax devices provide a Digitizer.Stylus input which overrides
+	 * the correct Digitizers.Finger X/Y ranges.
+	 * Let's just ignore this input. */
+	if (field->physical == HID_DG_STYLUS)
+		return -1;
+
 	switch (usage->hid & HID_USAGE_PAGE) {
 
 	case HID_UP_GENDESK:
 		switch (usage->hid) {
 		case HID_GD_X:
-			if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP)
-				field->logical_maximum = 32760;
 			hid_map_usage(hi, usage, bit, max,
 					EV_ABS, ABS_MT_POSITION_X);
 			set_abs(hi->input, ABS_MT_POSITION_X, field,
@@ -284,8 +285,6 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
 			}
 			return 1;
 		case HID_GD_Y:
-			if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP)
-				field->logical_maximum = 32760;
 			hid_map_usage(hi, usage, bit, max,
 					EV_ABS, ABS_MT_POSITION_Y);
 			set_abs(hi->input, ABS_MT_POSITION_Y, field,
@@ -353,8 +352,6 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
 			}
 			return 1;
 		case HID_DG_TIPPRESSURE:
-			if (quirks & MT_QUIRK_EGALAX_XYZ_FIXUP)
-				field->logical_minimum = 0;
 			hid_map_usage(hi, usage, bit, max,
 					EV_ABS, ABS_MT_PRESSURE);
 			set_abs(hi->input, ABS_MT_PRESSURE, field,
-- 
1.7.4.4


  parent reply	other threads:[~2011-11-23 10:02 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-23  9:54 [PATCH 0/8] multitouch updates (mainly eGalax) Benjamin Tissoires
2011-11-23  9:54 ` [PATCH 1/8] HID: hid-multitouch - add another eGalax id Benjamin Tissoires
2011-11-23  9:54 ` [PATCH 2/8] hid-multitouch: create sysfs attribute to control quirks from user-space Benjamin Tissoires
2011-11-23  9:54 ` Benjamin Tissoires [this message]
2011-11-23  9:54 ` [PATCH 4/8] hid-multitouch: remove .maxcontacts field for eGalax Benjamin Tissoires
2011-11-23  9:54 ` [PATCH 5/8] HID: cleanup with eGalax PID definitions Benjamin Tissoires
2011-11-23  9:54 ` [PATCH 6/8] HID-multitouch: Add egalax ID for Acer Iconia W500 Benjamin Tissoires
2011-11-23 10:46   ` Marek Vasut
2011-11-23 11:32     ` Benjamin Tissoires
2011-11-23 11:28   ` Jiri Kosina
2011-11-23 11:36     ` Benjamin Tissoires
2011-11-23 12:10       ` Marek Vasut
2011-11-23  9:54 ` [PATCH 7/8] hid-multitouch: add support for the MSI Windpad 110W Benjamin Tissoires
2011-11-23  9:54 ` [PATCH 8/8] hid-multitouch: correct eGalax a001 protocol Benjamin Tissoires
2011-11-23 18:20   ` Chris Bagwell
2011-11-23 12:49 ` [PATCH 0/8] multitouch updates (mainly eGalax) Jiri Kosina
2011-11-23 13:14   ` Benjamin Tissoires
2011-11-29  8:56 ` Henrik Rydberg

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=1322042074-3759-4-git-send-email-benjamin.tissoires@enac.fr \
    --to=benjamin.tissoires@enac.fr \
    --cc=chatty@lii-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

all inboxes | Powered by JetHome®