Re: [PATCH] Reset ps/2 port should psmouse_probe fail before retrying

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2010-04-24 at 03:22 +0200, Christoph Fritz wrote:
> On Fri, 2010-04-23 at 09:53 -0700, Dmitry Torokhov wrote:
> > On Thursday 22 April 2010 05:47:48 pm Christoph Fritz wrote:
> 
> > > in conclusion:
> > >  If a Synaptics touchpad can't be initialized (synaptics_init) and falls
> > > back to PS/2, it doesn't get a psmouse_reset() after resuming from
> > > suspend as it would get with a synaptics driver.
> > 
> > Yes, you are right. Maybe we should just reset psmouse unconditionally in 
> > psmouse_reconnect() before actually doing any protocol reconnect/reprobe. That 
> > should help in cases when users not enable Synaptics support; also it is 
> > probably unlikely that mouse that was there gets unplugged after resume.
> 
> Yes, this would solve that case too. 

I have to correct myself.
 The case is already achieved with the patch I sent:
synaptics_detect() detects presence of synaptics_hardware even if the user
does not enable CONFIG_MOUSE_PS2_SYNAPTICS.

Just for a better overview in this thread, here it is:


---
If a Synaptics touchpad can't be initialized (synaptics_init) and falls
back to PS/2, it doesn't get a psmouse_reset() after resuming from
suspend as it would get with a synaptics driver.
 So check state of synaptics_hardware and reset this beast.

Signed-off-by: Christoph Fritz <chf.fritz@xxxxxxxxxxxxxx>
---
 drivers/input/mouse/psmouse-base.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index d8c0c8d..66ce0ac 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -116,6 +116,9 @@ struct psmouse_protocol {
 	int (*init)(struct psmouse *);
 };
 
+/* to handle some reset quirks */
+static bool synaptics_hardware = false;
+
 /*
  * psmouse_process_byte() analyzes the PS/2 data stream and reports
  * relevant events to the input module once full packet has arrived.
@@ -597,7 +600,6 @@ static int cortron_detect(struct psmouse *psmouse, bool set_properties)
 static int psmouse_extensions(struct psmouse *psmouse,
 			      unsigned int max_proto, bool set_properties)
 {
-	bool synaptics_hardware = false;
 
 /*
  * We always check for lifebook because it does not disturb mouse
@@ -1401,10 +1403,14 @@ static int psmouse_reconnect(struct serio *serio)
 	if (psmouse->reconnect) {
 		if (psmouse->reconnect(psmouse))
 			goto out;
-	} else if (psmouse_probe(psmouse) < 0 ||
+	} else {
+		if (synaptics_hardware)		/* is using plain PS/2 */
+			psmouse_reset(psmouse);
+		if (psmouse_probe(psmouse) < 0 ||
 		   psmouse->type != psmouse_extensions(psmouse,
 						psmouse_max_proto, false)) {
-		goto out;
+			goto out;
+		}
 	}
 
 	/* ok, the device type (and capabilities) match the old one,
-- 
1.5.6.5



--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux