diff mbox series

HID: sony: Add support for tilt on guitar hero guitars

Message ID 20201130194314.89509-1-sanjay.govind9@gmail.com (mailing list archive)
State Superseded
Delegated to: Jiri Kosina
Headers show
Series HID: sony: Add support for tilt on guitar hero guitars | expand

Commit Message

sanjay.govind9@gmail.com Nov. 30, 2020, 7:43 p.m. UTC
From: Sanjay Govind <sanjay.govind9@gmail.com>

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>
---
 drivers/hid/Kconfig    |  1 +
 drivers/hid/hid-ids.h  |  6 +++++-
 drivers/hid/hid-sony.c | 18 +++++++++++++-----
 3 files changed, 19 insertions(+), 6 deletions(-)

Comments

kernel test robot Nov. 30, 2020, 10:30 p.m. UTC | #1
Hi,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on next-20201130]
[cannot apply to linus/master v5.10-rc6 v5.10-rc5 v5.10-rc4 v5.10-rc6]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/sanjay-govind9-gmail-com/HID-sony-Add-support-for-tilt-on-guitar-hero-guitars/20201201-034759
base:    c6b11acc5f85b6e11d128fad8e0b7b223aa7e33f
config: mips-randconfig-r025-20201130 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project dfcf1acf13226be0f599a7ab6b395b66dc9545d6)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install mips cross compiling tool for clang build
        # apt-get install binutils-mips-linux-gnu
        # https://github.com/0day-ci/linux/commit/509735c24c9155c108eaef80827a1d4c48aa57e3
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review sanjay-govind9-gmail-com/HID-sony-Add-support-for-tilt-on-guitar-hero-guitars/20201201-034759
        git checkout 509735c24c9155c108eaef80827a1d4c48aa57e3
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/hid/hid-sony.c:3172:19: error: use of undeclared identifier 'USB_VENDOR_ID_SONY_GHLIVE'
           { HID_USB_DEVICE(USB_VENDOR_ID_SONY_GHLIVE, USB_DEVICE_ID_SONY_PS3WIIU_GHLIVE_DONGLE),
                            ^
>> drivers/hid/hid-sony.c:3175:45: error: use of undeclared identifier 'USB_DEVICE_ID_ACTIVISION_GUITAR'
           { HID_USB_DEVICE(USB_VENDOR_ID_ACTIVISION, USB_DEVICE_ID_ACTIVISION_GUITAR),
                                                      ^
   2 errors generated.

vim +/USB_VENDOR_ID_SONY_GHLIVE +3172 drivers/hid/hid-sony.c

decd946c99f6b38 Frank Praznik             2015-11-11  3116  
bd28ce008bdc68e Jiri Slaby                2008-06-25  3117  static const struct hid_device_id sony_devices[] = {
816651a7d4a3266 Antonio Ospite            2010-05-03  3118  	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER),
816651a7d4a3266 Antonio Ospite            2010-05-03  3119  		.driver_data = SIXAXIS_CONTROLLER_USB },
35dca5b4a67a93b Jiri Kosina               2011-04-28  3120  	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_NAVIGATION_CONTROLLER),
4545ee0a70e49b7 Simon Wood                2015-06-17  3121  		.driver_data = NAVIGATION_CONTROLLER_USB },
6eabaaa09128169 Simon Wood                2015-06-17  3122  	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_NAVIGATION_CONTROLLER),
4545ee0a70e49b7 Simon Wood                2015-06-17  3123  		.driver_data = NAVIGATION_CONTROLLER_BT },
c5e0c1c4950f912 Frank Praznik             2015-05-05  3124  	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_MOTION_CONTROLLER),
b3bca326fa813e4 Simon Wood                2015-06-09  3125  		.driver_data = MOTION_CONTROLLER_USB },
a4afa8544d49237 Simon Wood                2015-06-03  3126  	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_MOTION_CONTROLLER),
b3bca326fa813e4 Simon Wood                2015-06-09  3127  		.driver_data = MOTION_CONTROLLER_BT },
816651a7d4a3266 Antonio Ospite            2010-05-03  3128  	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER),
816651a7d4a3266 Antonio Ospite            2010-05-03  3129  		.driver_data = SIXAXIS_CONTROLLER_BT },
cc6e0bbb47f02fd Jiri Kosina               2008-10-23  3130  	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE),
cc6e0bbb47f02fd Jiri Kosina               2008-10-23  3131  		.driver_data = VAIO_RDESC_CONSTANT },
a464918419f94a0 Fernando Luis Vázquez Cao 2013-01-15  3132  	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGP_MOUSE),
a464918419f94a0 Fernando Luis Vázquez Cao 2013-01-15  3133  		.driver_data = VAIO_RDESC_CONSTANT },
ef916ef5ef75fe0 Antonio Ospite            2016-02-09  3134  	/*
ef916ef5ef75fe0 Antonio Ospite            2016-02-09  3135  	 * Wired Buzz Controller. Reported as Sony Hub from its USB ID and as
ef916ef5ef75fe0 Antonio Ospite            2016-02-09  3136  	 * Logitech joystick from the device descriptor.
ef916ef5ef75fe0 Antonio Ospite            2016-02-09  3137  	 */
f04d51404f51947 Colin Leitner             2013-05-27  3138  	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_BUZZ_CONTROLLER),
f04d51404f51947 Colin Leitner             2013-05-27  3139  		.driver_data = BUZZ_CONTROLLER },
f04d51404f51947 Colin Leitner             2013-05-27  3140  	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_WIRELESS_BUZZ_CONTROLLER),
f04d51404f51947 Colin Leitner             2013-05-27  3141  		.driver_data = BUZZ_CONTROLLER },
078328da5d5dfbd Jiri Kosina               2013-06-13  3142  	/* PS3 BD Remote Control */
078328da5d5dfbd Jiri Kosina               2013-06-13  3143  	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_BDREMOTE),
078328da5d5dfbd Jiri Kosina               2013-06-13  3144  		.driver_data = PS3REMOTE },
078328da5d5dfbd Jiri Kosina               2013-06-13  3145  	/* Logitech Harmony Adapter for PS3 */
078328da5d5dfbd Jiri Kosina               2013-06-13  3146  	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_PS3),
078328da5d5dfbd Jiri Kosina               2013-06-13  3147  		.driver_data = PS3REMOTE },
68a49e51a4a9c50 Frank Praznik             2014-11-12  3148  	/* SMK-Link PS3 BD Remote Control */
68a49e51a4a9c50 Frank Praznik             2014-11-12  3149  	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SMK, USB_DEVICE_ID_SMK_PS3_BDREMOTE),
68a49e51a4a9c50 Frank Praznik             2014-11-12  3150  		.driver_data = PS3REMOTE },
0bd88dd3dd5e73e Frank Praznik             2014-01-11  3151  	/* Sony Dualshock 4 controllers for PS4 */
0bd88dd3dd5e73e Frank Praznik             2014-01-11  3152  	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS4_CONTROLLER),
8ab1676b614e4ef Frank Praznik             2014-01-16  3153  		.driver_data = DUALSHOCK4_CONTROLLER_USB },
0bd88dd3dd5e73e Frank Praznik             2014-01-11  3154  	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS4_CONTROLLER),
8ab1676b614e4ef Frank Praznik             2014-01-16  3155  		.driver_data = DUALSHOCK4_CONTROLLER_BT },
cf1015d65d7c8a5 Roderick Colenbrander     2016-10-07  3156  	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS4_CONTROLLER_2),
cf1015d65d7c8a5 Roderick Colenbrander     2016-10-07  3157  		.driver_data = DUALSHOCK4_CONTROLLER_USB },
cf1015d65d7c8a5 Roderick Colenbrander     2016-10-07  3158  	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS4_CONTROLLER_2),
cf1015d65d7c8a5 Roderick Colenbrander     2016-10-07  3159  		.driver_data = DUALSHOCK4_CONTROLLER_BT },
de66a1a04c25f25 Roderick Colenbrander     2016-11-23  3160  	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS4_CONTROLLER_DONGLE),
35f436c31ea81d2 Roderick Colenbrander     2017-03-07  3161  		.driver_data = DUALSHOCK4_DONGLE },
74500cc859431de Scott Moreau              2016-01-13  3162  	/* Nyko Core Controller for PS3 */
74500cc859431de Scott Moreau              2016-01-13  3163  	{ HID_USB_DEVICE(USB_VENDOR_ID_SINO_LITE, USB_DEVICE_ID_SINO_LITE_CONTROLLER),
74500cc859431de Scott Moreau              2016-01-13  3164  		.driver_data = SIXAXIS_CONTROLLER_USB | SINO_LITE_CONTROLLER },
b7289cb1cf99d43 Todd Kelner               2018-02-17  3165  	/* SMK-Link NSG-MR5U Remote Control */
b7289cb1cf99d43 Todd Kelner               2018-02-17  3166  	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SMK, USB_DEVICE_ID_SMK_NSG_MR5U_REMOTE),
b7289cb1cf99d43 Todd Kelner               2018-02-17  3167  		.driver_data = NSG_MR5U_REMOTE_BT },
b7289cb1cf99d43 Todd Kelner               2018-02-17  3168  	/* SMK-Link NSG-MR7U Remote Control */
b7289cb1cf99d43 Todd Kelner               2018-02-17  3169  	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SMK, USB_DEVICE_ID_SMK_NSG_MR7U_REMOTE),
b7289cb1cf99d43 Todd Kelner               2018-02-17  3170  		.driver_data = NSG_MR7U_REMOTE_BT },
cc894ac553605c9 Pascal Giard              2020-11-25  3171  	/* Guitar Hero Live PS3 and Wii U guitar dongles */
cc894ac553605c9 Pascal Giard              2020-11-25 @3172  	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY_GHLIVE, USB_DEVICE_ID_SONY_PS3WIIU_GHLIVE_DONGLE),
509735c24c9155c Sanjay Govind             2020-12-01  3173  		.driver_data = GHL_GUITAR_PS3WIIU | GH_GUITAR_CONTROLLER },
509735c24c9155c Sanjay Govind             2020-12-01  3174  	/* Guitar Hero PC Guitar Dongle */
509735c24c9155c Sanjay Govind             2020-12-01 @3175  	{ HID_USB_DEVICE(USB_VENDOR_ID_ACTIVISION, USB_DEVICE_ID_ACTIVISION_GUITAR),
509735c24c9155c Sanjay Govind             2020-12-01  3176  		.driver_data = GH_GUITAR_CONTROLLER },
509735c24c9155c Sanjay Govind             2020-12-01  3177  	/* Guitar Hero PS3 World Tour Guitar Dongle */
509735c24c9155c Sanjay Govind             2020-12-01  3178  	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY_RHYTHM, USB_DEVICE_ID_SONY_PS3_GUITAR_DONGLE),
509735c24c9155c Sanjay Govind             2020-12-01  3179  		.driver_data = GH_GUITAR_CONTROLLER },
bd28ce008bdc68e Jiri Slaby                2008-06-25  3180  	{ }
bd28ce008bdc68e Jiri Slaby                2008-06-25  3181  };
bd28ce008bdc68e Jiri Slaby                2008-06-25  3182  MODULE_DEVICE_TABLE(hid, sony_devices);
bd28ce008bdc68e Jiri Slaby                2008-06-25  3183  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 18b3ad50e1ca..02124c2c4b2e 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -908,6 +908,7 @@  config HID_SONY
 	  * Sony PS3 Blue-ray Disk Remote Control (Bluetooth)
 	  * Logitech Harmony adapter for Sony Playstation 3 (Bluetooth)
 	  * Guitar Hero Live PS3 and Wii U guitar dongles
