HID: quirks: Add HID_QUIRK_IGNORE_MOUSE quirk
authorAditya Garg <gargaditya08@live.com>
Thu, 10 Apr 2025 07:29:27 +0000 (12:59 +0530)
committerJiri Kosina <jkosina@suse.com>
Thu, 24 Apr 2025 09:32:51 +0000 (11:32 +0200)
Some USB HID mice have drivers both in HID as well as a separate USB
driver. The already existing hid_mouse_ignore_list in hid-quirks manages
this, but is not yet configurable by usbhid.quirks, unlike all others like
hid_ignore_list. Thus in some HID devices, where the vendor provides USB
drivers only for the mouse and lets keyboard handled by the generic hid
drivers, presence of such a quirk prevents the user from compiling hid core
again to add the device to the table.

Signed-off-by: Aditya Garg <gargaditya08@live.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
drivers/hid/hid-quirks.c
include/linux/hid.h

index 646171598e4132f525f83c8905edfdfa029fa0cb..e36cbe78d67ec9228a963dac603fd221651d4cb6 100644 (file)
@@ -1061,7 +1061,7 @@ bool hid_ignore(struct hid_device *hdev)
        }
 
        if (hdev->type == HID_TYPE_USBMOUSE &&
-           hid_match_id(hdev, hid_mouse_ignore_list))
+           hdev->quirks & HID_QUIRK_IGNORE_MOUSE)
                return true;
 
        return !!hid_match_id(hdev, hid_ignore_list);
@@ -1265,6 +1265,9 @@ static unsigned long hid_gets_squirk(const struct hid_device *hdev)
        if (hid_match_id(hdev, hid_ignore_list))
                quirks |= HID_QUIRK_IGNORE;
 
+       if (hid_match_id(hdev, hid_mouse_ignore_list))
+               quirks |= HID_QUIRK_IGNORE_MOUSE;
+
        if (hid_match_id(hdev, hid_have_special_driver))
                quirks |= HID_QUIRK_HAVE_SPECIAL_DRIVER;
 
index daae1d6d11a7443c5be3961fc389f154bb1ccb82..a1305210b2fd839154b5b835db9fc08307da3ec3 100644 (file)
@@ -357,6 +357,7 @@ struct hid_item {
  * | @HID_QUIRK_INPUT_PER_APP:
  * | @HID_QUIRK_X_INVERT:
  * | @HID_QUIRK_Y_INVERT:
+ * | @HID_QUIRK_IGNORE_MOUSE:
  * | @HID_QUIRK_SKIP_OUTPUT_REPORTS:
  * | @HID_QUIRK_SKIP_OUTPUT_REPORT_ID:
  * | @HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP:
@@ -382,6 +383,7 @@ struct hid_item {
 #define HID_QUIRK_INPUT_PER_APP                        BIT(11)
 #define HID_QUIRK_X_INVERT                     BIT(12)
 #define HID_QUIRK_Y_INVERT                     BIT(13)
+#define HID_QUIRK_IGNORE_MOUSE                 BIT(14)
 #define HID_QUIRK_SKIP_OUTPUT_REPORTS          BIT(16)
 #define HID_QUIRK_SKIP_OUTPUT_REPORT_ID                BIT(17)
 #define HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP BIT(18)