From: Hans de Goede <hdegoede@redhat.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Yunkang Tang <yunkang.tang@cn.alps.com>,
linux-input@vger.kernel.org, Hans de Goede <hdegoede@redhat.com>
Subject: [PATCH 02/14] alps: Always report 2 fingers (or more) when receiving mt data on v3 models
Date: Wed, 9 Jul 2014 17:24:07 +0200 [thread overview]
Message-ID: <1404919459-23561-3-git-send-email-hdegoede@redhat.com> (raw)
In-Reply-To: <1404919459-23561-1-git-send-email-hdegoede@redhat.com>
V3 models only report mt bitmap data when there are 2 or more fingers on
the touchpad. So always generate 2 positions in alps_process_bitmap, and
for v3 models only fall back to st data when there was no mt data in a
mt packet (which should never happen).
This fixes 2 finger scrolling not working when using 2 fingers close to
each other.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/input/mouse/alps.c | 60 +++++++++++++++++++---------------------------
1 file changed, 24 insertions(+), 36 deletions(-)
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 0448331..b69205e 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -407,23 +407,20 @@ static int alps_process_bitmap(struct alps_data *priv,
fingers = max(fingers_x, fingers_y);
/*
- * If total fingers is > 1 but either axis reports only a single
- * contact, we have overlapping or adjacent fingers. For the
- * purposes of creating a bounding box, divide the single contact
- * (roughly) equally between the two points.
+ * If an axis reports only a single contact, we have overlapping or
+ * adjacent fingers. Divide the single contact between the two points.
*/
- if (fingers > 1) {
- if (fingers_x == 1) {
- i = x_low.num_bits / 2;
- x_low.num_bits = x_low.num_bits - i;
- x_high.start_bit = x_low.start_bit + i;
- x_high.num_bits = max(i, 1);
- } else if (fingers_y == 1) {
- i = y_low.num_bits / 2;
- y_low.num_bits = y_low.num_bits - i;
- y_high.start_bit = y_low.start_bit + i;
- y_high.num_bits = max(i, 1);
- }
+ if (fingers_x == 1) {
+ i = x_low.num_bits / 2;
+ x_low.num_bits = x_low.num_bits - i;
+ x_high.start_bit = x_low.start_bit + i;
+ x_high.num_bits = max(i, 1);
+ }
+ if (fingers_y == 1) {
+ i = y_low.num_bits / 2;
+ y_low.num_bits = y_low.num_bits - i;
+ y_high.start_bit = y_low.start_bit + i;
+ y_high.num_bits = max(i, 1);
}
*x1 = (priv->x_max * (2 * x_low.start_bit + x_low.num_bits - 1)) /
@@ -431,14 +428,12 @@ static int alps_process_bitmap(struct alps_data *priv,
*y1 = (priv->y_max * (2 * y_low.start_bit + y_low.num_bits - 1)) /
(2 * (priv->y_bits - 1));
- if (fingers > 1) {
- *x2 = (priv->x_max *
- (2 * x_high.start_bit + x_high.num_bits - 1)) /
- (2 * (priv->x_bits - 1));
- *y2 = (priv->y_max *
- (2 * y_high.start_bit + y_high.num_bits - 1)) /
- (2 * (priv->y_bits - 1));
- }
+ *x2 = (priv->x_max *
+ (2 * x_high.start_bit + x_high.num_bits - 1)) /
+ (2 * (priv->x_bits - 1));
+ *y2 = (priv->y_max *
+ (2 * y_high.start_bit + y_high.num_bits - 1)) /
+ (2 * (priv->y_bits - 1));
return fingers;
}
@@ -607,8 +602,7 @@ static void alps_process_touchpad_packet_v3_v5(struct psmouse *psmouse)
unsigned char *packet = psmouse->packet;
struct input_dev *dev = psmouse->dev;
struct input_dev *dev2 = priv->dev2;
- int x1 = 0, y1 = 0, x2 = 0, y2 = 0;
- int fingers = 0, bmap_fn;
+ int x1 = 0, y1 = 0, x2 = 0, y2 = 0, fingers = 0;
struct alps_fields f = {0};
priv->decode_fields(&f, packet, psmouse);
@@ -629,16 +623,10 @@ static void alps_process_touchpad_packet_v3_v5(struct psmouse *psmouse)
if (f.is_mp) {
fingers = f.fingers;
if (priv->proto_version == ALPS_PROTO_V3) {
- bmap_fn = alps_process_bitmap(priv, f.x_map,
- f.y_map, &x1, &y1,
- &x2, &y2);
-
- /*
- * We shouldn't report more than one finger if
- * we don't have two coordinates.
- */
- if (fingers > 1 && bmap_fn < 2)
- fingers = bmap_fn;
+ if (alps_process_bitmap(priv, f.x_map,
+ f.y_map, &x1, &y1,
+ &x2, &y2) == 0)
+ fingers = 0; /* Use st data */
/* Now process position packet */
priv->decode_fields(&f, priv->multi_data,
--
2.0.0
next prev parent reply other threads:[~2014-07-09 15:24 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-09 15:24 [PATCH 00/14] alps: bugfixes, cleanups and new hardware support Hans de Goede
2014-07-09 15:24 ` [PATCH 01/14] alps: Fix rushmore packet decoding Hans de Goede
2014-07-09 15:24 ` Hans de Goede [this message]
2014-07-09 15:24 ` [PATCH 03/14] alps: process_bitmap: Don't invert the Y-axis on Rushmore Hans de Goede
2014-07-09 15:24 ` [PATCH 04/14] alps: process_bitmap: Add alps_get_bitmap_points() helper function Hans de Goede
2014-07-09 15:24 ` [PATCH 05/14] alps: process_bitmap: Fix counting of high point bits Hans de Goede
2014-07-09 15:24 ` [PATCH 06/14] alps: process_bitmap: Round down when spreading adjescent fingers over 2 points Hans de Goede
2014-07-09 15:24 ` [PATCH 07/14] alps: Use struct input_mt_pos to track coordinates Hans de Goede
2014-07-09 15:24 ` [PATCH 08/14] alps: Use input_mt_assign_slots && input_mt_sync_frame instead of DIY Hans de Goede
2014-07-09 15:24 ` [PATCH 09/14] alps: Use single touch data when v3 mt data contains only one finger Hans de Goede
2014-07-09 15:24 ` [PATCH 10/14] alps: Add an alps_report_semi_mt_data function Hans de Goede
2014-07-09 15:24 ` [PATCH 11/14] alps: Report 2 touches when we've > 2 fingers Hans de Goede
2014-07-09 15:24 ` [PATCH 12/14] alps: Change decode function prototype to return an int Hans de Goede
2014-07-09 15:24 ` [PATCH 13/14] alps: Cache firmware version Hans de Goede
2014-07-09 15:24 ` [PATCH 14/14] alps: Add support for v7 devices Hans de Goede
2014-07-26 5:58 ` Dmitry Torokhov
2014-07-26 8:22 ` Hans de Goede
2014-07-26 5:59 ` [PATCH 00/14] alps: bugfixes, cleanups and new hardware support 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=1404919459-23561-3-git-send-email-hdegoede@redhat.com \
--to=hdegoede@redhat.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=yunkang.tang@cn.alps.com \
/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).