Skip to content

Commit 2e18e78

Browse files
Rosalie241Jiri Kosina
authored andcommitted
HID: sony: add support for bluetooth Rock Band 4 PS4 guitars
This commit adds support for the PDP Jaguar and MadCatz Stratocaster. Signed-off-by: Rosalie Wanders <rosalie@mailbox.org> Signed-off-by: Jiri Kosina <jkosina@suse.com>
1 parent bbf9927 commit 2e18e78

2 files changed

Lines changed: 23 additions & 13 deletions

File tree

drivers/hid/hid-ids.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,6 +1106,11 @@
11061106
#define USB_DEVICE_ID_ORTEK_WKB2000 0x2000
11071107
#define USB_DEVICE_ID_ORTEK_IHOME_IMAC_A210S 0x8003
11081108

1109+
#define USB_VENDOR_ID_PDP 0x0e6F
1110+
#define USB_DEVICE_ID_PDP_PS4_JAGUAR 0x0173
1111+
#define USB_DEVICE_ID_PDP_PS4_RIFFMASTER 0x024a
1112+
#define USB_DEVICE_ID_PDP_PS5_RIFFMASTER 0x0249
1113+
11091114
#define USB_VENDOR_ID_PLANTRONICS 0x047f
11101115
#define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3210_SERIES 0xc055
11111116
#define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3220_SERIES 0xc056
@@ -1154,10 +1159,6 @@
11541159
#define USB_VENDOR_ID_POWERCOM 0x0d9f
11551160
#define USB_DEVICE_ID_POWERCOM_UPS 0x0002
11561161

1157-
#define USB_VENDOR_ID_PDP 0x0e6F
1158-
#define USB_DEVICE_ID_PDP_PS4_RIFFMASTER 0x024a
1159-
#define USB_DEVICE_ID_PDP_PS5_RIFFMASTER 0x0249
1160-
11611162
#define USB_VENDOR_ID_PRODIGE 0x05af
11621163
#define USB_DEVICE_ID_PRODIGE_CORDLESS 0x3062
11631164

@@ -1544,6 +1545,9 @@
15441545
#define USB_VENDOR_ID_RISO_KAGAKU 0x1294 /* Riso Kagaku Corp. */
15451546
#define USB_DEVICE_ID_RI_KA_WEBMAIL 0x1320 /* Webmail Notifier */
15461547

1548+
#define USB_VENDOR_ID_MADCATZ 0x0738
1549+
#define USB_DEVICE_ID_MADCATZ_PS4_STRATOCASTER 0x8261
1550+
15471551
#define USB_VENDOR_ID_MULTIPLE_1781 0x1781
15481552
#define USB_DEVICE_ID_RAPHNET_4NES4SNES_OLD 0x0a9d
15491553
#define USB_DEVICE_ID_PHOENIXRC 0x0898

drivers/hid/hid-sony.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@
6262
#define GH_GUITAR_CONTROLLER BIT(14)
6363
#define GHL_GUITAR_PS3WIIU BIT(15)
6464
#define GHL_GUITAR_PS4 BIT(16)
65-
#define RB4_GUITAR_PS4 BIT(17)
66-
#define RB4_GUITAR_PS5 BIT(18)
65+
#define RB4_GUITAR_PS4_USB BIT(17)
66+
#define RB4_GUITAR_PS4_BT BIT(18)
67+
#define RB4_GUITAR_PS5 BIT(19)
6768

