[PATCH] HID: logitech-dj: stop G602 mouse dmesg flooding

From: thomas <hidden>
Date: 2025-02-25 02:01:08
Subsystem: hid core layer, hid logitech drivers, the rest · Maintainers: Jiri Kosina, Benjamin Tissoires, Linus Torvalds

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/ (local)

Signed-off-by: thomas <redacted>
---
 drivers/hid/hid-logitech-dj.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
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;
 	}
-- 
2.43.0

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help