[PATCH] psmouse: touchpad doesn't reconnect after resume: Synaptics ps2 Bug: 551234
Andy Whitcroft
apw at canonical.com
Wed Apr 21 14:57:53 UTC 2010
On Tue, Apr 06, 2010 at 01:55:42PM -0400, Peter M. Petrakis wrote:
> Turns out that I don't need the msleep and incorporated
> everyone's suggestions. Thanks.
>
> Peter
>
> On 04/01/2010 05:24 AM, Andy Whitcroft wrote:
> >On Mon, Mar 29, 2010 at 05:18:35PM -0400, Peter M. Petrakis wrote:
> >>Hi All,
> >>
> >>This is my first stab at correcting some PS/2 misbehavior when returning
> >>from S3. Fire away :). Thanks.
> >>
> >>Peter
> >>
> >>P.S. Collaborated with Colin King on this one.
> >
> >> From 006e55bacfe64f5fe6b8c12af071f7b2bf528c3a Mon Sep 17 00:00:00 2001
> >>From: Peter M. Petrakis<peter.petrakis at canonical.com>
> >>Date: Fri, 26 Mar 2010 17:23:43 -0400
> >>Subject: [PATCH] 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-base.c | 28 +++++++++++++++++++++++++---
> >> 1 files changed, 25 insertions(+), 3 deletions(-)
> >>
> >>diff --git a/psmouse-base.c b/psmouse-base.c
> >>index b407b35..3b8e63c 100644
> >>--- a/psmouse-base.c
> >>+++ b/psmouse-base.c
> >>@@ -856,12 +856,12 @@ static const struct psmouse_protocol *psmouse_protocol_by_name(const char *name,
> >> return NULL;
> >> }
> >>
> >>-
> >> /*
> >>- * 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...\n", ps2dev->serio->phys);
> >>+ psmouse_reset(psmouse);
> >>+ msleep(500);
> >>+ tries--;
> >>+ goto retry;
> >>+ }
> >
> >How does this behave if the machine does not have a psmouse on this
> >port? Do we still call here? If so that sounds like it might add 1.5s
> >to boot/resume?
> >
> >Is 500ms a number picked out of the air or does it have some basis in an
> >errata? It seems like a long time in the real world.
> >
> >Also what machines have this issue, what devices? Can we quirk this on
> >only for the machines which are broken?
> >
> >Finally, what releases is this aimed at?
> >
> >>+
> >>+ return ret;
> >>+}
> >>+
> >>+/*
> >> * Here we set the mouse resolution.
> >> */
> >
> >-apw
> diff --git a/psmouse-base.c b/psmouse-base.c
> index b407b35..d79eafc 100644
> --- a/psmouse-base.c
> +++ b/psmouse-base.c
> @@ -856,12 +856,12 @@ static const struct psmouse_protocol *psmouse_protocol_by_name(const char *name,
> return NULL;
> }
>
> -
> /*
> - * 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,23 @@ 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 i, ret = -1;
> +
> + for (i=0; ((ret = __psmouse_probe(psmouse)) != 0) && i < 3; i++) {
> + printk(KERN_ERR "psmouse.c: Error encountered while probing"
> + " PS/2 device on %s, reseting.\n", ps2dev->serio->phys);
> + psmouse_reset(psmouse);
> + }
> +
> + return ret;
> +}
> +
> +/*
> * Here we set the mouse resolution.
> */
>
Assuming this has been tested on non-broken h/w, then it looks somewhat
more reasonable.
Acked-by: Andy Whitcroft <apw at canonical.com>
-apw
More information about the kernel-team
mailing list