All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Input: ALPS - Fix TrackStick support for SS5 hardware
@ 2016-10-24 21:01 Paul Donohue
  2016-11-01  9:35 ` Pali Rohár
                   ` (2 more replies)
  0 siblings, 3 replies; 36+ messages in thread
From: Paul Donohue @ 2016-10-24 21:01 UTC (permalink / raw)
  To: linux-input; +Cc: Ben Gamari, Pali Rohár, Michal Hocko

The current Alps SS5 (SS4 v2) code generates bogus TouchPad events when 
TrackStick packets are processed.

This causes the xorg synaptics driver to print 
"unable to find touch point 0" and 
"BUG: triggered 'if (priv->num_active_touches > priv->num_slots)'" 
messages.  It also causes unexpected TouchPad button release and reclick 
event sequences if the TrackStick is moved while holding a TouchPad 
button.

This commit corrects the problem by setting a flag for the relevant 
packet type in alps_decode_ss4_v2(), then using that flag in 
alps_process_packet_ss4_v2() to send only TrackStick reports when 
processing TrackStick packets.

Signed-off-by: Paul Donohue <linux-kernel@PaulSD.com>

diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 6d7de9b..2c2e55b 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -1279,6 +1279,8 @@ static int alps_decode_ss4_v2(struct alps_fields *f,
                        input_report_rel(priv->dev2, REL_Y, -y);
                        input_report_abs(priv->dev2, ABS_PRESSURE, pressure);
                }
+               f->first_mp = 0;
+               f->is_mp = 0;
                break;
 
        case SS4_PACKET_ID_IDLE:
@@ -1289,12 +1291,14 @@ static int alps_decode_ss4_v2(struct alps_fields *f,
 
        /* handle buttons */
        if (pkt_id == SS4_PACKET_ID_STICK) {
+               f->is_ts = 1;
                f->ts_left = !!(SS4_BTN_V2(p) & 0x01);
                if (!(priv->flags & ALPS_BUTTONPAD)) {
                        f->ts_right = !!(SS4_BTN_V2(p) & 0x02);
                        f->ts_middle = !!(SS4_BTN_V2(p) & 0x04);
                }
        } else {
+               f->is_ts = 0;
                f->left = !!(SS4_BTN_V2(p) & 0x01);
                if (!(priv->flags & ALPS_BUTTONPAD)) {
                        f->right = !!(SS4_BTN_V2(p) & 0x02);
@@ -1346,18 +1350,18 @@ static void alps_process_packet_ss4_v2(struct psmouse *psmouse)
 
        priv->multi_packet = 0;
 
-       alps_report_mt_data(psmouse, (f->fingers <= 4) ? f->fingers : 4);
-
-       input_mt_report_finger_count(dev, f->fingers);
+       if (!f->is_ts) {
+               alps_report_mt_data(psmouse, (f->fingers <= 4) ? f->fingers : 4);
 
-       input_report_key(dev, BTN_LEFT, f->left);
-       input_report_key(dev, BTN_RIGHT, f->right);
-       input_report_key(dev, BTN_MIDDLE, f->middle);
+               input_mt_report_finger_count(dev, f->fingers);
 
-       input_report_abs(dev, ABS_PRESSURE, f->pressure);
-       input_sync(dev);
+               input_report_key(dev, BTN_LEFT, f->left);
+               input_report_key(dev, BTN_RIGHT, f->right);
+               input_report_key(dev, BTN_MIDDLE, f->middle);
 
-       if (priv->flags & ALPS_DUALPOINT) {
+               input_report_abs(dev, ABS_PRESSURE, f->pressure);
+               input_sync(dev);
+       } else {
                input_report_key(dev2, BTN_LEFT, f->ts_left);
                input_report_key(dev2, BTN_RIGHT, f->ts_right);
                input_report_key(dev2, BTN_MIDDLE, f->ts_middle);
diff --git a/drivers/input/mouse/alps.h b/drivers/input/mouse/alps.h
index b9417e2..1dc09b5 100644
--- a/drivers/input/mouse/alps.h
+++ b/drivers/input/mouse/alps.h
@@ -192,6 +192,7 @@ struct alps_bitmap_point {
  * @left: Left touchpad button is active.
  * @right: Right touchpad button is active.
  * @middle: Middle touchpad button is active.
+ * @is_ts: Packet is for the trackstick, not the touchpad.
  * @ts_left: Left trackstick button is active.
  * @ts_right: Right trackstick button is active.
  * @ts_middle: Middle trackstick button is active.
@@ -212,6 +213,7 @@ struct alps_fields {
        unsigned int right:1;
        unsigned int middle:1;
 
+       unsigned int is_ts:1;
        unsigned int ts_left:1;
        unsigned int ts_right:1;
        unsigned int ts_middle:1;


^ permalink raw reply related	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2016-11-24 14:26 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-24 21:01 [PATCH] Input: ALPS - Fix TrackStick support for SS5 hardware Paul Donohue
2016-11-01  9:35 ` Pali Rohár
2016-11-05 16:30   ` Paul Donohue
2016-11-05 16:44     ` [PATCH v2] " Paul Donohue
2016-11-06 19:59       ` Pali Rohár
2016-11-08 14:24         ` Paul Donohue
2016-11-06 19:57     ` [PATCH] " Pali Rohár
2016-11-08 14:54 ` [PATCH v3 1/3] " Paul Donohue
2016-11-08 14:59   ` [PATCH v3 2/3] " Paul Donohue
2016-11-08 15:06     ` Paul Donohue
2016-11-08 15:14 ` [PATCH v4 1/3] " Paul Donohue
2016-11-08 15:16   ` [PATCH v4 2/3] Input: ALPS - Clean up TrackStick handling " Paul Donohue
2016-11-08 15:17     ` [PATCH v4 3/3] Input: ALPS - Clean up code " Paul Donohue
2016-11-08 15:46       ` Paul Donohue
2016-11-08 15:49         ` Paul Donohue
2016-11-09 12:14     ` [PATCH v4 2/3] Input: ALPS - Clean up TrackStick handling " Pali Rohár
2016-11-10 14:27       ` Paul Donohue
2016-11-10 15:19         ` Pali Rohár
2016-11-10 16:44           ` [PATCH v5 0/3] Input: ALPS - Bug fix and cleanup " Paul Donohue
2016-11-10 16:44             ` [PATCH v5 1/3] Input: ALPS - Fix TrackStick support " Paul Donohue
2016-11-10 16:44             ` [PATCH v5 2/3] Input: ALPS - Clean up TrackStick handling " Paul Donohue
2016-11-10 16:44             ` [PATCH v5 3/3] Input: ALPS - Clean up code " Paul Donohue
2016-11-11 13:59             ` [PATCH v5 0/3] Input: ALPS - Bug fix and cleanup " Pali Rohár
2016-11-12  0:56               ` Dmitry Torokhov
2016-11-12  1:03                 ` Pali Rohár
2016-11-12  1:06                   ` Dmitry Torokhov
2016-11-12 12:29                     ` Pali Rohár
2016-11-13  6:43                       ` Dmitry Torokhov
2016-11-13 10:31                         ` Pali Rohár
2016-11-13 15:28                           ` Paul Donohue
2016-11-24 14:25               ` [PATCH v6 " Paul Donohue
2016-11-24 14:25                 ` [PATCH v6 1/3] Input: ALPS - Fix TrackStick support " Paul Donohue
2016-11-24 14:25                 ` [PATCH v6 2/3] Input: ALPS - Clean up TrackStick handling " Paul Donohue
2016-11-24 14:25                 ` [PATCH v6 3/3] Input: ALPS - Clean up code " Paul Donohue
2016-11-09 12:12   ` [PATCH v4 1/3] Input: ALPS - Fix TrackStick support " Pali Rohár
2016-11-10 14:17     ` Paul Donohue

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.