From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Andrew Duggan <aduggan@synaptics.com>,
Hans de Goede <hdegoede@redhat.com>,
Peter Hutterer <peter.hutterer@who-t.net>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 2/7] Input: synaptics - handle spurious release of trackstick buttons
Date: Fri, 6 Feb 2015 15:04:30 -0500 [thread overview]
Message-ID: <1423253075-23469-3-git-send-email-benjamin.tissoires@redhat.com> (raw)
In-Reply-To: <1423253075-23469-1-git-send-email-benjamin.tissoires@redhat.com>
The Fimware 8.1 has a bug in which the extra buttons are only sent
when the ExtBit is 1.
This should be fixed in a future FW update which should have a bump
of the minor version.
Cc: stable@vger.kernel.org
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
v2:
- break out extra buttons reporting in its own function
- use firmware version to remove the spurious releases
drivers/input/mouse/synaptics.c | 33 +++++++++++++++++++++++++--------
1 file changed, 25 insertions(+), 8 deletions(-)
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 3bd7032..a033fc7 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -815,14 +815,36 @@ static void synaptics_report_semi_mt_data(struct input_dev *dev,
}
}
-static void synaptics_report_buttons(struct psmouse *psmouse,
- const struct synaptics_hw_state *hw)
+static void synaptics_report_ext_buttons(struct psmouse *psmouse,
+ const struct synaptics_hw_state *hw)
{
struct input_dev *dev = psmouse->dev;
struct synaptics_data *priv = psmouse->private;
int ext_bits = (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) + 1) >> 1;
int i;
+ if (!SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap))
+ return;
+
+ /* bug in FW 8.1, buttons are reported only when ExtBit is 1 */
+ if ((SYN_ID_FULL(priv->identity) == 0x801) &&
+ !((psmouse->packet[0] ^ psmouse->packet[3]) & 0x02))
+ return;
+
+ for (i = 0; i < ext_bits; i++) {
+ input_report_key(dev, BTN_0 + 2 * i,
+ hw->ext_buttons & (1 << i));
+ input_report_key(dev, BTN_1 + 2 * i,
+ hw->ext_buttons & (1 << (i + ext_bits)));
+ }
+}
+
+static void synaptics_report_buttons(struct psmouse *psmouse,
+ const struct synaptics_hw_state *hw)
+{
+ struct input_dev *dev = psmouse->dev;
+ struct synaptics_data *priv = psmouse->private;
+
input_report_key(dev, BTN_LEFT, hw->left);
input_report_key(dev, BTN_RIGHT, hw->right);
@@ -834,12 +856,7 @@ static void synaptics_report_buttons(struct psmouse *psmouse,
input_report_key(dev, BTN_BACK, hw->down);
}
- for (i = 0; i < ext_bits; i++) {
- input_report_key(dev, BTN_0 + 2 * i,
- hw->ext_buttons & (1 << i));
- input_report_key(dev, BTN_1 + 2 * i,
- hw->ext_buttons & (1 << (i + ext_bits)));
- }
+ synaptics_report_ext_buttons(psmouse, hw);
}
static void synaptics_report_mt_data(struct psmouse *psmouse,
--
2.1.0
next prev parent reply other threads:[~2015-02-06 20:04 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-06 20:04 [PATCH v2 0/7] New Lenovos 2015 touchpads: party time! Benjamin Tissoires
2015-02-06 20:04 ` [PATCH v2 1/7] Input: synaptics - fix middle button on Lenovo 2015 products Benjamin Tissoires
2015-02-06 20:04 ` Benjamin Tissoires [this message]
2015-02-06 20:04 ` [PATCH v2 3/7] Input: synaptics - do not retrieve the board id on old firmwares Benjamin Tissoires
2015-02-06 20:04 ` [PATCH v2 4/7] Input: synaptics - retrieve the extended capabilities in query $10 Benjamin Tissoires
2015-02-06 20:04 ` [PATCH v2 5/7] Input: synaptics - remove TOPBUTTONPAD property for Lenovos 2015 Benjamin Tissoires
2015-02-06 20:04 ` [PATCH v2 6/7] Input: synaptics - re-route tracksticks buttons on the Lenovo 2015 series Benjamin Tissoires
2015-03-09 6:45 ` Dmitry Torokhov
2015-02-06 20:04 ` [PATCH v2 7/7] Input: synaptics - Remove X1 Carbon 3rd gen from the topbuttonpad list Benjamin Tissoires
2015-02-17 3:23 ` [PATCH v2 0/7] New Lenovos 2015 touchpads: party time! Benjamin Tissoires
2015-02-25 14:36 ` Benjamin Tissoires
2015-02-25 14:58 ` Hans de Goede
2015-03-09 6:46 ` Dmitry Torokhov
2015-03-09 8:24 ` Hans de Goede
2015-03-09 19:36 ` Benjamin Tissoires
2015-03-10 6:17 ` Steven Noonan
2015-03-10 7:23 ` Hans de Goede
2015-03-10 18:35 ` Steven Noonan
2015-03-16 14:46 ` Benjamin Tissoires
2015-03-19 14:24 ` Yves-Alexis Perez
2015-03-19 14:46 ` Benjamin Tissoires
2015-03-19 15:25 ` Yves-Alexis Perez
2015-03-19 15:58 ` Benjamin Tissoires
2015-03-19 16:47 ` Yves-Alexis Perez
2015-03-19 17:06 ` Benjamin Tissoires
2015-03-19 17:43 ` Dmitry Torokhov
2015-03-19 18:29 ` Benjamin Tissoires
2015-03-20 13:59 ` Yves-Alexis Perez
2015-04-09 12:59 ` Yves-Alexis Perez
2015-04-09 13:56 ` Benjamin Tissoires
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=1423253075-23469-3-git-send-email-benjamin.tissoires@redhat.com \
--to=benjamin.tissoires@redhat.com \
--cc=aduggan@synaptics.com \
--cc=dmitry.torokhov@gmail.com \
--cc=hdegoede@redhat.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peter.hutterer@who-t.net \
/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).