+	  * Guitar Hero PS3 and PC guitar dongles
 
 config SONY_FF
 	bool "Sony PS2/3/4 accessories force feedback support" 
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index eee6e27d5f1e..3479ae7dd651 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -40,6 +40,9 @@ 
 #define USB_VENDOR_ID_ACTIONSTAR	0x2101
 #define USB_DEVICE_ID_ACTIONSTAR_1011	0x1011
 
+#define USB_VENDOR_ID_ACTIVISION	0x1430
+#define USB_DEVICE_ID_ACTIVISION_GUITAR_DONGLE	0x474c
+
 #define USB_VENDOR_ID_ADS_TECH		0x06e1
 #define USB_DEVICE_ID_ADS_TECH_RADIO_SI470X	0xa155
 
@@ -1074,8 +1077,9 @@ 
 #define USB_DEVICE_ID_SONY_BUZZ_CONTROLLER		0x0002
 #define USB_DEVICE_ID_SONY_WIRELESS_BUZZ_CONTROLLER	0x1000
 
-#define USB_VENDOR_ID_SONY_GHLIVE			0x12ba
+#define USB_VENDOR_ID_SONY_RHYTHM	0x12ba
 #define USB_DEVICE_ID_SONY_PS3WIIU_GHLIVE_DONGLE	0x074b
