lkml.org 
[lkml]   [2012]   [Apr]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] Input: elantech - make synaptics_send_cmd() retry for 3 times
Date
synaptics_send_cmd() doesn't seem to be very reliable with Elan touchapds,
so people could see infrequent failures when it is called in elantech_detect(),
resulting touchpads fail to be recognized as Elan.

Teach synaptics_send_cmd() to retry for 3 times to make sure we are properly
detected.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=43136
Reported-by: ubase133@gmail.com
Signed-off-by: JJ Ding <jj_ding@emc.com.tw>
---
Hi ubase133,

Dmitry forwarded your bugzilla report to me.

I used to see rare cases when this also happened on my test machine, but we
don't really know why. Does this always happen on your machine?

Anyway, could you please try this patch out? This is really the only fix I can
think of. If it doesn't work for you, then I will have to dig deeper.

P.S. Patch is against 3.4-rc4.

Thanks,
JJ

drivers/input/mouse/elantech.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 4790110..6b8df09 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -30,7 +30,7 @@
/*
* Send a Synaptics style sliced query command
*/
-static int synaptics_send_cmd(struct psmouse *psmouse, unsigned char c,
+static int __synaptics_send_cmd(struct psmouse *psmouse, unsigned char c,
unsigned char *param)
{
if (psmouse_sliced_command(psmouse, c) ||
@@ -42,6 +42,23 @@ static int synaptics_send_cmd(struct psmouse *psmouse, unsigned char c,
return 0;
}

+static int synaptics_send_cmd(struct psmouse *psmouse, unsigned char c,
+ unsigned char *param)
+{
+ int rc;
+ int tries = ETP_PS2_COMMAND_TRIES;
+
+ do {
+ rc = __synaptics_send_cmd(psmouse, c, param);
+ if (rc == 0)
+ break;
+ tries--;
+ msleep(ETP_PS2_COMMAND_DELAY);
+ } while (tries > 0);
+
+ return rc;
+}
+
/*
* V3 and later support this fast command
*/
--
1.7.10


\
 
 \ /
  Last update: 2012-04-23 11:43    [W:0.036 / U:0.376 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site