Perform a reset should psmouse_probe fail for any reason. This is necessary for some PS/2 devices who can't even be identified when returning from sleep (S3).
Perform a reset should psmouse_probe fail for any reason. This is necessary for some PS/2 devices who can't even be identified when returning from sleep (S3).
-
/*
- * psmouse_probe() probes for a PS/2 mouse.
+ * __psmouse_probe() probes for a PS/2 mouse.
+ * Wrapped by psmouse_probe() for clean reset code.
*/
-static int psmouse_probe(struct psmouse *psmouse)
+static int __psmouse_probe(struct psmouse *psmouse)
{
struct ps2dev *ps2dev = &psmouse->ps2dev;
unsigned char param[2];
@@ -892,6 +892,28 @@ static int psmouse_probe(struct psmouse *psmouse)
}
/*
+ * Wrapper for probe routine to cleanly reset the device should
+ * the initial probe fail for any reason.
+ */
+static int psmouse_probe(struct psmouse *psmouse) {
+ struct ps2dev *ps2dev = &psmouse->ps2dev;
+ int tries = 3;
+ int ret = -1;
+
+retry:
+ if (tries > 0 && ((ret = __psmouse_probe(psmouse)) != 0)) {
+ printk(KERN_ERR "psmouse.c: Error encountered while probing PS/2 device on %s "
+ "reseting...
", ps2dev->serio->phys);
+ psmouse_reset(psmouse);
+ msleep(500);
+ tries--;
+ goto retry;
+ }
+
+ return ret;
+}
+
+/*
* Here we set the mouse resolution.
*/