+#define USB_DEVICE_ID_SONY_PS3_GUITAR_DONGLE	0x0100
 
 #define USB_VENDOR_ID_SINO_LITE			0x1345
 #define USB_DEVICE_ID_SINO_LITE_CONTROLLER	0x3008
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 326c4bdbd0ea..94dca5a5d361 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -12,6 +12,7 @@ 
  *  Copyright (c) 2014-2016 Frank Praznik <frank.praznik@gmail.com>
  *  Copyright (c) 2018 Todd Kelner
  *  Copyright (c) 2020 Pascal Giard <pascal.giard@etsmtl.ca>
+ *  Copyright (c) 2020 Sanjay Govind <sanjay.govind9@gmail.com>
  */
 
 /*
@@ -59,7 +60,8 @@ 
 #define NSG_MR5U_REMOTE_BT        BIT(14)
 #define NSG_MR7U_REMOTE_BT        BIT(15)
 #define SHANWAN_GAMEPAD           BIT(16)
-#define GHL_GUITAR_PS3WIIU        BIT(17)
+#define GH_GUITAR_CONTROLLER      BIT(17)
+#define GHL_GUITAR_PS3WIIU        BIT(18)
 
 #define SIXAXIS_CONTROLLER (SIXAXIS_CONTROLLER_USB | SIXAXIS_CONTROLLER_BT)
 #define MOTION_CONTROLLER (MOTION_CONTROLLER_USB | MOTION_CONTROLLER_BT)
@@ -84,7 +86,7 @@ 
 #define NSG_MRXU_MAX_Y 1868
 
 #define GHL_GUITAR_POKE_INTERVAL 10 /* In seconds */