6869
#define SIXAXIS_CONTROLLER (SIXAXIS_CONTROLLER_USB | SIXAXIS_CONTROLLER_BT)
6970
#define MOTION_CONTROLLER (MOTION_CONTROLLER_USB | MOTION_CONTROLLER_BT)
@@ -627,7 +628,6 @@ static int gh_guitar_mapping(struct hid_device *hdev, struct hid_input *hi,
627628
static int rb4_guitar_mapping(struct hid_device *hdev, struct hid_input *hi,
628629
struct hid_field *field, struct hid_usage *usage,
629630
unsigned long **bit, int *max)
630-
631631
{
632632
if ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON) {
633633
unsigned int key = usage->hid & HID_USAGE;
@@ -1041,7 +1041,10 @@ static int sony_raw_event(struct hid_device *hdev, struct hid_report *report,
10411041
} else if ((sc->quirks & NSG_MRXU_REMOTE) && rd[0] == 0x02) {
10421042
nsg_mrxu_parse_report(sc, rd, size);
10431043
return 1;
1044-
} else if ((sc->quirks & RB4_GUITAR_PS4) && rd[0] == 0x01 && size == 64) {
1044+
} else if ((sc->quirks & RB4_GUITAR_PS4_USB) && rd[0] == 0x01 && size == 64) {
1045+
rb4_ps4_guitar_parse_report(sc, rd, size);
1046+
return 1;
1047+
} else if ((sc->quirks & RB4_GUITAR_PS4_BT) && rd[0] == 0x01 && size == 78) {
10451048
rb4_ps4_guitar_parse_report(sc, rd, size);
10461049
return 1;
10471050
} else if ((sc->quirks & RB4_GUITAR_PS5) && rd[0] == 0x01 && size == 64) {
@@ -1098,7 +1101,7 @@ static int sony_mapping(struct hid_device *hdev, struct hid_input *hi,
10981101
if (sc->quirks & GH_GUITAR_CONTROLLER)
10991102
return gh_guitar_mapping(hdev, hi, field, usage, bit, max);
11001103

1101-
if (sc->quirks & RB4_GUITAR_PS4)
1104+
if (sc->quirks & (RB4_GUITAR_PS4_USB | RB4_GUITAR_PS4_BT))
11021105
return rb4_guitar_mapping(hdev, hi, field, usage, bit, max);
11031106

11041107
if (sc->quirks & RB4_GUITAR_PS5)
@@ -2119,8 +2122,6 @@ static int sony_input_configured(struct hid_device *hdev,
21192122

21202123
} else if (sc->quirks & MOTION_CONTROLLER) {
21212124
sony_init_output_report(sc, motion_send_output_report);
2122-
} else if (sc->quirks & (RB4_GUITAR_PS4 | RB4_GUITAR_PS5)) {
2123-
sc->input_dev = hidinput->input;
21242125
}
21252126

21262127
if (sc->quirks & SONY_LED_SUPPORT) {
@@ -2148,6 +2149,7 @@ static int sony_input_configured(struct hid_device *hdev,
21482149
goto err_close;
21492150
}
21502151

2152+
sc->input_dev = hidinput->input;
21512153
return 0;
21522154
err_close:
21532155
hid_hw_close(hdev);
@@ -2378,9 +2380,13 @@ static const struct hid_device_id sony_devices[] = {
23782380
.driver_data = GHL_GUITAR_PS4 | GH_GUITAR_CONTROLLER },
23792381
/* Rock Band 4 PS4 guitars */
23802382
{ HID_USB_DEVICE(USB_VENDOR_ID_PDP, USB_DEVICE_ID_PDP_PS4_RIFFMASTER),
2381-
.driver_data = RB4_GUITAR_PS4 },
2383+
.driver_data = RB4_GUITAR_PS4_USB },
23822384
{ HID_USB_DEVICE(USB_VENDOR_ID_CRKD, USB_DEVICE_ID_CRKD_PS4_GIBSON_SG),
2383-
.driver_data = RB4_GUITAR_PS4 },
2385+
.driver_data = RB4_GUITAR_PS4_USB },
2386+
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_PDP, USB_DEVICE_ID_PDP_PS4_JAGUAR),
2387+
.driver_data = RB4_GUITAR_PS4_BT },
2388+
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_PS4_STRATOCASTER),
2389+
.driver_data = RB4_GUITAR_PS4_BT },
23842390
/* Rock Band 4 PS5 guitars */
23852391
{ HID_USB_DEVICE(USB_VENDOR_ID_PDP, USB_DEVICE_ID_PDP_PS5_RIFFMASTER),
23862392
.driver_data = RB4_GUITAR_PS5 },

0 commit comments

Comments
 (0)