All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Éric Piel" <E.A.B.Piel@tudelft.nl>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Henrik Rydberg <rydberg@euromail.se>,
	Chris Bagwell <chris@cnpbagwell.com>,
	"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
	Florian Ragwitz <rafl@debian.org>
Subject: [PATCH 10/10] elantech: don't take into account the border size in the calculations
Date: Mon, 09 Aug 2010 00:55:45 +0200	[thread overview]
Message-ID: <4C5F35F1.5070104@tudelft.nl> (raw)
In-Reply-To: <4C5F34F4.7030503@tudelft.nl>

The min and max of the reported ABS_X/Y are slightly smaller than the
theoretical maximum due to the physical border of the touchpad. However,
in the calculations, the maximum is the theoretical maximum. Otherwise
we can end up sending negative coordinates if the user manages to touch
the very borders. In addition, the incorrect number prevented to align
perfectly the coordinates between 1 and 2 touches.

Signed-off-by: Éric Piel <eric.piel@tremplin-utc.net>
---
 drivers/input/mouse/elantech.c |   20 ++++++++++++++------
 drivers/input/mouse/elantech.h |   26 ++++++++++++--------------
 2 files changed, 26 insertions(+), 20 deletions(-)

diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index ba1c3d8..bf95adf 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -584,22 +584,30 @@ static void elantech_set_input_params(struct psmouse *psmouse)
 			__set_bit(BTN_FORWARD, dev->keybit);
 			__set_bit(BTN_BACK, dev->keybit);
 		}
-		input_set_abs_params(dev, ABS_X, ETP_XMIN_V1, ETP_XMAX_V1, 0, 0);
-		input_set_abs_params(dev, ABS_Y, ETP_YMIN_V1, ETP_YMAX_V1, 0, 0);
+		input_set_abs_params(dev, ABS_X, ETP_XMIN_V1 + ETP_EDGE_FUZZ_V1,
+				     ETP_XMAX_V1 - ETP_EDGE_FUZZ_V1, 0, 0);
+		input_set_abs_params(dev, ABS_Y, ETP_YMIN_V1 + ETP_EDGE_FUZZ_V1,
+				     ETP_YMAX_V1 - ETP_EDGE_FUZZ_V1, 0, 0);
 		break;
 
 	case 2:
 		__set_bit(BTN_TOOL_QUADTAP, dev->keybit);
-		input_set_abs_params(dev, ABS_X, ETP_XMIN_V2, ETP_XMAX_V2, 0, 0);
-		input_set_abs_params(dev, ABS_Y, ETP_YMIN_V2, ETP_YMAX_V2, 0, 0);
+		input_set_abs_params(dev, ABS_X, ETP_XMIN_V2 + ETP_EDGE_FUZZ_V2,
+				     ETP_XMAX_V2 - ETP_EDGE_FUZZ_V2, 0, 0);
+		input_set_abs_params(dev, ABS_Y, ETP_YMIN_V2 + ETP_EDGE_FUZZ_V2,
+				     ETP_YMAX_V2 - ETP_EDGE_FUZZ_V2, 0, 0);
 		if (etd->reports_pres) {
 			input_set_abs_params(dev, ABS_PRESSURE, ETP_PMIN_V2,
 					     ETP_PMAX_V2, 0, 0);
 			input_set_abs_params(dev, ABS_TOOL_WIDTH, ETP_WMIN_V2,
 					     ETP_WMAX_V2, 0, 0);
 		}
-		input_set_abs_params(dev, ABS_MT_POSITION_X, ETP_XMIN_V2, ETP_XMAX_V2, 0, 0);
-		input_set_abs_params(dev, ABS_MT_POSITION_Y, ETP_YMIN_V2, ETP_YMAX_V2, 0, 0);
+		input_set_abs_params(dev, ABS_MT_POSITION_X,
+				     ETP_XMIN_V2 + ETP_EDGE_FUZZ_V2,
+				     ETP_XMAX_V2 - ETP_EDGE_FUZZ_V2, 0, 0);
+		input_set_abs_params(dev, ABS_MT_POSITION_Y,
+				     ETP_YMIN_V2 + ETP_EDGE_FUZZ_V2,
+				     ETP_YMAX_V2 - ETP_EDGE_FUZZ_V2, 0, 0);
 		break;
 	}
 }
diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h
index fa9a6b4..75b0546 100644
--- a/drivers/input/mouse/elantech.h
+++ b/drivers/input/mouse/elantech.h
@@ -60,10 +60,10 @@
  */
 #define ETP_EDGE_FUZZ_V1		32
 
-#define ETP_XMIN_V1			(  0 + ETP_EDGE_FUZZ_V1)
-#define ETP_XMAX_V1			(576 - ETP_EDGE_FUZZ_V1)
-#define ETP_YMIN_V1			(  0 + ETP_EDGE_FUZZ_V1)
-#define ETP_YMAX_V1			(384 - ETP_EDGE_FUZZ_V1)
+#define ETP_XMIN_V1			0
+#define ETP_XMAX_V1			576
+#define ETP_YMIN_V1			0
+#define ETP_YMAX_V1			384
 
 /*
  * It seems the resolution for hardware version 2 doubled.
@@ -72,10 +72,10 @@
  */
 #define ETP_EDGE_FUZZ_V2		8
 
