diff mbox

HID: sony: Fix SHANWAN pad rumbling on USB

Message ID 20171107142447.11810-1-hadess@hadess.net (mailing list archive)
State New, archived
Headers show

Commit Message

Bastien Nocera Nov. 7, 2017, 2:24 p.m. UTC
The SHANWAN PS3 clone joypad will start its rumble motors as soon as
it is plugged in via USB. As the additional USB interrupt does nothing on
the original PS3 Sixaxis joypads, and makes a number of other
clone joypads actually start sending data, disable that call for
the SHANWAN so the rumble motors aren't started on plug.

Signed-off-by: Bastien Nocera <hadess@hadess.net>
---
 drivers/hid/hid-sony.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

Comments

Szymon Janc Nov. 9, 2017, 8:24 a.m. UTC | #1
Hi,

On Tuesday, 7 November 2017 15:24:47 CET Bastien Nocera wrote:
> The SHANWAN PS3 clone joypad will start its rumble motors as soon as
> it is plugged in via USB. As the additional USB interrupt does nothing on
> the original PS3 Sixaxis joypads, and makes a number of other
> clone joypads actually start sending data, disable that call for
> the SHANWAN so the rumble motors aren't started on plug.
> 
> Signed-off-by: Bastien Nocera <hadess@hadess.net>
> ---
>  drivers/hid/hid-sony.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
> index d03203a82e8f..b9dc3ac4d4aa 100644
> --- a/drivers/hid/hid-sony.c
> +++ b/drivers/hid/hid-sony.c
> @@ -1439,10 +1439,16 @@ static int sixaxis_set_operational_usb(struct
> hid_device *hdev) goto out;
>  	}
> 
> -	ret = hid_hw_output_report(hdev, buf, 1);
> -	if (ret < 0) {
> -		hid_info(hdev, "can't set operational mode: step 3, ignoring\n");
> -		ret = 0;
> +	/*
> +	 * But the USB interrupt would cause SHANWAN controllers to
> +	 * start rumbling non-stop.
> +	 */
> +	if (strcmp(hdev->name, "SHANWAN PS3 GamePad")) {
> +		ret = hid_hw_output_report(hdev, buf, 1);
> +		if (ret < 0) {
> +			hid_info(hdev, "can't set operational mode: step 3, ignoring\n");
> +			ret = 0;
> +		}
>  	}
> 
>  out:

Works for me!

Tested-by: Szymon Janc <szymon.janc@codecoup.pl>
Jiri Kosina Nov. 9, 2017, 12:32 p.m. UTC | #2
On Tue, 7 Nov 2017, Bastien Nocera wrote:

> The SHANWAN PS3 clone joypad will start its rumble motors as soon as
> it is plugged in via USB. As the additional USB interrupt does nothing on
> the original PS3 Sixaxis joypads, and makes a number of other
> clone joypads actually start sending data, disable that call for
> the SHANWAN so the rumble motors aren't started on plug.
> 
> Signed-off-by: Bastien Nocera <hadess@hadess.net>

Applied to for-4.15/sony.
diff mbox

Patch

diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index d03203a82e8f..b9dc3ac4d4aa 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -1439,10 +1439,16 @@  static int sixaxis_set_operational_usb(struct hid_device *hdev)
 		goto out;
 	}
 
-	ret = hid_hw_output_report(hdev, buf, 1);
-	if (ret < 0) {
-		hid_info(hdev, "can't set operational mode: step 3, ignoring\n");
-		ret = 0;
+	/*
+	 * But the USB interrupt would cause SHANWAN controllers to
+	 * start rumbling non-stop.
+	 */
+	if (strcmp(hdev->name, "SHANWAN PS3 GamePad")) {
+		ret = hid_hw_output_report(hdev, buf, 1);
+		if (ret < 0) {
+			hid_info(hdev, "can't set operational mode: step 3, ignoring\n");
+			ret = 0;
+		}
 	}
 
 out: