Commit d69f62be authored by Jeffrey Hugo's avatar Jeffrey Hugo Committed by Dmitry Torokhov

HID: quirks: Refactor ELAN 400 and 401 handling

There needs to be coordination between hid-quirks and the elan_i2c driver
about which devices are handled by what drivers.  Currently, both use
whitelists, which results in valid devices being unhandled by default,
when they should not be rejected by hid-quirks.  This is quickly becoming
an issue.

Since elan_i2c has a maintained whitelist of what devices it will handle,
which is now in a header file that hid-quirks can access, use that to
implement a blacklist in hid-quirks so that only the devices that need to
be handled by elan_i2c get rejected by hid-quirks, and everything else is
handled by default.
Suggested-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: default avatarJeffrey Hugo <jeffrey.l.hugo@gmail.com>
Acked-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 0828c100
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <linux/export.h> #include <linux/export.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/input/elan-i2c-ids.h>
#include "hid-ids.h" #include "hid-ids.h"
...@@ -923,6 +924,8 @@ static const struct hid_device_id hid_mouse_ignore_list[] = { ...@@ -923,6 +924,8 @@ static const struct hid_device_id hid_mouse_ignore_list[] = {
bool hid_ignore(struct hid_device *hdev) bool hid_ignore(struct hid_device *hdev)
{ {
int i;
if (hdev->quirks & HID_QUIRK_NO_IGNORE) if (hdev->quirks & HID_QUIRK_NO_IGNORE)
return false; return false;
if (hdev->quirks & HID_QUIRK_IGNORE) if (hdev->quirks & HID_QUIRK_IGNORE)
...@@ -987,18 +990,15 @@ bool hid_ignore(struct hid_device *hdev) ...@@ -987,18 +990,15 @@ bool hid_ignore(struct hid_device *hdev)
break; break;
case USB_VENDOR_ID_ELAN: case USB_VENDOR_ID_ELAN:
/* /*
* Many Elan devices have a product id of 0x0401 and are handled * Blacklist of everything that gets handled by the elan_i2c
* by the elan_i2c input driver. But the ACPI HID ELAN0800 dev * input driver. This avoids disabling valid touchpads and
* is not (and cannot be) handled by that driver -> * other ELAN devices.
* Ignore all 0x0401 devs except for the ELAN0800 dev.
*/ */
if (hdev->product == 0x0401 && if ((hdev->product == 0x0401 || hdev->product == 0x0400))
strncmp(hdev->name, "ELAN0800", 8) != 0) for (i = 0; strlen(elan_acpi_id[i].id); ++i)
return true; if (!strncmp(hdev->name, elan_acpi_id[i].id,
/* Same with product id 0x0400 */ strlen(elan_acpi_id[i].id)))
if (hdev->product == 0x0400 && return true;
strncmp(hdev->name, "QTEC0001", 8) != 0)
return true;
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment