Skip to content

Commit 32e411d

Browse files
sanjay900Jiri Kosina
authored andcommitted
HID: sony: Add support for tilt on guitar hero guitars
This commit adds support for tilt on Standard Guitar Hero PS3 Guitars, and GH3 PC Guitars, mapping it to ABS_RY. Note that GH3 PC Guitars are identical, only they use different VID and PIDs. Also note that vendor id 0x12ba is used by a variety of different rhythm controllers on the ps3. Signed-off-by: Sanjay Govind <sanjay.govind9@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
1 parent 2bbe17a commit 32e411d

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

drivers/hid/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -909,6 +909,7 @@ config HID_SONY
909909
* Sony PS3 Blue-ray Disk Remote Control (Bluetooth)
910910
* Logitech Harmony adapter for Sony Playstation 3 (Bluetooth)
911911
* Guitar Hero Live PS3 and Wii U guitar dongles
912+
* Guitar Hero PS3 and PC guitar dongles
912913

913914
config SONY_FF
914915
bool "Sony PS2/3/4 accessories force feedback support"

drivers/hid/hid-ids.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
#define USB_VENDOR_ID_ACTIONSTAR 0x2101
4141
#define USB_DEVICE_ID_ACTIONSTAR_1011 0x1011
4242

43+
#define USB_VENDOR_ID_ACTIVISION 0x1430
44+
#define USB_DEVICE_ID_ACTIVISION_GUITAR_DONGLE 0x474c
45+
4346
#define USB_VENDOR_ID_ADS_TECH 0x06e1
4447
#define USB_DEVICE_ID_ADS_TECH_RADIO_SI470X 0xa155
4548

@@ -1078,8 +1081,9 @@
10781081
#define USB_DEVICE_ID_SONY_BUZZ_CONTROLLER 0x0002
10791082
#define USB_DEVICE_ID_SONY_WIRELESS_BUZZ_CONTROLLER 0x1000
10801083

1081-
#define USB_VENDOR_ID_SONY_GHLIVE 0x12ba
1084+
#define USB_VENDOR_ID_SONY_RHYTHM 0x12ba
10821085
#define USB_DEVICE_ID_SONY_PS3WIIU_GHLIVE_DONGLE 0x074b
1086+
#define USB_DEVICE_ID_SONY_PS3_GUITAR_DONGLE 0x0100
10831087

10841088
#define USB_VENDOR_ID_SINO_LITE 0x1345
10851089
#define USB_DEVICE_ID_SINO_LITE_CONTROLLER 0x3008

drivers/hid/hid-sony.c

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* Copyright (c) 2014-2016 Frank Praznik <frank.praznik@gmail.com>
1313
* Copyright (c) 2018 Todd Kelner
1414
* Copyright (c) 2020 Pascal Giard <pascal.giard@etsmtl.ca>
15+
* Copyright (c) 2020 Sanjay Govind <sanjay.govind9@gmail.com>
1516
*/
1617

1718
/*
@@ -59,7 +60,8 @@
5960
#define NSG_MR5U_REMOTE_BT BIT(14)
6061
#define NSG_MR7U_REMOTE_BT BIT(15)
6162
#define SHANWAN_GAMEPAD BIT(16)
62-
#define GHL_GUITAR_PS3WIIU BIT(17)
63+
#define GH_GUITAR_CONTROLLER BIT(17)
64+
#define GHL_GUITAR_PS3WIIU BIT(18)
6365

6466
#define SIXAXIS_CONTROLLER (SIXAXIS_CONTROLLER_USB | SIXAXIS_CONTROLLER_BT)
6567
#define MOTION_CONTROLLER (MOTION_CONTROLLER_USB | MOTION_CONTROLLER_BT)
@@ -84,7 +86,7 @@
8486
#define NSG_MRXU_MAX_Y 1868
8587

8688
#define GHL_GUITAR_POKE_INTERVAL 10 /* In seconds */
87-
#define GHL_GUITAR_TILT_USAGE 44
89+
#define GUITAR_TILT_USAGE 44
8890

8991
/* Magic value and data taken from GHLtarUtility:
9092
* https://github.com/ghlre/GHLtarUtility/blob/master/PS3Guitar.cs
@@ -692,7 +694,7 @@ static int guitar_mapping(struct hid_device *hdev, struct hid_input *hi,
692694
if ((usage->hid & HID_USAGE_PAGE) == HID_UP_MSVENDOR) {
693695
unsigned int abs = usage->hid & HID_USAGE;
694696

695-
if (abs == GHL_GUITAR_TILT_USAGE) {
697+
if (abs == GUITAR_TILT_USAGE) {
696698
hid_map_usage_clear(hi, usage, bit, max, EV_ABS, ABS_RY);
697699
return 1;
698700
}
@@ -1481,7 +1483,7 @@ static int sony_mapping(struct hid_device *hdev, struct hid_input *hi,
14811483
if (sc->quirks & DUALSHOCK4_CONTROLLER)
14821484
return ds4_mapping(hdev, hi, field, usage, bit, max);
14831485

1484-
if (sc->quirks & GHL_GUITAR_PS3WIIU)
1486+
if (sc->quirks & GH_GUITAR_CONTROLLER)
14851487
return guitar_mapping(hdev, hi, field, usage, bit, max);
14861488

14871489
/* Let hid-core decide for the others */
@@ -3167,8 +3169,14 @@ static const struct hid_device_id sony_devices[] = {
31673169
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SMK, USB_DEVICE_ID_SMK_NSG_MR7U_REMOTE),
31683170
.driver_data = NSG_MR7U_REMOTE_BT },
31693171
/* Guitar Hero Live PS3 and Wii U guitar dongles */
3170-
{ HID_USB_DEVICE(USB_VENDOR_ID_SONY_GHLIVE, USB_DEVICE_ID_SONY_PS3WIIU_GHLIVE_DONGLE),
3171-
.driver_data = GHL_GUITAR_PS3WIIU},
3172+
{ HID_USB_DEVICE(USB_VENDOR_ID_SONY_RHYTHM, USB_DEVICE_ID_SONY_PS3WIIU_GHLIVE_DONGLE),
3173+
.driver_data = GHL_GUITAR_PS3WIIU | GH_GUITAR_CONTROLLER },
3174+
/* Guitar Hero PC Guitar Dongle */
3175+
{ HID_USB_DEVICE(USB_VENDOR_ID_ACTIVISION, USB_DEVICE_ID_ACTIVISION_GUITAR_DONGLE),
3176+
.driver_data = GH_GUITAR_CONTROLLER },
3177+
/* Guitar Hero PS3 World Tour Guitar Dongle */
3178+
{ HID_USB_DEVICE(USB_VENDOR_ID_SONY_RHYTHM, USB_DEVICE_ID_SONY_PS3_GUITAR_DONGLE),
3179+
.driver_data = GH_GUITAR_CONTROLLER },
31723180
{ }
31733181
};
31743182
MODULE_DEVICE_TABLE(hid, sony_devices);

0 commit comments

Comments
 (0)