瀏覽代碼

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>
Dmitry Torokhov 10 年之前
父節點
當前提交
de4e374b40
共有 2 個文件被更改,包括 15 次插入21 次删除
  1. 14 21
      drivers/input/mouse/synaptics.c
  2. 1 0
      drivers/input/mouse/synaptics.h

+ 14 - 21
drivers/input/mouse/synaptics.c

@@ -194,6 +194,13 @@ static const char * const topbuttonpad_pnp_ids[] = {
 	NULL
 	NULL
 };
 };
 
 
+/* This list has been kindly provided by Synaptics. */
+static const char * const forcepad_pnp_ids[] = {
+	"SYN300D",
+	"SYN3014",
+	NULL
+};
+
 /*****************************************************************************
 /*****************************************************************************
  *	Synaptics communications functions
  *	Synaptics communications functions
  ****************************************************************************/
  ****************************************************************************/
@@ -605,8 +612,6 @@ static void synaptics_parse_agm(const unsigned char buf[],
 	}
 	}
 }
 }
 
 
-static bool is_forcepad;
-
 static int synaptics_parse_hw_state(const unsigned char buf[],
 static int synaptics_parse_hw_state(const unsigned char buf[],
 				    struct synaptics_data *priv,
 				    struct synaptics_data *priv,
 				    struct synaptics_hw_state *hw)
 				    struct synaptics_hw_state *hw)
@@ -636,7 +641,7 @@ static int synaptics_parse_hw_state(const unsigned char buf[],
 		hw->left  = (buf[0] & 0x01) ? 1 : 0;
 		hw->left  = (buf[0] & 0x01) ? 1 : 0;
 		hw->right = (buf[0] & 0x02) ? 1 : 0;
 		hw->right = (buf[0] & 0x02) ? 1 : 0;
 
 
-		if (is_forcepad) {
+		if (priv->is_forcepad) {
 			/*
 			/*
 			 * ForcePads, like Clickpads, use middle button
 			 * ForcePads, like Clickpads, use middle button
 			 * bits to report primary button clicks.
 			 * bits to report primary button clicks.
@@ -1311,29 +1316,11 @@ static const struct dmi_system_id __initconst cr48_dmi_table[] = {
 	{ }
 	{ }
 };
 };
 
 
-static const struct dmi_system_id forcepad_dmi_table[] __initconst = {
-#if defined(CONFIG_DMI) && defined(CONFIG_X86)
-	{
-		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
-			DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook Folio 1040 G1"),
-		},
-	},
-#endif
-	{ }
-};
-
 void __init synaptics_module_init(void)
 void __init synaptics_module_init(void)
 {
 {
 	impaired_toshiba_kbc = dmi_check_system(toshiba_dmi_table);
 	impaired_toshiba_kbc = dmi_check_system(toshiba_dmi_table);
 	broken_olpc_ec = dmi_check_system(olpc_dmi_table);
 	broken_olpc_ec = dmi_check_system(olpc_dmi_table);
 	cr48_profile_sensor = dmi_check_system(cr48_dmi_table);
 	cr48_profile_sensor = dmi_check_system(cr48_dmi_table);
-
-	/*
-	 * Unfortunately ForcePad capability is not exported over PS/2,
-	 * so we have to resort to checking DMI.
-	 */
-	is_forcepad = dmi_check_system(forcepad_dmi_table);
 }
 }
 
 
 static int __synaptics_init(struct psmouse *psmouse, bool absolute_mode)
 static int __synaptics_init(struct psmouse *psmouse, bool absolute_mode)
@@ -1368,6 +1355,12 @@ static int __synaptics_init(struct psmouse *psmouse, bool absolute_mode)
 	if (SYN_ID_DISGEST_SUPPORTED(priv->identity))
 	if (SYN_ID_DISGEST_SUPPORTED(priv->identity))
 		priv->disable_gesture = true;
 		priv->disable_gesture = true;
 
 
+	/*
+	 * Unfortunately ForcePad capability is not exported over PS/2,
+	 * so we have to resort to checking PNP IDs.
+	 */
+	priv->is_forcepad = psmouse_matches_pnp_id(psmouse, forcepad_pnp_ids);
+
 	if (synaptics_set_mode(psmouse)) {
 	if (synaptics_set_mode(psmouse)) {
 		psmouse_err(psmouse, "Unable to initialize device.\n");
 		psmouse_err(psmouse, "Unable to initialize device.\n");
 		goto init_fail;
 		goto init_fail;

+ 1 - 0
drivers/input/mouse/synaptics.h

@@ -168,6 +168,7 @@ struct synaptics_data {
 	unsigned long				press_start;
 	unsigned long				press_start;
 	bool					press;
 	bool					press;
 	bool					report_press;
 	bool					report_press;
+	bool					is_forcepad;
 };
 };
 
 
 void synaptics_module_init(void);
 void synaptics_module_init(void);