From: Alexandre Peixoto Ferreira Date: Sat, 29 Jan 2011 06:05:14 +0000 (-0800) Subject: Input: synaptics - retry failed resets when reconnecting X-Git-Tag: Ubuntu-5.2.0-15.16~22137^2 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=c63fe0a41fd2374be0ebe93c053820a0eed9cefe;p=mirror_ubuntu-eoan-kernel.git 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 Signed-off-by: Dmitry Torokhov --- diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index fdf089c0c707..aa186cf6c514 100644 --- a/drivers/input/mouse/synaptics.c +++ b/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 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; + if (retry > 1) + printk(KERN_DEBUG "Synaptics reconnected after %d tries\n", + retry); + if (synaptics_query_hardware(psmouse)) { printk(KERN_ERR "Unable to query Synaptics hardware.\n"); return -1;