From: Clinton Sprain <clintonsprain@gmail.com>
To: linux-input@vger.kernel.org
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Henrik Rydberg <rydberg@euromail.se>
Subject: [PATCH v4 3/3] input: appletouch: fix jumps when additional fingers are detected
Date: Wed, 12 Mar 2014 18:17:50 -0500 [thread overview]
Message-ID: <5320EB1E.3020302@gmail.com> (raw)
In-Reply-To: <5320EA03.2040206@gmail.com>
input: appletouch: fix jumps when additional fingers are detected
Addresses issues related to when a second finger enters or leaves the field,
causing the cursor to jump or the page to scroll unexpectedly; now, we
discard any movement change that happens at the exact moment we detect a
change in the number of fingers touching the trackpad. This doesn't
completely resolve the issue but does greatly mitigate it.
Signed-off-by: Clinton Sprain <clintonsprain@gmail.com>
---
drivers/input/mouse/appletouch.c | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
index e00f126..5140293 100644
--- a/drivers/input/mouse/appletouch.c
+++ b/drivers/input/mouse/appletouch.c
@@ -206,6 +206,7 @@ struct atp {
bool valid; /* are the samples valid? */
bool size_detect_done;
bool overflow_warned;
+ int fingers_old; /* last reported finger count */
int x_old; /* last reported x/y, */
int y_old; /* used for smoothing */
signed char xy_cur[ATP_XSENSORS + ATP_YSENSORS];
@@ -508,7 +509,7 @@ static void atp_complete_geyser_1_2(struct urb *urb)
{
int x, y, x_z, y_z, x_f, y_f;
int retval, i, j;
- int key;
+ int key, fingers;
struct atp *dev = urb->context;
int status = atp_status_check(urb);
@@ -591,7 +592,9 @@ static void atp_complete_geyser_1_2(struct urb *urb)
dev->info->yfact, &y_z, &y_f);
key = dev->data[dev->info->datalen - 1] & ATP_STATUS_BUTTON;
- if (x && y) {
+ fingers = max(x_f, y_f);
+
+ if (x && y && (fingers == dev->fingers_old)) {
if (dev->x_old != -1) {
x = (dev->x_old * 7 + x) >> 3;
y = (dev->y_old * 7 + y) >> 3;
@@ -608,7 +611,7 @@ static void atp_complete_geyser_1_2(struct urb *urb)
input_report_abs(dev->input, ABS_Y, y);
input_report_abs(dev->input, ABS_PRESSURE,
min(ATP_PRESSURE, x_z + y_z));
- atp_report_fingers(dev->input, max(x_f, y_f));
+ atp_report_fingers(dev->input, fingers);
}
dev->x_old = x;
dev->y_old = y;
@@ -616,6 +619,7 @@ static void atp_complete_geyser_1_2(struct urb *urb)
} else if (!x && !y) {
dev->x_old = dev->y_old = -1;
+ dev->fingers_old = 0;
input_report_key(dev->input, BTN_TOUCH, 0);
input_report_abs(dev->input, ABS_PRESSURE, 0);
atp_report_fingers(dev->input, 0);
@@ -624,6 +628,10 @@ static void atp_complete_geyser_1_2(struct urb *urb)
memset(dev->xy_acc, 0, sizeof(dev->xy_acc));
}
+ if (fingers != dev->fingers_old)
+ dev->x_old = dev->y_old = -1;
+ dev->fingers_old = fingers;
+
input_report_key(dev->input, BTN_LEFT, key);
input_sync(dev->input);
@@ -641,7 +649,7 @@ static void atp_complete_geyser_3_4(struct urb *urb)
{
int x, y, x_z, y_z, x_f, y_f;
int retval, i, j;
- int key;
+ int key, fingers;
struct atp *dev = urb->context;
int status = atp_status_check(urb);
@@ -703,7 +711,9 @@ static void atp_complete_geyser_3_4(struct urb *urb)
dev->info->yfact, &y_z, &y_f);
key = dev->data[dev->info->datalen - 1] & ATP_STATUS_BUTTON;
- if (x && y) {
+ fingers = max(x_f, y_f);
+
+ if (x && y && (fingers == dev->fingers_old)) {
if (dev->x_old != -1) {
x = (dev->x_old * 7 + x) >> 3;
y = (dev->y_old * 7 + y) >> 3;
@@ -720,7 +730,7 @@ static void atp_complete_geyser_3_4(struct urb *urb)
input_report_abs(dev->input, ABS_Y, y);
input_report_abs(dev->input, ABS_PRESSURE,
min(ATP_PRESSURE, x_z + y_z));
- atp_report_fingers(dev->input, max(x_f, y_f));
+ atp_report_fingers(dev->input, fingers);
}
dev->x_old = x;
dev->y_old = y;
@@ -728,6 +738,7 @@ static void atp_complete_geyser_3_4(struct urb *urb)
} else if (!x && !y) {
dev->x_old = dev->y_old = -1;
+ dev->fingers_old = 0;
input_report_key(dev->input, BTN_TOUCH, 0);
input_report_abs(dev->input, ABS_PRESSURE, 0);
atp_report_fingers(dev->input, 0);
@@ -736,6 +747,10 @@ static void atp_complete_geyser_3_4(struct urb *urb)
memset(dev->xy_acc, 0, sizeof(dev->xy_acc));
}
+ if (fingers != dev->fingers_old)
+ dev->x_old = dev->y_old = -1;
+ dev->fingers_old = fingers;
+
input_report_key(dev->input, BTN_LEFT, key);
input_sync(dev->input);
--
1.7.9.5
next prev parent reply other threads:[~2014-03-12 23:18 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-18 1:52 [PATCH 0/3] input: appletouch: fixes for jagged/uneven cursor movement Clinton Sprain
2014-01-18 1:55 ` [PATCH 1/3] input: appletouch: parametrize and set saner defaults for fuzz and threshold Clinton Sprain
2014-01-18 7:07 ` Henrik Rydberg
2014-01-18 1:56 ` [PATCH 2/3] input: appletouch: use better cursor movement smoothing algorithm Clinton Sprain
2014-01-18 1:58 ` [PATCH 3/3] input: appletouch: fix jumps when additional fingers are detected Clinton Sprain
2014-02-07 0:38 ` [PATCH v2 0/3] input: appletouch: fixes for jagged/uneven cursor movement Clinton Sprain
2014-02-07 0:40 ` [PATCH v2 1/3] input: appletouch: parametrize and set saner defaults for fuzz and threshold Clinton Sprain
2014-02-09 12:01 ` Henrik Rydberg
2014-02-11 4:46 ` Clinton Sprain
2014-02-07 0:43 ` [PATCH v2 2/3] input: appletouch: use better cursor movement smoothing algorithm Clinton Sprain
2014-02-09 12:15 ` Henrik Rydberg
2014-02-11 7:19 ` Clinton Sprain
2014-02-07 0:46 ` [PATCH v2 3/3] input: appletouch: fix jumps when additional fingers are detected Clinton Sprain
2014-02-09 12:16 ` Henrik Rydberg
2014-03-09 6:03 ` [PATCH v3 0/3] input: appletouch: fixes for jagged/uneven cursor movement Clinton Sprain
2014-03-09 6:05 ` [PATCH v3 1/3] input: appletouch: dial back fuzz setting Clinton Sprain
2014-03-09 6:17 ` [PATCH v3 2/3] input: appletouch: implement sensor data smoothing Clinton Sprain
2014-03-09 13:54 ` Henrik Rydberg
2014-03-09 15:03 ` Clinton Sprain
2014-03-09 6:19 ` [PATCH v3 3/3] input: appletouch: fix jumps when additional fingers are detected Clinton Sprain
2014-03-12 23:13 ` [PATCH v4 0/3] input: appletouch: fixes for jagged/uneven cursor movement Clinton Sprain
2014-03-12 23:14 ` [PATCH v4 1/3] input: appletouch: dial back fuzz setting Clinton Sprain
2014-03-12 23:16 ` [PATCH v4 2/3] input: appletouch: implement sensor data smoothing Clinton Sprain
2014-03-23 13:59 ` Henrik Rydberg
2014-03-27 18:26 ` Dmitry Torokhov
2014-03-29 21:47 ` [PATCH v5 " Clinton Sprain
2014-03-29 21:48 ` [PATCH v5 3/3] input: appletouch: fix jumps when additional fingers are detected Clinton Sprain
2014-03-12 23:17 ` Clinton Sprain [this message]
2014-03-23 13:34 ` [PATCH v4 0/3] input: appletouch: fixes for jagged/uneven cursor movement Clinton Sprain
2014-03-23 14:02 ` 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=5320EB1E.3020302@gmail.com \
--to=clintonsprain@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@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.