浏览代码

Input: synaptics - retry failed resets when reconnecting

On some machines, like Dell Studio XPS 16 (1640), touchpad fails to
respond to the standard query after first reset but may start
responding later, so let's repeat reset sequence several (3) times.

Signed-off-by: Alexandre Peixoto Ferreira <alexandref75@gmail.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Alexandre Peixoto Ferreira 14 年之前
父节点
当前提交
c63fe0a41f
共有 1 个文件被更改,包括 11 次插入2 次删除
  1. 11 2
      drivers/input/mouse/synaptics.c

+ 11 - 2
drivers/input/mouse/synaptics.c

@@ -755,12 +755,21 @@ static int synaptics_reconnect(struct psmouse *psmouse)
 {
 {
 	struct synaptics_data *priv = psmouse->private;
 	struct synaptics_data *priv = psmouse->private;
 	struct synaptics_data old_priv = *priv;
 	struct synaptics_data old_priv = *priv;
+	int retry = 0;
+	int error;
 
 
-	psmouse_reset(psmouse);
+	do {
+		psmouse_reset(psmouse);
+		error = synaptics_detect(psmouse, 0);
+	} while (error && ++retry < 3);
 
 
-	if (synaptics_detect(psmouse, 0))
+	if (error)
 		return -1;
 		return -1;
 
 
+	if (retry > 1)
+		printk(KERN_DEBUG "Synaptics reconnected after %d tries\n",
+			retry);
+
 	if (synaptics_query_hardware(psmouse)) {
 	if (synaptics_query_hardware(psmouse)) {
 		printk(KERN_ERR "Unable to query Synaptics hardware.\n");
 		printk(KERN_ERR "Unable to query Synaptics hardware.\n");
 		return -1;
 		return -1;