diff mbox series

HID: logitech-dj: stop G602 mouse dmesg flooding

Message ID 20250225020038.1708346-1-me@thomasanderson.cloud (mailing list archive)
State New
Delegated to: Jiri Kosina
Headers show
Series HID: logitech-dj: stop G602 mouse dmesg flooding | expand

Commit Message

thomas Feb. 25, 2025, 2:01 a.m. UTC
The Logitech G602 mouse seems to send a 128 report on every button
press, which is undefined behavior and results in a dmesg log entry each
time any button on the mouse is clicked (left/right/scroll click or any
other macro/function buttons). This causes dmesg to be flooded with
repeated entries of the following content pretty much constantly:

    Unexpected input report number 128

This commit checks for this exact scenario, and quietly ignores it
instead of logging the error. Actual mouse functionality is not
affected.

Link: https://lore.kernel.org/lkml/cb14d9fb-9928-4c62-a087-b1a54202d65a@redhat.com/

Signed-off-by: thomas <me@thomasanderson.cloud>
---
 drivers/hid/hid-logitech-dj.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c
index 34fa71ceec2b..bea03df74fb4 100644
--- a/drivers/hid/hid-logitech-dj.c
+++ b/drivers/hid/hid-logitech-dj.c
@@ -1160,6 +1160,16 @@  static void logi_dj_recv_forward_input_report(struct hid_device *hdev,
 	int i;
 
 	if (report > REPORT_TYPE_RFREPORT_LAST) {
+		/*
+		 * G602 mouse may send a 128 report on every click, which is undefined
+		 * behavior and spams the log. Ignore it.
+		 */
+		if (report == 128 &&
+		    hdev->vendor == USB_VENDOR_ID_LOGITECH &&
+		    hdev->product == 0xc537) {
+			return;
+		}
+
 		hid_err(hdev, "Unexpected input report number %d\n", report);
 		return;
 	}