|
| 1 | +From c9c815e680078feb9b862b8013f24c8a31408f3e Mon Sep 17 00:00:00 2001 |
| 2 | +From: Aditya Garg < [email protected]> |
| 3 | +Date: Thu, 10 Apr 2025 12:59:27 +0530 |
| 4 | +Subject: [PATCH] HID: quirks: Add HID_QUIRK_IGNORE_MOUSE quirk |
| 5 | + |
| 6 | +Some USB HID mice have drivers both in HID as well as a separate USB |
| 7 | +driver. The already existing hid_mouse_ignore_list in hid-quirks manages |
| 8 | +this, but is not yet configurable by usbhid.quirks, unlike all others like |
| 9 | +hid_ignore_list. Thus in some HID devices, where the vendor provides USB |
| 10 | +drivers only for the mouse and lets keyboard handled by the generic hid |
| 11 | +drivers, presence of such a quirk prevents the user from compiling hid core |
| 12 | +again to add the device to the table. |
| 13 | + |
| 14 | +Signed-off-by: Aditya Garg < [email protected]> |
| 15 | +Signed-off-by: Jiri Kosina < [email protected]> |
| 16 | +--- |
| 17 | + drivers/hid/hid-quirks.c | 5 ++++- |
| 18 | + include/linux/hid.h | 2 ++ |
| 19 | + 2 files changed, 6 insertions(+), 1 deletion(-) |
| 20 | + |
| 21 | +diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c |
| 22 | +index 5d7a418cc..f9a4082a7 100644 |
| 23 | +--- a/drivers/hid/hid-quirks.c |
| 24 | ++++ b/drivers/hid/hid-quirks.c |
| 25 | +@@ -1051,7 +1051,7 @@ bool hid_ignore(struct hid_device *hdev) |
| 26 | + } |
| 27 | + |
| 28 | + if (hdev->type == HID_TYPE_USBMOUSE && |
| 29 | +- hid_match_id(hdev, hid_mouse_ignore_list)) |
| 30 | ++ hdev->quirks & HID_QUIRK_IGNORE_MOUSE) |
| 31 | + return true; |
| 32 | + |
| 33 | + return !!hid_match_id(hdev, hid_ignore_list); |
| 34 | +@@ -1255,6 +1255,9 @@ static unsigned long hid_gets_squirk(const struct hid_device *hdev) |
| 35 | + if (hid_match_id(hdev, hid_ignore_list)) |
| 36 | + quirks |= HID_QUIRK_IGNORE; |
| 37 | + |
| 38 | ++ if (hid_match_id(hdev, hid_mouse_ignore_list)) |
| 39 | ++ quirks |= HID_QUIRK_IGNORE_MOUSE; |
| 40 | ++ |
| 41 | + if (hid_match_id(hdev, hid_have_special_driver)) |
| 42 | + quirks |= HID_QUIRK_HAVE_SPECIAL_DRIVER; |
| 43 | + |
| 44 | +diff --git a/include/linux/hid.h b/include/linux/hid.h |
| 45 | +index 9ca7e26ac..ee668cd01 100644 |
| 46 | +--- a/include/linux/hid.h |
| 47 | ++++ b/include/linux/hid.h |
| 48 | +@@ -355,6 +355,7 @@ struct hid_item { |
| 49 | + * | @HID_QUIRK_INPUT_PER_APP: |
| 50 | + * | @HID_QUIRK_X_INVERT: |
| 51 | + * | @HID_QUIRK_Y_INVERT: |
| 52 | ++ * | @HID_QUIRK_IGNORE_MOUSE: |
| 53 | + * | @HID_QUIRK_SKIP_OUTPUT_REPORTS: |
| 54 | + * | @HID_QUIRK_SKIP_OUTPUT_REPORT_ID: |
| 55 | + * | @HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP: |
| 56 | +@@ -380,6 +381,7 @@ struct hid_item { |
| 57 | + #define HID_QUIRK_INPUT_PER_APP BIT(11) |
| 58 | + #define HID_QUIRK_X_INVERT BIT(12) |
| 59 | + #define HID_QUIRK_Y_INVERT BIT(13) |
| 60 | ++#define HID_QUIRK_IGNORE_MOUSE BIT(14) |
| 61 | + #define HID_QUIRK_SKIP_OUTPUT_REPORTS BIT(16) |
| 62 | + #define HID_QUIRK_SKIP_OUTPUT_REPORT_ID BIT(17) |
| 63 | + #define HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP BIT(18) |
| 64 | +-- |
| 65 | +2.49.0 |
| 66 | + |
0 commit comments