From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: linux-input@vger.kernel.org
Cc: "Florian Ragwitz" <rafl@debian.org>,
"Éric Piel" <E.A.B.Piel@tudelft.nl>,
"Arjan Opmeer" <arjan@opmeer.net>
Subject: [PATCH 3/3] Input: elantech - signature...
Date: Tue, 11 May 2010 01:18:59 -0700 [thread overview]
Message-ID: <20100511081859.10546.11991.stgit@localhost.localdomain> (raw)
In-Reply-To: <20100511081848.10546.95545.stgit@localhost.localdomain>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---
drivers/input/mouse/elantech.c | 20 +++++++++++++++++++-
1 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 232556a..b18862b 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -575,6 +575,24 @@ static struct attribute_group elantech_attr_group = {
.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 *psmouse, bool set_properties)
pr_debug("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("Probably not a real Elantech touchpad. Aborting.\n");
return -1;
next prev parent reply other threads:[~2010-05-11 8:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-11 8:18 [PATCH 1/3] Input: elantech - use all 3 bytes when checking version Dmitry Torokhov
2010-05-11 8:18 ` [PATCH 2/3] Input: elantech - enforce common prefix on messages Dmitry Torokhov
2010-05-11 8:18 ` Dmitry Torokhov [this message]
2010-05-11 21:01 ` [PATCH 3/3] Input: elantech - signature Éric Piel
2010-05-11 21:00 ` [PATCH 1/3] Input: elantech - use all 3 bytes when checking version Éric Piel
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=20100511081859.10546.11991.stgit@localhost.localdomain \
--to=dmitry.torokhov@gmail.com \
--cc=E.A.B.Piel@tudelft.nl \
--cc=arjan@opmeer.net \
--cc=linux-input@vger.kernel.org \
--cc=rafl@debian.org \
/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.