Skip to content

Commit de4e374

Browse files
committed
Input: synaptics - switch ForcePad detection to PNP IDs
According to Synaptics devices with ForcePads use SYN300D and SYN3014 as PNP IDs, so let's switch from DMI-bases detection scheme to PNP-based one, which should be more reliable. Suggested-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent 99e14c1 commit de4e374

2 files changed

Lines changed: 15 additions & 21 deletions

File tree

‎drivers/input/mouse/synaptics.c‎

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,13 @@ static const char * const topbuttonpad_pnp_ids[] = {
194194
NULL
195195
};
196196

197+
/* This list has been kindly provided by Synaptics. */
198+
static const char * const forcepad_pnp_ids[] = {
199+
"SYN300D",
200+
"SYN3014",
201+
NULL
202+
};
203+
197204
/*****************************************************************************
198205
* Synaptics communications functions
199206
****************************************************************************/
@@ -605,8 +612,6 @@ static void synaptics_parse_agm(const unsigned char buf[],
605612
}
606613
}
607614

608-
static bool is_forcepad;
609-
610615
static int synaptics_parse_hw_state(const unsigned char buf[],
611616
struct synaptics_data *priv,
612617
struct synaptics_hw_state *hw)
@@ -636,7 +641,7 @@ static int synaptics_parse_hw_state(const unsigned char buf[],
636641
hw->left = (buf[0] & 0x01) ? 1 : 0;
637642
hw->right = (buf[0] & 0x02) ? 1 : 0;
638643

639-
if (is_forcepad) {
644+
if (priv->is_forcepad) {
640645
/*
641646
* ForcePads, like Clickpads, use middle button
642647
* bits to report primary button clicks.
@@ -1311,29 +1316,11 @@ static const struct dmi_system_id __initconst cr48_dmi_table[] = {
13111316
{ }
13121317
};
13131318

1314-
static const struct dmi_system_id forcepad_dmi_table[] __initconst = {
1315-
#if defined(CONFIG_DMI) && defined(CONFIG_X86)
1316-
{
1317-
.matches = {
1318-
DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
1319-
DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook Folio 1040 G1"),
1320-
},
1321-
},
1322-
#endif
1323-
{ }
1324-
};
1325-
13261319
void __init synaptics_module_init(void)
13271320
{
13281321
impaired_toshiba_kbc = dmi_check_system(toshiba_dmi_table);
13291322
broken_olpc_ec = dmi_check_system(olpc_dmi_table);
13301323
cr48_profile_sensor = dmi_check_system(cr48_dmi_table);
1331-
1332-
/*
1333-
* Unfortunately ForcePad capability is not exported over PS/2,
1334-
* so we have to resort to checking DMI.
1335-
*/
1336-
is_forcepad = dmi_check_system(forcepad_dmi_table);
13371324
}
13381325

13391326
static int __synaptics_init(struct psmouse *psmouse, bool absolute_mode)
@@ -1368,6 +1355,12 @@ static int __synaptics_init(struct psmouse *psmouse, bool absolute_mode)
13681355
if (SYN_ID_DISGEST_SUPPORTED(priv->identity))
13691356
priv->disable_gesture = true;
13701357

1358+
/*
1359+
* Unfortunately ForcePad capability is not exported over PS/2,
1360+
* so we have to resort to checking PNP IDs.
1361+
*/
1362+
priv->is_forcepad = psmouse_matches_pnp_id(psmouse, forcepad_pnp_ids);
1363+
13711364
if (synaptics_set_mode(psmouse)) {
13721365
psmouse_err(psmouse, "Unable to initialize device.\n");
13731366
goto init_fail;

‎drivers/input/mouse/synaptics.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ struct synaptics_data {
168168
unsigned long press_start;
169169
bool press;
170170
bool report_press;
171+
bool is_forcepad;
171172
};
172173

173174
void synaptics_module_init(void);

0 commit comments

Comments
 (0)