This is a note to let you know that I've just added the patch titled

    Input: elantech - relax signature checks

to the 2.6.32-longterm tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/longterm/longterm-queue-2.6.32.git;a=summary

The filename of the patch is:
     input-elantech-relax-signature-checks.patch
and it can be found in the queue-2.6.32 subdirectory.

If you, or anyone else, feels it should not be added to the 2.6.32 longterm 
tree,
please let <[email protected]> know about it.


>From 3d55c5e52b10fd5f89bd950e5694f1f5ae570345 Mon Sep 17 00:00:00 2001
From: Dmitry Torokhov <[email protected]>
Date: Wed, 19 May 2010 10:11:13 -0700
Subject: Input: elantech - relax signature checks

From: Dmitry Torokhov <[email protected]>

commit a083632eaf6231162b33e40561cfec6a9c156945 upstream.

Apparently there are Elantech touchpads that report non-zero in the 2nd byte
of their signature. Adjust the detection routine so that if 2nd byte is
zero and 3rd byte contains value that is not a valid report rate, we still
assume that signature is valid.

Tested-by: Eric Piel <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
[bwh: Adjust context for 2.6.32]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
 drivers/input/mouse/elantech.c |   20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -574,6 +574,24 @@ static struct attribute_group elantech_a
        .attrs = elantech_attrs,
 };
 
+static bool elantech_is_signature_valid(const unsigned char *param)
+{
+       static const unsigned char rates[] = { 200, 100, 80, 60, 40, 20, 10 };
+       int i;
+
+       if (param[0] == 0)
+               return false;
+
+       if (param[1] == 0)
+               return true;
+
+       for (i = 0; i < ARRAY_SIZE(rates); i++)
+               if (param[2] == rates[i])
+                       return false;
+
+       return true;
+}
+
 /*
  * Use magic knock to detect Elantech touchpad
  */
@@ -617,7 +635,7 @@ int elantech_detect(struct psmouse *psmo
        pr_debug("elantech.c: Elantech version query result 0x%02x, 0x%02x, 
0x%02x.\n",
                 param[0], param[1], param[2]);
 
-       if (param[0] == 0 || param[1] != 0) {
+       if (!elantech_is_signature_valid(param)) {
                if (!force_elantech) {
                        pr_debug("elantech.c: Probably not a real Elantech 
touchpad. Aborting.\n");
                        return -1;


Patches currently in longterm-queue-2.6.32 which might be from 
[email protected] are

/home/gregkh/linux/longterm/longterm-queue-2.6.32/queue-2.6.32/input-elantech-relax-signature-checks.patch
/home/gregkh/linux/longterm/longterm-queue-2.6.32/queue-2.6.32/input-elantech-use-all-3-bytes-when-checking-version.patch
/home/gregkh/linux/longterm/longterm-queue-2.6.32/queue-2.6.32/input-elantech-do-not-advertise-relative-events.patch

_______________________________________________
stable mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/stable

Reply via email to