mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Reset ps/2 port should psmouse_probe fail before retrying
@ 2010-04-14 20:46 Peter M. Petrakis
  2010-04-14 21:04 ` Randy Dunlap
  0 siblings, 1 reply; 2+ messages in thread
From: Peter M. Petrakis @ 2010-04-14 20:46 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 768 bytes --]

Filed a bug on this too:

https://bugzilla.kernel.org/show_bug.cgi?id=15780

This particular laptop will lose it's synaptics touch
pad on return from suspend state. Reloading the psmouse
module makes no difference. I came up with the attached
work around which simply calls psmouse_reset on the
port should the initial probe fail. This solves the problem
for me and I've tested this on several laptops.

Initially discovered on Ubuntu 2.6.31 (karmic) and the problem
continues to exist in lucid 2.6.32. I've filed a bug against
ubuntu kernel here:

https://bugs.launchpad.net/oem-priority/+bug/551234

though the Ubuntu kernel team would really like to get upstream's
input on the matter before accepting the patch. Please
let me know what you think. Thanks.

Peter



[-- Attachment #2: psmouse_reset.patch --]
[-- Type: text/x-diff, Size: 1181 bytes --]

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.
  */
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Reset ps/2 port should psmouse_probe fail before retrying
  2010-04-14 20:46 [PATCH] Reset ps/2 port should psmouse_probe fail before retrying Peter M. Petrakis
@ 2010-04-14 21:04 ` Randy Dunlap
  0 siblings, 0 replies; 2+ messages in thread
From: Randy Dunlap @ 2010-04-14 21:04 UTC (permalink / raw)
  To: Peter M. Petrakis; +Cc: linux-kernel

On Wed, 14 Apr 2010 16:46:29 -0400 Peter M. Petrakis wrote:

> Filed a bug on this too:
> 
> https://bugzilla.kernel.org/show_bug.cgi?id=15780
> 
> This particular laptop will lose it's synaptics touch
> pad on return from suspend state. Reloading the psmouse
> module makes no difference. I came up with the attached
> work around which simply calls psmouse_reset on the
> port should the initial probe fail. This solves the problem
> for me and I've tested this on several laptops.
> 
> Initially discovered on Ubuntu 2.6.31 (karmic) and the problem
> continues to exist in lucid 2.6.32. I've filed a bug against
> ubuntu kernel here:
> 
> https://bugs.launchpad.net/oem-priority/+bug/551234
> 
> though the Ubuntu kernel team would really like to get upstream's
> input on the matter before accepting the patch. Please
> let me know what you think. Thanks.

Hi,

Please send patches inline, not as attachments.
Use the full source file path in the patch.
Send the patch to linux-input@vger.kernel.org and cc: the Input
subsystem maintainer.

typo:  s/reseting/resetting/


Other than those 4 things, the patch looks OK to me.
Well, we would prefer not to have the
	((ret = __psmouse_probe(psmouse)) != 0)
inside the for expression if possible.  I.e., make the for(...) simpler.


Please read/review Documentation/SubmittingPatches.  Thanks.

---
~Randy

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-04-14 21:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-14 20:46 [PATCH] Reset ps/2 port should psmouse_probe fail before retrying Peter M. Petrakis
2010-04-14 21:04 ` Randy Dunlap

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®