diff options
Diffstat (limited to 'drivers/input/mouse/elantech.c')
-rw-r--r-- | 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 232556a89c4a..b18862b2a70e 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c | |||
@@ -575,6 +575,24 @@ static struct attribute_group elantech_attr_group = { | |||
575 | .attrs = elantech_attrs, | 575 | .attrs = elantech_attrs, |
576 | }; | 576 | }; |
577 | 577 | ||
578 | static bool elantech_is_signature_valid(const unsigned char *param) | ||
579 | { | ||
580 | static const unsigned char rates[] = { 200, 100, 80, 60, 40, 20, 10 }; | ||
581 | int i; | ||
582 | |||
583 | if (param[0] == 0) | ||
584 | return false; | ||
585 | |||
586 | if (param[1] == 0) | ||
587 | return true; | ||
588 | |||
589 | for (i = 0; i < ARRAY_SIZE(rates); i++) | ||
590 | if (param[2] == rates[i]) | ||
591 | return false; | ||
592 | |||
593 | return true; | ||
594 | } | ||
595 | |||
578 | /* | 596 | /* |
579 | * Use magic knock to detect Elantech touchpad | 597 | * Use magic knock to detect Elantech touchpad |
580 | */ | 598 | */ |
@@ -617,7 +635,7 @@ int elantech_detect(struct psmouse *psmouse, bool set_properties) | |||
617 | pr_debug("Elantech version query result 0x%02x, 0x%02x, 0x%02x.\n", | 635 | pr_debug("Elantech version query result 0x%02x, 0x%02x, 0x%02x.\n", |
618 | param[0], param[1], param[2]); | 636 | param[0], param[1], param[2]); |
619 | 637 | ||
620 | if (param[0] == 0 || param[1] != 0) { | 638 | if (!elantech_is_signature_valid(param)) { |
621 | if (!force_elantech) { | 639 | if (!force_elantech) { |
622 | pr_debug("Probably not a real Elantech touchpad. Aborting.\n"); | 640 | pr_debug("Probably not a real Elantech touchpad. Aborting.\n"); |
623 | return -1; | 641 | return -1; |