From: Sanjay Govind <sanjay.govind9@gmail.com>
To: Jiri Kosina <jikos@kernel.org>,
Benjamin Tissoires <bentiss@kernel.org>,
linux-input@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
Rosalie Wanders <rosalie@mailbox.org>,
Sanjay Govind <sanjay.govind9@gmail.com>,
stable@vger.kernel.org
Subject: [PATCH 1/2] HID: sony: handle RB4 PS5 guitars that do not report a battery level
Date: Tue, 1 Dec 2026 15:07:04 +1300 [thread overview]
Message-ID: <20261201020704.3545243-3-sanjay.govind9@gmail.com> (raw)
In-Reply-To: <20261201020704.3545243-2-sanjay.govind9@gmail.com>
Rock Band 4 PS5 guitars report their battery state in byte 30 of the
input report, with the charging status in the high nibble and the
battery level, from 0 to 10, in the low nibble. A level of 0x0c means
that the guitar does not report its battery level, which is what the
CRKD Gibson SG and the RedOctane Games Gibson Kramer always send when
connected over USB. SDL handles this level the same way for PS5
controllers.
This is currently decoded as a discharging battery at 100%, as the
capacity is clamped. Report an unknown status instead whenever the
level is 0x0c. Keep the capacity at 100% so that this does not cause
low battery warnings.
Fixes: e4bdeaef0351 ("HID: sony: add battery status support for Rock Band 4 PS5 guitars")
Cc: stable@vger.kernel.org
Signed-off-by: Sanjay Govind <sanjay.govind9@gmail.com>
---
Notes:
Tested with a Gibson SG (3651:8600) and a Gibson Kramer (3958:5600),
both in PS5 mode over USB, which always report 0x0c in byte 30. Before
this patch their batteries were reported as discharging at 100%; with
it, they are reported as unknown at 100%.
Built hid-sony.ko with W=1 against the 7.3.6 headers, no warnings;
checkpatch clean.
The patch and changelog were written with the help of an AI coding
assistant (Claude Opus 5.5).
drivers/hid/hid-sony.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 50f5ad6bbeb4..7a25f5acce88 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -1159,6 +1159,16 @@ static int rb4_ps5_guitar_raw_event(struct sony_sc *sc, u8 *rd, int size)
charging_status = (rd[30] >> 4) & 0x0F;
battery_data = rd[30] & 0x0F;
+ /*
+ * A level of 0x0c means that the guitar does not report its battery
+ * level. Keep the capacity at 100% to avoid low battery warnings.
+ */
+ if (battery_data == 0x0c) {
+ battery_capacity = 100;
+ battery_status = POWER_SUPPLY_STATUS_UNKNOWN;
+ goto out;
+ }
+
switch (charging_status) {
case 0x0:
battery_capacity = min(battery_data * 10 + 5, 100);
@@ -1178,6 +1188,7 @@ static int rb4_ps5_guitar_raw_event(struct sony_sc *sc, u8 *rd, int size)
break;
}
+out:
scoped_guard(spinlock_irqsave, &sc->lock) {
sc->battery_capacity = battery_capacity;
sc->battery_status = battery_status;
--
2.56.1
next prev parent reply other threads:[~2026-12-01 2:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 2:07 [PATCH 0/2] HID: sony: fix RB4 PS5 guitar battery handling Sanjay Govind
2026-12-01 2:07 ` Sanjay Govind [this message]
2026-12-01 2:07 ` [PATCH 2/2] HID: sony: fix battery name clash between RB4 PS5 guitars Sanjay Govind
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=20261201020704.3545243-3-sanjay.govind9@gmail.com \
--to=sanjay.govind9@gmail.com \
--cc=bentiss@kernel.org \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rosalie@mailbox.org \
--cc=stable@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
all inboxes | Powered by JetHome®