[PATCH 4/4] HID: sony: report the battery of Rock Band 4 PS5 drums
From: Sanjay Govind
Date: Mon Nov 30 2026 - 21:10:11 EST
Rock Band 4 PS5 drum kits report their battery state in byte 30 of
their input report, encoded the same way as on Rock Band 4 PS5
guitars. The Stage Tour drum kit reports its battery level there, for
example 0x19 (charging, level 9) when connected over USB.
Move the decoding of this byte out of the PS5 guitar handler into a
helper, and use it for PS5 drum kits as well. Like the guitars, these
kits have no MAC address, so give them a device ID to keep the name of
their battery unique.
Signed-off-by: Sanjay Govind <sanjay.govind9@xxxxxxxxx>
---
Notes:
Depends on the series fixing the RB4 PS5 guitar battery reporting
("HID: sony: handle RB4 PS5 guitars that do not report a battery
level" and "HID: sony: fix battery name clash between RB4 PS5
guitars").
Tested on a Stage Tour drum kit in PS5 mode (3958:d600):
- Over USB, it reports 0x19 in byte 30 and its battery is reported as
charging at 95%.
- Through its wireless dongle, which uses the same USB ID, it reports
0x08 and its battery is reported as discharging at 85%.
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 | 67 ++++++++++++++++++++++++------------------
1 file changed, 38 insertions(+), 29 deletions(-)
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 4e68eb11c418..55662d163f57 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -82,7 +82,7 @@
#define SONY_LED_SUPPORT (SIXAXIS_CONTROLLER | BUZZ_CONTROLLER |\
MOTION_CONTROLLER | NAVIGATION_CONTROLLER)
#define SONY_BATTERY_SUPPORT (SIXAXIS_CONTROLLER | MOTION_CONTROLLER_BT | NAVIGATION_CONTROLLER |\
- RB4_GUITAR_PS5)
+ RB4_GUITAR_PS5 | RB4_DRUMS_PS5)
#define SONY_FF_SUPPORT (SIXAXIS_CONTROLLER | MOTION_CONTROLLER)
#define SONY_BT_DEVICE (SIXAXIS_CONTROLLER_BT | MOTION_CONTROLLER_BT | NAVIGATION_CONTROLLER_BT)
#define NSG_MRXU_REMOTE (NSG_MR5U_REMOTE_BT | NSG_MR7U_REMOTE_BT)
@@ -1165,38 +1165,24 @@ static int rb4_ps4_guitar_raw_event(struct sony_sc *sc, u8 *rd, int size)
return 0;
}
-static int rb4_ps5_guitar_raw_event(struct sony_sc *sc, u8 *rd, int size)
+/*
+ * Rock Band 4 PS5 instruments report the battery status and level at byte 30
+ * of their input report.
+ */
+static void rb4_ps5_parse_battery(struct sony_sc *sc, u8 data)
{
u8 charging_status;
u8 battery_data;
u8 battery_capacity;
u8 battery_status;
- if (unlikely(size != 64 || rd[0] != 0x01))
- return 0;
-
- /*
- * Rock Band 4 PS5 guitars have whammy and
- * tilt functionality, they're located at
- * byte 41 and 42 respectively.
- *
- * We will map these values to the triggers
- * because the guitars don't have anything
- * mapped there.
- */
- input_report_abs(sc->input_dev, ABS_Z, rd[41]);
- input_report_abs(sc->input_dev, ABS_RZ, rd[42]);
-
- /*
- * Rock Band 4 PS5 guitars also report the
- * battery status and level at byte 30.
- */
- charging_status = (rd[30] >> 4) & 0x0F;
- battery_data = rd[30] & 0x0F;
+ charging_status = (data >> 4) & 0x0F;
+ battery_data = data & 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.
+ * A level of 0x0c means that the instrument does not report its
+ * battery level. Keep the capacity at 100% to avoid low battery
+ * warnings.
*/
if (battery_data == 0x0c) {
battery_capacity = 100;
@@ -1228,6 +1214,26 @@ static int rb4_ps5_guitar_raw_event(struct sony_sc *sc, u8 *rd, int size)
sc->battery_capacity = battery_capacity;
sc->battery_status = battery_status;
}
+}
+
+static int rb4_ps5_guitar_raw_event(struct sony_sc *sc, u8 *rd, int size)
+{
+ if (unlikely(size != 64 || rd[0] != 0x01))
+ return 0;
+
+ /*
+ * Rock Band 4 PS5 guitars have whammy and
+ * tilt functionality, they're located at
+ * byte 41 and 42 respectively.
+ *
+ * We will map these values to the triggers
+ * because the guitars don't have anything
+ * mapped there.
+ */
+ input_report_abs(sc->input_dev, ABS_Z, rd[41]);
+ input_report_abs(sc->input_dev, ABS_RZ, rd[42]);
+
+ rb4_ps5_parse_battery(sc, rd[30]);
input_sync(sc->input_dev);
return 0;
@@ -1267,6 +1273,9 @@ static int rb4_drums_raw_event(struct sony_sc *sc, u8 *rd, int size)
input_report_abs(input, rb4_drums_velocity_absmap[i],
rd[velocity_offset + i]);
+ if (sc->quirks & RB4_DRUMS_PS5)
+ rb4_ps5_parse_battery(sc, rd[30]);
+
/*
* hid-input syncs these events together with the buttons of the same
* report, so that each hit arrives as a single frame.
@@ -2005,7 +2014,7 @@ static int sony_battery_probe(struct sony_sc *sc, int append_dev_id)
int ret;
/*
- * Devices without a MAC address, such as Rock Band 4 PS5 guitars,
+ * Devices without a MAC address, such as Rock Band 4 PS5 instruments,
* would all get the same name, so use the device ID to tell them
* apart.
*/
@@ -2186,10 +2195,10 @@ static int sony_set_device_id(struct sony_sc *sc)
int ret;
/*
- * Only Sixaxis controllers, and Rock Band 4 PS5 guitars which need it
- * to name their battery, get an id. All others are set to -1.
+ * Only Sixaxis controllers, and Rock Band 4 PS5 instruments which need
+ * it to name their battery, get an id. All others are set to -1.
*/
- if (sc->quirks & (SIXAXIS_CONTROLLER | RB4_GUITAR_PS5)) {
+ if (sc->quirks & (SIXAXIS_CONTROLLER | RB4_GUITAR_PS5 | RB4_DRUMS_PS5)) {
ret = ida_alloc(&sony_device_id_allocator, GFP_KERNEL);
if (ret < 0) {
sc->device_id = -1;
--
2.56.1