Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 193543
b: refs/heads/master
c: a083632
h: refs/heads/master
i:
  193541: 496c59e
  193539: 5049d95
  193535: e2bc907
v: v3
  • Loading branch information
Dmitry Torokhov committed May 19, 2010
1 parent 8a64344 commit 3227c78
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d4ae84a84bedcb79341887ff070e6528d1374663
refs/heads/master: a083632eaf6231162b33e40561cfec6a9c156945
20 changes: 19 additions & 1 deletion trunk/drivers/input/mouse/elantech.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 3227c78

Please sign in to comment.