-#define GHL_GUITAR_TILT_USAGE 44
+#define GUITAR_TILT_USAGE 44
 
 /* Magic value and data taken from GHLtarUtility:
  * 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,
 	if ((usage->hid & HID_USAGE_PAGE) == HID_UP_MSVENDOR) {
 		unsigned int abs = usage->hid & HID_USAGE;
 
-		if (abs == GHL_GUITAR_TILT_USAGE) {
+		if (abs == GUITAR_TILT_USAGE) {
 			hid_map_usage_clear(hi, usage, bit, max, EV_ABS, ABS_RY);
 			return 1;
 		}
@@ -1481,7 +1483,7 @@  static int sony_mapping(struct hid_device *hdev, struct hid_input *hi,
 	if (sc->quirks & DUALSHOCK4_CONTROLLER)
 		return ds4_mapping(hdev, hi, field, usage, bit, max);
 
-	if (sc->quirks & GHL_GUITAR_PS3WIIU)
+	if (sc->quirks & GH_GUITAR_CONTROLLER)
 		return guitar_mapping(hdev, hi, field, usage, bit, max);
 
 	/* Let hid-core decide for the others */
@@ -3146,7 +3148,13 @@  static const struct hid_device_id sony_devices[] = {
 		.driver_data = NSG_MR7U_REMOTE_BT },
 	/* Guitar Hero Live PS3 and Wii U guitar dongles */
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY_GHLIVE, USB_DEVICE_ID_SONY_PS3WIIU_GHLIVE_DONGLE),
-		.driver_data = GHL_GUITAR_PS3WIIU},
+		.driver_data = GHL_GUITAR_PS3WIIU | GH_GUITAR_CONTROLLER },
+	/* Guitar Hero PC Guitar Dongle */
+	{ HID_USB_DEVICE(USB_VENDOR_ID_ACTIVISION, USB_DEVICE_ID_ACTIVISION_GUITAR),
+		.driver_data = GH_GUITAR_CONTROLLER },
+	/* Guitar Hero PS3 World Tour Guitar Dongle */
+	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY_RHYTHM, USB_DEVICE_ID_SONY_PS3_GUITAR_DONGLE),
+		.driver_data = GH_GUITAR_CONTROLLER },
 	{ }
 };
 MODULE_DEVICE_TABLE(hid, sony_devices);