[PATCH] psmouse: touchpad doesn't reconnect after resume: Synaptics ps2 Bug: 551234
Peter M. Petrakis
peter.petrakis at canonical.com
Thu Apr 1 15:46:03 UTC 2010
On 04/01/2010 08:38 AM, Chase Douglas wrote:
> On Thu, Apr 1, 2010 at 5:24 AM, Andy Whitcroft<apw at canonical.com> 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;
>>> + }
>
> Stylistically, I think this is better off as a while loop instead of a
> loop created by using goto.
Sorry about that, it started as goto when it was hacked into
psmouse_probe to begin with. Fixed.
> -- Chase
More information about the kernel-team
mailing list