linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: thomas <me@thomasanderson.cloud>
To: linux-input@vger.kernel.org
Cc: thomas <me@thomasanderson.cloud>
Subject: [PATCH] HID: logitech-dj: stop G602 mouse dmesg flooding
Date: Tue, 25 Feb 2025 02:01:01 +0000	[thread overview]
Message-ID: <20250225020038.1708346-1-me@thomasanderson.cloud> (raw)

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 --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



                 reply	other threads:[~2025-02-25  2:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250225020038.1708346-1-me@thomasanderson.cloud \
    --to=me@thomasanderson.cloud \
    --cc=linux-input@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).