Skip to content

Commit 4258604

Browse files
bentisssashalevin
authored andcommitted
Input: synaptics - handle spurious release of trackstick buttons
[ Upstream commit ebc8084 ] 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> Acked-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
1 parent 376cfea commit 4258604

1 file changed

Lines changed: 25 additions & 8 deletions

File tree

‎drivers/input/mouse/synaptics.c‎

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -820,14 +820,36 @@ static void synaptics_report_semi_mt_data(struct input_dev *dev,
820820
}
821821
}
822822

823-
static void synaptics_report_buttons(struct psmouse *psmouse,
824-
const struct synaptics_hw_state *hw)
823+
static void synaptics_report_ext_buttons(struct psmouse *psmouse,
824+
const struct synaptics_hw_state *hw)
825825
{
826826
struct input_dev *dev = psmouse->dev;
827827
struct synaptics_data *priv = psmouse->private;
828828
int ext_bits = (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) + 1) >> 1;
829829
int i;
830830

831+
if (!SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap))
832+
return;
833+
834+
/* Bug in FW 8.1, buttons are reported only when ExtBit is 1 */
835+
if (SYN_ID_FULL(priv->identity) == 0x801 &&
836+
!((psmouse->packet[0] ^ psmouse->packet[3]) & 0x02))
837+
return;
838+
839+
for (i = 0; i < ext_bits; i++) {
840+
input_report_key(dev, BTN_0 + 2 * i,
841+
hw->ext_buttons & (1 << i));
842+
input_report_key(dev, BTN_1 + 2 * i,
843+
hw->ext_buttons & (1 << (i + ext_bits)));
844+
}
845+
}
846+
847+
static void synaptics_report_buttons(struct psmouse *psmouse,
848+
const struct synaptics_hw_state *hw)
849+
{
850+
struct input_dev *dev = psmouse->dev;
851+
struct synaptics_data *priv = psmouse->private;
852+
831853
input_report_key(dev, BTN_LEFT, hw->left);
832854
input_report_key(dev, BTN_RIGHT, hw->right);
833855

@@ -839,12 +861,7 @@ static void synaptics_report_buttons(struct psmouse *psmouse,
839861
input_report_key(dev, BTN_BACK, hw->down);
840862
}
841863

842-
for (i = 0; i < ext_bits; i++) {
843-
input_report_key(dev, BTN_0 + 2 * i,
844-
hw->ext_buttons & (1 << i));
845-
input_report_key(dev, BTN_1 + 2 * i,
846-
hw->ext_buttons & (1 << (i + ext_bits)));
847-
}
864+
synaptics_report_ext_buttons(psmouse, hw);
848865
}
849866

850867
static void synaptics_report_slot(struct input_dev *dev, int slot,

0 commit comments

Comments
 (0)