All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chung-yih Wang <cywang@chromium.org>
To: linux-input@vger.kernel.org
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Tai-hwa Liang <avatar@sentelic.com>,
	Rusty Russell <rusty@rustcorp.com.au>, Paul Fox <pgf@laptop.org>,
	Chung-yih Wang <cywang@chromium.org>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] Input: psmouse - retry getid command in psmouse_probe()
Date: Wed, 31 Oct 2012 18:11:19 +0800	[thread overview]
Message-ID: <1351678279-32615-1-git-send-email-cywang@chromium.org> (raw)

As the synaptics device may not respond to the first command in psmouse_probe
when a machine is booting up, the patch gives a second probe if the first
one fails.

Signed-off-by: Chung-yih Wang <cywang@chromium.org>
---
 drivers/input/mouse/psmouse-base.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index 22fe254..c4fc5ad 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -1053,8 +1053,17 @@ static int psmouse_probe(struct psmouse *psmouse)
  */
 
 	param[0] = 0xa5;
-	if (ps2_command(ps2dev, param, PSMOUSE_CMD_GETID))
-		return -1;
+	if (ps2_command(ps2dev, param, PSMOUSE_CMD_GETID)) {
+		/*
+		 * Reprobe the device if it did not respond to the GETID
+		 * command. Before retry, additional dummy command is sent
+		 * to clear the 'RESEND' response if exists.
+		 */
+		psmouse_warn(psmouse, "GETID probe failed, retrying...\n");
+		ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11);
+		if (ps2_command(ps2dev, param, PSMOUSE_CMD_GETID))
+			return -1;
+	}
 
 	if (param[0] != 0x00 && param[0] != 0x03 &&
 	    param[0] != 0x04 && param[0] != 0xff)
-- 
1.7.7.3


             reply	other threads:[~2012-10-31 10:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-31 10:11 Chung-yih Wang [this message]
     [not found] ` <CAM2ehZbMyNP_AhP-9TmCC5-bw9mqd7yunTy3NETEqRX1bX5oYg@mail.gmail.com>
2013-02-18  8:21   ` [PATCH] Input: psmouse - retry getid command in psmouse_probe() Chung-Yih Wang (王崇懿)
2013-02-18  8:21     ` Chung-Yih Wang (王崇懿)
2013-02-18  9:26 ` li guang
2013-02-18  9:26   ` li guang
2013-02-18  9:45   ` Chung-Yih Wang (王崇懿)
2013-02-19 18:44     ` Dmitry Torokhov
2013-02-19 18:44       ` Dmitry Torokhov

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=1351678279-32615-1-git-send-email-cywang@chromium.org \
    --to=cywang@chromium.org \
    --cc=avatar@sentelic.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pgf@laptop.org \
    --cc=rusty@rustcorp.com.au \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.