Commit 6364f9a0 authored by Benjamin Tissoires's avatar Benjamin Tissoires Committed by Luis Henriques

Input: synaptics - handle spurious release of trackstick buttons

commit ebc80840 upstream.

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.
Signed-off-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent 8b47a356
...@@ -818,14 +818,36 @@ static void synaptics_report_semi_mt_data(struct input_dev *dev, ...@@ -818,14 +818,36 @@ static void synaptics_report_semi_mt_data(struct input_dev *dev,
} }
} }
static void synaptics_report_buttons(struct psmouse *psmouse, static void synaptics_report_ext_buttons(struct psmouse *psmouse,
const struct synaptics_hw_state *hw) const struct synaptics_hw_state *hw)
{ {
struct input_dev *dev = psmouse->dev; struct input_dev *dev = psmouse->dev;
struct synaptics_data *priv = psmouse->private; struct synaptics_data *priv = psmouse->private;
int ext_bits = (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) + 1) >> 1; int ext_bits = (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) + 1) >> 1;
int i; 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_LEFT, hw->left);
input_report_key(dev, BTN_RIGHT, hw->right); input_report_key(dev, BTN_RIGHT, hw->right);
...@@ -837,12 +859,7 @@ static void synaptics_report_buttons(struct psmouse *psmouse, ...@@ -837,12 +859,7 @@ static void synaptics_report_buttons(struct psmouse *psmouse,
input_report_key(dev, BTN_BACK, hw->down); input_report_key(dev, BTN_BACK, hw->down);
} }
for (i = 0; i < ext_bits; i++) { synaptics_report_ext_buttons(psmouse, hw);
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_slot(struct input_dev *dev, int slot, static void synaptics_report_slot(struct input_dev *dev, int slot,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment