Linux Input/HID development
 help / color / mirror / Atom feed
From: "Trần Nam Tuấn" <billtran1632001@gmail.com>
To: linux-input@vger.kernel.org
Subject: Re: [PATCH v2] HID: steelseries: Fix Arctis 7 battery reading 3% on overlapping requests
Date: Fri, 4 Dec 2026 17:48:49 +0700	[thread overview]
Message-ID: <4cc9a208-fce2-47ee-8ce4-d1d6f3097fa0@gmail.com> (raw)
In-Reply-To: <20261203-arctis7-battery-v2-1-5ea29f516329@netixx.it>

Thank you, I can confirm this patch fixes the transmitter disappearing 
when turning off the headset. Tested on Arch Linux kernel 7.3.6.

Tested-by: Trần Nam Tuấn <billtran1632001@gmail.com>

On 12/4/26 1:23 AM, Martin Oberleiter via B4 Relay wrote:
> From: Martin Oberleiter <martin.oberleiter@netixx.it>
> 
> The Arctis 7 (2018) status poll sends the connection (0x14) and battery
> (0x18) requests back to back. The transmitter answers the connection
> request within about a millisecond, but if the battery request arrives
> before that answer has gone out, it sends the connection reply relabeled
> with the 0x18 command byte. The "connected" status byte (0x03) is then
> parsed as a battery level of 3%, followed some 30 ms later by the real
> battery reply:
> 
>    req 06 14
>    req 06 18
>    rx  06 18 03 19 01 ...   <- connection reply, relabeled
>    rx  06 18 4b 00 c8 ...   <- real battery reply (75%)
> 
> On a 1038:12ad transmitter this happened on roughly every third poll, so
> the reported capacity flipped between 3% and the real value every few
> seconds and the desktop kept raising low battery notifications.
> 
> Since the same driver change, users have also reported the transmitter
> flooding the log with "input irq status -75 received", its port being
> "disabled by hub (EMI?)", and the transmitter disappearing when the
> headset is switched off, as tracked in the bug below. The -75 flood and
> the port disable were seen here too, shortly after plugging in the
> transmitter with the unpatched driver, and have not been seen with this
> patch applied. Users in the bug report confirm that the patch resolves
> the disconnects for them.
> 
> Wait for the connection reply before sending the battery request, and
> only send it if that reply says the headset is connected. The driver's
> battery request then no longer overlaps its connection request, and it
> is not sent once the transmitter has reported the headset as off (the
> transmitter answers it with 0 in that state). If no connection reply
> arrives within 100 ms, skip the battery request for this poll. Waiting
> for the reply rather than sleeping for a fixed time avoids guessing how
> long the transmitter takes to answer.
> 
> Userspace talking to the transmitter through hidraw at the same time
> (e.g. HeadsetControl) can still overlap with the driver's requests;
> that is not addressed here.
> 
> Tested on a 1038:12ad transmitter: the capacity stays stable while the
> headset is on, keeps its last value when it is switched off, and shows
> the real value right after it is switched back on.
> 
> The issue was diagnosed and the fix and this changelog were written
> with the help of an AI coding assistant (Claude Code), from kernel logs
> and instrumented builds of the driver on the affected hardware.
> 
> Fixes: 7e749a797282 ("HID: steelseries: Add support for Arctis 7 (2018)")
> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=222298
> Cc: stable@vger.kernel.org
> Signed-off-by: Martin Oberleiter <martin.oberleiter@netixx.it>
> ---
> Changes in v2:
> - Rebased onto hid.git for-7.4/upstream-fixes. No code changes.
> - Changelog now also covers the -75 floods, port disables and
>    disconnects tracked in bugzilla 222298, which users there report
>    this patch fixes; added Closes: and Cc: stable.
> 
> Erik, I missed your "[PATCH] HID: steelseries: space Arctis 7 status
> requests" from 24 October when I sent v1, sorry about that. Both patches
> target the same overlap. Yours spaces the two requests by 10 ms; this one
> waits for the connection reply and does not ask for the battery while
> the headset is off. I'm happy to go with whichever you and the
> maintainers prefer. The testers in bug 222298 ran this one.
> 
> Michal, thanks for raising the -75 reports on the list. The transmitter
> here showed both the -75 flood and "disabled by hub (EMI?)" with the
> unpatched driver, on a root port and not behind a hub, and neither
> again since running this patch.
> 
> On for-next, the patch has a trivial context conflict with the Arctis
> Pro Wireless support patch, as both add an include next to
> linux/device.h.
> ---
>   drivers/hid/hid-steelseries-arctis.c | 32 ++++++++++++++++++++++++++++++++
>   1 file changed, 32 insertions(+)
> 
> diff --git a/drivers/hid/hid-steelseries-arctis.c b/drivers/hid/hid-steelseries-arctis.c
> index df61fa33d..7b83ff8a3 100644
> --- a/drivers/hid/hid-steelseries-arctis.c
> +++ b/drivers/hid/hid-steelseries-arctis.c
> @@ -6,6 +6,7 @@
>    *  Copyright (c) 2026 Sriman Achanta
>    */
>   
> +#include <linux/completion.h>
>   #include <linux/device.h>
>   #include <linux/hid.h>
>   #include <linux/kref.h>
> @@ -47,6 +48,7 @@ struct steelseries_device {
>   	bool battery_charging;
>   
>   	spinlock_t lock;
> +	struct completion connection_reply;
>   	bool removed;
>   };
>   
> @@ -101,16 +103,44 @@ static int steelseries_arctis_1_request_status(struct hid_device *hdev)
>   	return steelseries_send_output_report(hdev, data, sizeof(data));
>   }
>   
> +#define STEELSERIES_ARCTIS_7_REPLY_TIMEOUT_MS	100
> +
>   static int steelseries_arctis_7_2018_request_status(struct hid_device *hdev)
>   {
> +	struct steelseries_device *sd = hid_get_drvdata(hdev);
>   	const u8 connection[] = { 0x06, 0x14 };
>   	const u8 battery[] = { 0x06, 0x18 };
> +	unsigned long flags;
> +	bool connected;
>   	int ret;
>   
> +	reinit_completion(&sd->connection_reply);
> +
>   	ret = steelseries_send_output_report(hdev, connection, sizeof(connection));
>   	if (ret)
>   		return ret;
>   
> +	/*
> +	 * A request that reaches the transmitter before it has answered the
> +	 * previous one is answered with that stale reply relabeled with the
> +	 * new command byte, so a "connected" (0x03) reply to 0x14 would read
> +	 * as 3% battery. With the headset off, the battery reply is 0. Only
> +	 * ask for the battery once the connection reply is in and says the
> +	 * headset is connected.
> +	 */
> +	if (!wait_for_completion_timeout(&sd->connection_reply,
> +					 msecs_to_jiffies(STEELSERIES_ARCTIS_7_REPLY_TIMEOUT_MS))) {
> +		hid_dbg(hdev, "No connection status reply, skipping battery request\n");
> +		return -ETIMEDOUT;
> +	}
> +
> +	spin_lock_irqsave(&sd->lock, flags);
> +	connected = sd->headset_connected;
> +	spin_unlock_irqrestore(&sd->lock, flags);
> +
> +	if (!connected)
> +		return 0;
> +
>   	return steelseries_send_output_report(hdev, battery, sizeof(battery));
>   }
>   
> @@ -175,6 +205,7 @@ static void steelseries_arctis_7_2018_parse_status(struct steelseries_device *sd
>   	case 0x14:
>   		/* 0x03 means that the headset is connected to the transmitter. */
>   		sd->headset_connected = data[2] == 0x03;
> +		complete(&sd->connection_reply);
>   		break;
>   	case 0x18:
>   		if (!sd->headset_connected)
> @@ -518,6 +549,7 @@ static int steelseries_arctis_probe(struct hid_device *hdev,
>   		sd->hdev = hdev;
>   		sd->info = info;
>   		spin_lock_init(&sd->lock);
> +		init_completion(&sd->connection_reply);
>   		INIT_DELAYED_WORK(&sd->status_work, steelseries_status_timer_work_handler);
>   
>   		ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
> 
> ---
> base-commit: b8d126a64d8e5f5f3b81ac3f5d89fb69d8954df7
> change-id: 20261029-arctis7-battery-1322f43fedce
> 
> Best regards,
> --
> Martin Oberleiter <martin.oberleiter@netixx.it>


      parent reply	other threads:[~2026-12-04 10:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 18:23 [PATCH v2] HID: steelseries: Fix Arctis 7 battery reading 3% on overlapping requests Martin Oberleiter via B4 Relay
2026-12-03 18:53 ` sashiko-bot
2026-12-04 10:48 ` Trần Nam Tuấn [this message]

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=4cc9a208-fce2-47ee-8ce4-d1d6f3097fa0@gmail.com \
    --to=billtran1632001@gmail.com \
    --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