linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Christoph Fritz <chf.fritz@googlemail.com>
Cc: "Peter M. Petrakis" <peter.petrakis@canonical.com>,
	linux-input@vger.kernel.org, rubini <rubini@cvml.unipv.it>
Subject: Re: [PATCH] Reset ps/2 port should      psmouse_probe   fail before retrying
Date: Wed, 28 Apr 2010 00:26:33 -0700	[thread overview]
Message-ID: <20100428072633.GC4232@core.coreip.homeip.net> (raw)
In-Reply-To: <1272103233.4666.15.camel@lovely>

On Sat, Apr 24, 2010 at 12:00:33PM +0200, Christoph Fritz wrote:
> 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@googlemail.com>
> ---
>  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;

This is not entirely correct as there could be more than one PS/2 device
attached to a box (i.e. a touchpad and an external mouse).

What about simply resetting the mouse before actually trying to
reconnect?

BTW, no need to initialize static variables to 0/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,

Thanks.

-- 
Dmitry

  reply	other threads:[~2010-04-28  7:32 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-16 22:52 [PATCH] Reset ps/2 port should psmouse_probe fail before retrying Peter M. Petrakis
2010-04-17 11:01 ` Christoph Fritz
2010-04-17 15:31   ` Peter M. Petrakis
2010-04-17 16:53     ` Christoph Fritz
2010-04-19 15:33       ` Peter M. Petrakis
2010-04-20  0:37         ` Christoph Fritz
2010-04-20 21:08           ` Peter M. Petrakis
2010-04-21  6:33             ` Dmitry Torokhov
2010-04-21 16:05               ` Peter M. Petrakis
2010-04-21 17:10                 ` Dmitry Torokhov
2010-04-21 19:38                   ` Peter M. Petrakis
2010-04-21 19:52                     ` Dmitry Torokhov
2010-04-21 21:10                       ` Peter M. Petrakis
2010-04-22 16:28                         ` Christoph Fritz
2010-04-22 21:48                           ` Peter M. Petrakis
2010-04-22 21:55                             ` Dmitry Torokhov
2010-04-23  0:47                               ` Christoph Fritz
2010-04-23 16:53                                 ` Dmitry Torokhov
2010-04-23 18:46                                   ` Peter M. Petrakis
2010-04-28 17:07                                     ` Dmitry Torokhov
2010-04-28 20:17                                       ` Peter M. Petrakis
2010-04-29 16:57                                         ` Christoph Fritz
2010-04-29 17:46                                           ` Dmitry Torokhov
2010-04-30 22:37                                           ` Peter M. Petrakis
2010-05-02  3:07                                             ` Christoph Fritz
2010-05-02  7:41                                               ` Christoph Fritz
2010-05-07 17:57                                               ` Peter M. Petrakis
2010-05-08 16:01                                                 ` Christoph Fritz
2010-04-24  1:22                                   ` Christoph Fritz
2010-04-24 10:00                                     ` Christoph Fritz
2010-04-28  7:26                                       ` Dmitry Torokhov [this message]
2010-05-08 16:22                                         ` Christoph Fritz
2010-05-11  8:22                                           ` Dmitry Torokhov
2010-05-11 22:24                                             ` Christoph Fritz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100428072633.GC4232@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=chf.fritz@googlemail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=peter.petrakis@canonical.com \
    --cc=rubini@cvml.unipv.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).