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, Sanjay Govind <sanjay.govind9@gmail.com>
Subject: [PATCH 2/4] HID: sony: add support for the Stage Tour drum kit
Date: Tue, 1 Dec 2026 15:09:21 +1300 [thread overview]
Message-ID: <20261201020922.3552247-4-sanjay.govind9@gmail.com> (raw)
In-Reply-To: <20261201020922.3552247-2-sanjay.govind9@gmail.com>
The RedOctane Games Stage Tour drum kit has PS4 (3958:d500) and PS5
(3958:d600) modes, in which it emulates a Rock Band 4 drum kit.
Each pad and cymbal hit sets the face button of its colour, so a pad
and the cymbal of the same colour cannot be told apart from the buttons
alone. The kit also reports a velocity for each pad and cymbal, at byte
43 onwards on PS4 and byte 40 onwards on PS5, which hid-core does not
map because the report descriptor declares them as vendor defined.
Report these velocities on the hat axes, as hid-wiimote does for its
drums, using the same axes as hid-wiimote for the red, blue, yellow and
green pads. The cymbals are reported on the remaining hat axes. As the
hat axes are now used for the velocities, decode the D-pad into
BTN_DPAD_* buttons instead. The kick pedals are L1 and R1, and are
already mapped by the instrument mapping.
These events are not synced by the raw event handler, so that hid-input
reports them in the same frame as the face buttons of the same report.
Signed-off-by: Sanjay Govind <sanjay.govind9@gmail.com>
---
Notes:
The report layouts come from the PlasticBand PS4 4-lane drums
documentation and the Santroller PS5 drum report definition.
Built hid-sony.ko with W=1 against the 7.3.6 headers, no warnings;
checkpatch clean.
Tested on a Stage Tour drum kit over USB in both modes:
- PS5 (3958:d600): input report 0x01 is 64 bytes with the hat in the
low nibble of byte 8 and the velocities at bytes 40-46.
- PS4 (3958:d500): input report 0x01 is 64 bytes with the hat in the
low nibble of byte 5 and the velocities at bytes 43-49.
In both modes the report descriptor declares the velocities as vendor
defined. Each pad and cymbal moves only its own hat axis with the
expected velocity (0-255) together with its face button, the kick pedal
reports BTN_TL, and the D-pad reports BTN_DPAD_*. Each hit reports its
velocity and face button in the same frame.
The patch and changelog were written with the help of an AI coding
assistant (Claude Opus 5.5).
drivers/hid/hid-ids.h | 2 +
drivers/hid/hid-quirks.c | 2 +
drivers/hid/hid-sony.c | 95 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 99 insertions(+)
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 9678145c4a6a..ae543eb43a6b 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -1276,6 +1276,8 @@
#define USB_VENDOR_ID_REDOCTANE_GAMES 0x3958
#define USB_DEVICE_ID_REDOCTANE_PS4_KRAMER 0x5500
#define USB_DEVICE_ID_REDOCTANE_PS5_KRAMER 0x5600
+#define USB_DEVICE_ID_REDOCTANE_PS4_STAGE_TOUR 0xd500
+#define USB_DEVICE_ID_REDOCTANE_PS5_STAGE_TOUR 0xd600
#define USB_VENDOR_ID_RETROUSB 0xf000
#define USB_DEVICE_ID_RETROUSB_SNES_RETROPAD 0x0003
diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c
index a0a41dbe3545..1ee79d77c917 100644
--- a/drivers/hid/hid-quirks.c
+++ b/drivers/hid/hid-quirks.c
@@ -711,6 +711,8 @@ static const struct hid_device_id hid_have_special_driver[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_CRKD, USB_DEVICE_ID_CRKD_PS5_GIBSON_SG_2026_DONGLE) },
{ HID_USB_DEVICE(USB_VENDOR_ID_REDOCTANE_GAMES, USB_DEVICE_ID_REDOCTANE_PS4_KRAMER) },
{ HID_USB_DEVICE(USB_VENDOR_ID_REDOCTANE_GAMES, USB_DEVICE_ID_REDOCTANE_PS5_KRAMER) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_REDOCTANE_GAMES, USB_DEVICE_ID_REDOCTANE_PS4_STAGE_TOUR) },
+ { HID_USB_DEVICE(USB_VENDOR_ID_REDOCTANE_GAMES, USB_DEVICE_ID_REDOCTANE_PS5_STAGE_TOUR) },
{ HID_USB_DEVICE(USB_VENDOR_ID_HARMONIX, USB_DEVICE_ID_HARMONIX_WII_RB1_DRUMS) },
{ HID_USB_DEVICE(USB_VENDOR_ID_HARMONIX, USB_DEVICE_ID_HARMONIX_WII_RB1_GUITAR) },
{ HID_USB_DEVICE(USB_VENDOR_ID_HARMONIX, USB_DEVICE_ID_HARMONIX_WII_RB2_DRUMS) },
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index a59470f80645..8f95df362850 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -71,6 +71,8 @@
#define RB4_GUITAR_PS5 BIT(20)
#define RB3_PRO_INSTRUMENT BIT(21)
#define DJH_TURNTABLE BIT(22)
+#define RB4_DRUMS_PS4_USB BIT(23)
+#define RB4_DRUMS_PS5 BIT(24)
#define SIXAXIS_CONTROLLER (SIXAXIS_CONTROLLER_USB | SIXAXIS_CONTROLLER_BT)
#define MOTION_CONTROLLER (MOTION_CONTROLLER_USB | MOTION_CONTROLLER_BT)
@@ -84,6 +86,8 @@
#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)
#define RB4_GUITAR_PS4 (RB4_GUITAR_PS4_USB | RB4_GUITAR_PS4_BT)
+#define RB4_DRUMS_PS4 (RB4_DRUMS_PS4_USB)
+#define RB4_DRUMS (RB4_DRUMS_PS4 | RB4_DRUMS_PS5)
#define MAX_LEDS 4
#define NSG_MRXU_MAX_X 1667
@@ -444,6 +448,21 @@ static const unsigned int ps3_turntable_absmap[] = {
[0x35] = ABS_Y,
};
+/*
+ * Rock Band 4 drum kits report a velocity for each pad and cymbal. These
+ * are reported on the hat axes, following the hid-wiimote drums, in the
+ * order the velocities appear in the input report.
+ */
+static const unsigned int rb4_drums_velocity_absmap[] = {
+ ABS_HAT0X, /* Red pad */
+ ABS_HAT0Y, /* Blue pad */
+ ABS_HAT2X, /* Yellow pad */
+ ABS_HAT1X, /* Green pad */
+ ABS_HAT3Y, /* Yellow cymbal */
+ ABS_HAT1Y, /* Blue cymbal */
+ ABS_HAT2Y, /* Green cymbal */
+};
+
static const unsigned int instrument_keymap[] = {
[0x1] = BTN_WEST,
[0x2] = BTN_SOUTH,
@@ -744,6 +763,20 @@ static int rb4_guitar_mapping(struct hid_device *hdev, struct hid_input *hi,
return 0;
}
+static int rb4_drums_mapping(struct hid_device *hdev, struct hid_input *hi,
+ struct hid_field *field, struct hid_usage *usage,
+ unsigned long **bit, int *max)
+{
+ /*
+ * The hat axes carry the pad and cymbal velocities, so the D-pad is
+ * decoded into buttons by rb4_drums_raw_event() instead.
+ */
+ if (usage->hid == HID_GD_HATSWITCH)
+ return -1;
+
+ return 0;
+}
+
static const u8 *motion_fixup(struct hid_device *hdev, u8 *rdesc,
unsigned int *rsize)
{
@@ -1199,6 +1232,56 @@ static int rb4_ps5_guitar_raw_event(struct sony_sc *sc, u8 *rd, int size)
return 0;
}
+static int rb4_drums_raw_event(struct sony_sc *sc, u8 *rd, int size)
+{
+ struct input_dev *input = sc->input_dev;
+ int hat_offset, velocity_offset;
+ u8 hat;
+ int i;
+
+ if (unlikely(size != 64 || rd[0] != 0x01))
+ return 0;
+
+ if (sc->quirks & RB4_DRUMS_PS5) {
+ hat_offset = 8;
+ velocity_offset = 40;
+ } else {
+ hat_offset = 5;
+ velocity_offset = 43;
+ }
+
+ /* 0 is up, counting clockwise in steps of 45 degrees, 8 is centered */
+ hat = rd[hat_offset] & 0x0f;
+ input_report_key(input, BTN_DPAD_UP, hat == 7 || hat <= 1);
+ input_report_key(input, BTN_DPAD_RIGHT, hat >= 1 && hat <= 3);
+ input_report_key(input, BTN_DPAD_DOWN, hat >= 3 && hat <= 5);
+ input_report_key(input, BTN_DPAD_LEFT, hat >= 5 && hat <= 7);
+
+ for (i = 0; i < ARRAY_SIZE(rb4_drums_velocity_absmap); i++)
+ input_report_abs(input, rb4_drums_velocity_absmap[i],
+ rd[velocity_offset + i]);
+
+ /*
+ * hid-input syncs these events together with the buttons of the same
+ * report, so that each hit arrives as a single frame.
+ */
+ return 0;
+}
+
+static void rb4_drums_setup_input(struct input_dev *input)
+{
+ int i;
+
+ input_set_capability(input, EV_KEY, BTN_DPAD_UP);
+ input_set_capability(input, EV_KEY, BTN_DPAD_DOWN);
+ input_set_capability(input, EV_KEY, BTN_DPAD_LEFT);
+ input_set_capability(input, EV_KEY, BTN_DPAD_RIGHT);
+
+ for (i = 0; i < ARRAY_SIZE(rb4_drums_velocity_absmap); i++)
+ input_set_abs_params(input, rb4_drums_velocity_absmap[i],
+ 0, 255, 0, 0);
+}
+
static int sony_raw_event(struct hid_device *hdev, struct hid_report *report,
u8 *rd, int size)
{
@@ -1277,6 +1360,9 @@ static int sony_mapping(struct hid_device *hdev, struct hid_input *hi,
if (sc->quirks & RB4_GUITAR_PS5)
return rb4_guitar_mapping(hdev, hi, field, usage, bit, max);
+ if (sc->quirks & RB4_DRUMS)
+ return rb4_drums_mapping(hdev, hi, field, usage, bit, max);
+
/* Let hid-core decide for the others */
return 0;
}
@@ -2308,6 +2394,9 @@ static int sony_input_configured(struct hid_device *hdev,
sony_init_raw_event_handler(sc, rb4_ps4_guitar_raw_event);
} else if (sc->quirks & RB4_GUITAR_PS5) {
sony_init_raw_event_handler(sc, rb4_ps5_guitar_raw_event);
+ } else if (sc->quirks & RB4_DRUMS) {
+ rb4_drums_setup_input(sc->input_dev);
+ sony_init_raw_event_handler(sc, rb4_drums_raw_event);
}
if (sc->quirks & SONY_LED_SUPPORT) {
@@ -2634,6 +2723,12 @@ static const struct hid_device_id sony_devices[] = {
.driver_data = RB4_GUITAR_PS5 | INSTRUMENT },
{ HID_USB_DEVICE(USB_VENDOR_ID_REDOCTANE_GAMES, USB_DEVICE_ID_REDOCTANE_PS5_KRAMER),
.driver_data = RB4_GUITAR_PS5 | INSTRUMENT },
+ /* Rock Band 4 PS4 drums */
+ { HID_USB_DEVICE(USB_VENDOR_ID_REDOCTANE_GAMES, USB_DEVICE_ID_REDOCTANE_PS4_STAGE_TOUR),
+ .driver_data = RB4_DRUMS_PS4_USB | INSTRUMENT },
+ /* Rock Band 4 PS5 drums */
+ { HID_USB_DEVICE(USB_VENDOR_ID_REDOCTANE_GAMES, USB_DEVICE_ID_REDOCTANE_PS5_STAGE_TOUR),
+ .driver_data = RB4_DRUMS_PS5 | INSTRUMENT },
{ }
};
MODULE_DEVICE_TABLE(hid, sony_devices);
--
2.56.1
next prev parent reply other threads:[~2026-12-01 2:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 2:09 [PATCH 0/4] HID: sony: add support for new CRKD and RedOctane Games instruments Sanjay Govind
2026-12-01 2:09 ` [PATCH 1/4] HID: sony: add IDs for the 2026 CRKD Gibson SG and Gibson Kramer guitars Sanjay Govind
2026-12-01 2:09 ` Sanjay Govind [this message]
2026-12-01 2:09 ` [PATCH 3/4] HID: sony: add support for the PDP and MadCatz Rock Band 4 PS4 drums Sanjay Govind
2026-12-01 2:09 ` [PATCH 4/4] HID: sony: report the battery of Rock Band 4 PS5 drums 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=20261201020922.3552247-4-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 \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.