[PATCH 1/1] elantech touchpad -- weed out incorrectly identified Logitech Mice

From: Andy Whitcroft
Date: Fri Jan 23 2009 - 12:42:05 EST


Some Logitech USB-PS/2 Optical Mouse are triggering on the special knock
sequence when attached on PS/2. Use the version number to weed those out.
Note that as we have no private data we end up doing the version check
twice.

Based on an original patch by Arjan Opmeer <arjan@xxxxxxxxxx> and based
on suggestions from him on how to improve it.

Signed-off-by: Andy Whitcroft <apw@xxxxxxxxxxxxx>
---
drivers/input/mouse/elantech.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index b9a25d5..32febf5 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -556,6 +556,22 @@ int elantech_detect(struct psmouse *psmouse, int set_properties)
return -1;
}

+ /*
+ * Some Logitech USB-PS/2 Optical Mouse devices are responding to
+ * our magic knock. So ask for our device version and validate
+ * using that.
+ */
+ if (synaptics_send_cmd(psmouse, ETP_FW_VERSION_QUERY, param)) {
+ pr_err("elantech.c: failed to query firmware version.\n");
+ return -1;
+ }
+ pr_info("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) {
+ pr_info("elantech.c: Probably not a real Elantech touchpad. Aborting.\n");
+ return -1;
+ }
+
if (set_properties) {
psmouse->vendor = "Elantech";
psmouse->name = "Touchpad";
--
1.6.1.258.g7ff14.dirty
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/