|
@@ -575,6 +575,24 @@ static struct attribute_group elantech_attr_group = {
|
|
.attrs = elantech_attrs,
|
|
.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
|
|
* 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",
|
|
pr_debug("Elantech version query result 0x%02x, 0x%02x, 0x%02x.\n",
|
|
param[0], param[1], param[2]);
|
|
param[0], param[1], param[2]);
|
|
|
|
|
|
- if (param[0] == 0 || param[1] != 0) {
|
|
|
|
|
|
+ if (!elantech_is_signature_valid(param)) {
|
|
if (!force_elantech) {
|
|
if (!force_elantech) {
|
|
pr_debug("Probably not a real Elantech touchpad. Aborting.\n");
|
|
pr_debug("Probably not a real Elantech touchpad. Aborting.\n");
|
|
return -1;
|
|
return -1;
|