-#define ETP_XMIN_V2			(   0 + ETP_EDGE_FUZZ_V2)
-#define ETP_XMAX_V2			(1152 - ETP_EDGE_FUZZ_V2)
-#define ETP_YMIN_V2			(   0 + ETP_EDGE_FUZZ_V2)
-#define ETP_YMAX_V2			( 768 - ETP_EDGE_FUZZ_V2)
+#define ETP_XMIN_V2			0
+#define ETP_XMAX_V2			1152
+#define ETP_YMIN_V2			0
+#define ETP_YMAX_V2			768
 
 #define ETP_PMIN_V2			0
 #define ETP_PMAX_V2			255
@@ -86,12 +86,10 @@
  * For two finger touches the coordinate of each finger gets reported
  * separately but with reduced resolution.
  */
-#define ETP_2FT_FUZZ			4
-
-#define ETP_2FT_XMIN			(  0 + ETP_2FT_FUZZ)
-#define ETP_2FT_XMAX			(288 - ETP_2FT_FUZZ)
-#define ETP_2FT_YMIN			(  0 + ETP_2FT_FUZZ)
-#define ETP_2FT_YMAX			(192 - ETP_2FT_FUZZ)
+#define ETP_2FT_XMIN			0
+#define ETP_2FT_XMAX			288
+#define ETP_2FT_YMIN			0
+#define ETP_2FT_YMAX			192
 
 struct elantech_data {
 	unsigned char reg_10;
-- 
1.7.2.1

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2010-08-08 22:55 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-21 20:59 [PATCH 0/7] elantech: various improvements for 6-byte protocol Éric Piel
2010-06-21 21:01 ` [PATCH 1/7] elantech: Describe further the protocol Éric Piel
2010-06-21 21:02 ` [PATCH 2/7] [NEEDS TEST] elantech: discard the first 2 positions reports for some firmwares Éric Piel
2010-06-21 21:03 ` [PATCH 3/7] elantech: distinguish various hardware/firmware versions Éric Piel
2010-06-21 21:04 ` [PATCH 4/7] elantech: implement data check for 6-byte protocol Éric Piel
2010-06-21 21:05 ` [PATCH 6/7] elantech: export pressure and width when supported Éric Piel
2010-06-21 21:06 ` [PATCH 7/7] elantech: average the two coordinates when 2 fingers Éric Piel
2010-07-21  3:36   ` Dmitry Torokhov
2010-07-30 18:55     ` Éric Piel
2010-07-30 21:01       ` Henrik Rydberg
2010-07-30 21:41         ` Éric Piel
2010-07-31  9:28           ` Henrik Rydberg
2010-07-31  9:33             ` Dmitry Torokhov
2010-07-31 12:49               ` Henrik Rydberg
2010-07-31 23:00                 ` Éric Piel
2010-08-01  7:52                   ` Henrik Rydberg
2010-07-31 19:56           ` Chris Bagwell
     [not found]         ` <AANLkTi=cEEx-5eQPbRYvMMaECvXKQ+i-e0Eaw_g4JY7=@mail.gmail.com>
2010-07-31 23:04           ` Éric Piel
2010-08-01  9:37             ` Henrik Rydberg
2010-08-01 11:28               ` Éric Piel
2010-08-01 13:57                 ` Henrik Rydberg
2010-08-02  8:17                   ` Éric Piel
2010-08-02 10:02                     ` Henrik Rydberg
2010-08-02 11:12                       ` Éric Piel
2010-08-02 11:22                         ` Henrik Rydberg
2010-08-02 11:33                           ` Éric Piel
2010-08-02 11:46                             ` Henrik Rydberg
2010-08-02 12:13                               ` Éric Piel
2010-08-02 12:29                                 ` Henrik Rydberg
2010-08-02 12:46                                   ` Éric Piel
2010-08-02 13:03                                     ` Henrik Rydberg
2010-08-02 13:23                                       ` Éric Piel
2010-08-02 14:12                                         ` Henrik Rydberg
2010-08-02 16:39                                       ` Dmitry Torokhov
2010-08-02 17:15                                         ` Henrik Rydberg
2010-08-08 22:51                                         ` Éric Piel
2010-08-08 22:52                                           ` [PATCH 07/10] elantech: Report multitouch with proper ABS_MT messages Éric Piel
2010-08-08 22:53                                           ` [PATCH 08/10] elantech: track finger to distinguish coordinates in 2-finger report Éric Piel
2010-08-08 22:54                                           ` [PATCH 09/10] elantech: remove support for proprietary X driver Éric Piel
2010-08-08 22:55                                           ` Éric Piel [this message]
2010-08-02 16:26                           ` [PATCH 7/7] elantech: average the two coordinates when 2 fingers Dmitry Torokhov
2010-08-02 17:05                             ` Henrik Rydberg
2010-08-01  7:36           ` Henrik Rydberg
2010-06-21 21:07 ` [PATCH 5/7] elantech: report position also with 3 fingers Éric Piel
2010-07-21  3:38   ` Dmitry Torokhov
2010-07-30 18:37     ` Éric Piel

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=4C5F35F1.5070104@tudelft.nl \
    --to=e.a.b.piel@tudelft.nl \
    --cc=chris@cnpbagwell.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=rafl@debian.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.