From: Jeremy Huddleston <jeremyhu@freedesktop.org>
To: linux-input@vger.kernel.org
Subject: [PATCH] appletouch: Improved finger detection
Date: Tue, 5 May 2009 12:10:34 -0700 [thread overview]
Message-ID: <3AC3E247-D85C-4D8A-A73B-34677C32C2D5@freedesktop.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 1077 bytes --]
The appletouch driver is prone to reporting multiple fingers when only
one is
pressing. The appletouch driver queries an array of pressure sensors
and
counts local maxima in pressure to determine the number of fingers.
It just
does this on the raw values, so a data stream like:
0 100 250 300 299 300 250 100 0
actually registers as 2 fingers.
This patch updates the logic to ignore small dips in pressure that are
less
than the threshold.
Signed-off-by: Jeremy Huddleston <jeremyhu@freedesktop.org>
diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/
appletouch.c
index 454b961..9bb42f6 100644
--- a/drivers/input/mouse/appletouch.c
+++ b/drivers/input/mouse/appletouch.c
@@ -349,7 +349,7 @@ static int atp_calculate_abs(int *xy_sensors, int
nb_sensors, int fact,
(!is_increasing && xy_sensors[i - 1] < xy_sensors[i])) {
(*fingers)++;
is_increasing = 1;
- } else if (i > 0 && xy_sensors[i - 1] >= xy_sensors[i]) {
+ } else if (i > 0 && (xy_sensors[i - 1] - xy_sensors[i] >
threshold)) {
is_increasing = 0;
}
[-- Attachment #2: appletouch.patch --]
[-- Type: application/octet-stream, Size: 1058 bytes --]
The appletouch driver is prone to reporting multiple fingers when only one is
pressing. The appletouch driver queries an array of pressure sensors and
counts local maxima in pressure to determine the number of fingers. It just
does this on the raw values, so a data stream like:
0 100 250 300 299 300 250 100 0
actually registers as 2 fingers.
This patch updates the logic to ignore small dips in pressure that are less
than the threshold.
Signed off by: Jeremy Huddleston <jeremyhu@freedesktop.org>
diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
index 454b961..9bb42f6 100644
--- a/drivers/input/mouse/appletouch.c
+++ b/drivers/input/mouse/appletouch.c
@@ -349,7 +349,7 @@ static int atp_calculate_abs(int *xy_sensors, int nb_sensors, int fact,
(!is_increasing && xy_sensors[i - 1] < xy_sensors[i])) {
(*fingers)++;
is_increasing = 1;
- } else if (i > 0 && xy_sensors[i - 1] >= xy_sensors[i]) {
+ } else if (i > 0 && (xy_sensors[i - 1] - xy_sensors[i] > threshold)) {
is_increasing = 0;
}
[-- Attachment #3: Type: text/plain, Size: 1 bytes --]
next reply other threads:[~2009-05-05 19:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-05 19:10 Jeremy Huddleston [this message]
2009-05-08 2:59 ` [PATCH] appletouch: Improved finger detection Dmitry Torokhov
2009-05-08 6:13 ` Jeremy Huddleston
2009-06-01 7:35 ` Jeremy Huddleston
2009-06-02 11:29 ` Dmitry Torokhov
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=3AC3E247-D85C-4D8A-A73B-34677C32C2D5@freedesktop.org \
--to=jeremyhu@freedesktop.org \
--cc=linux-input@vger.kernel.org \
/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).