Commit e2f61102 authored by Hans de Goede's avatar Hans de Goede Committed by Dmitry Torokhov

Input: synaptics - add a matches_pnp_id helper function

This is a preparation patch for simplifying the min/max quirk table.

Cc: stable@vger.kernel.org
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 6d396ede
...@@ -156,6 +156,18 @@ static const char * const topbuttonpad_pnp_ids[] = { ...@@ -156,6 +156,18 @@ static const char * const topbuttonpad_pnp_ids[] = {
NULL NULL
}; };
static bool matches_pnp_id(struct psmouse *psmouse, const char * const ids[])
{
int i;
if (!strncmp(psmouse->ps2dev.serio->firmware_id, "PNP:", 4))
for (i = 0; ids[i]; i++)
if (strstr(psmouse->ps2dev.serio->firmware_id, ids[i]))
return true;
return false;
}
/***************************************************************************** /*****************************************************************************
* Synaptics communications functions * Synaptics communications functions
****************************************************************************/ ****************************************************************************/
...@@ -1365,17 +1377,8 @@ static void set_input_params(struct psmouse *psmouse, ...@@ -1365,17 +1377,8 @@ static void set_input_params(struct psmouse *psmouse,
if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) { if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) {
__set_bit(INPUT_PROP_BUTTONPAD, dev->propbit); __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit);
/* See if this buttonpad has a top button area */ if (matches_pnp_id(psmouse, topbuttonpad_pnp_ids))
if (!strncmp(psmouse->ps2dev.serio->firmware_id, "PNP:", 4)) { __set_bit(INPUT_PROP_TOPBUTTONPAD, dev->propbit);
for (i = 0; topbuttonpad_pnp_ids[i]; i++) {
if (strstr(psmouse->ps2dev.serio->firmware_id,
topbuttonpad_pnp_ids[i])) {
__set_bit(INPUT_PROP_TOPBUTTONPAD,
dev->propbit);
break;
}
}
}
/* Clickpads report only left button */ /* Clickpads report only left button */
__clear_bit(BTN_RIGHT, dev->keybit); __clear_bit(BTN_RIGHT, dev->keybit);
__clear_bit(BTN_MIDDLE, dev->keybit); __clear_bit(BTN_MIDDLE, dev->keybit);
......
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