diff mbox series

[v4,2/2] HID: sony: Fix SHANWAN PS3 GamePad rumble and led settings support

Message ID 20190109011809.16542-2-outmatch@gmail.com (mailing list archive)
State Mainlined
Commit d03213f1287bcf3ad0102837694f021847737a0d
Delegated to: Jiri Kosina
Headers show
Series [v4,1/2] HID: sony: Transform one-time SHANWAN check into quirk | expand

Commit Message

Hongye Yuan Jan. 9, 2019, 1:18 a.m. UTC
Rumble support on SHANWAN PS3 gamepad is not working when a user
program has asked it to. If a HID Output Reports is sent via Control
Channel then it will be discard by gamepad, thus rumble motor and led
settings in Output Report are ignored.

This patch therefore sends HID Output Report via Interrupt Channel to
SHANWAN gamepad instead of Control Channel, fixing rumble motor and
led settings.

Signed-off-by: Hongye Yuan <outmatch@gmail.com>

---
 Changes in v4:
  - Explain what this patch fixes in detail.
---
 drivers/hid/hid-sony.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Comments

Bastien Nocera Jan. 9, 2019, 9:47 a.m. UTC | #1
On Wed, 2019-01-09 at 09:18 +0800, Hongye Yuan wrote:
> Rumble support on SHANWAN PS3 gamepad is not working when a user
> program has asked it to. If a HID Output Reports is sent via Control
> Channel then it will be discard by gamepad, thus rumble motor and led
> settings in Output Report are ignored.
> 
> This patch therefore sends HID Output Report via Interrupt Channel to
> SHANWAN gamepad instead of Control Channel, fixing rumble motor and
> led settings.

Excellent, exactly what I wanted to see in the commit message, thanks.

Reviewed-by: Bastien Nocera <hadess@hadess.net>

> 
> Signed-off-by: Hongye Yuan <outmatch@gmail.com>
> 
> ---
>  Changes in v4:
>   - Explain what this patch fixes in detail.
> ---
>  drivers/hid/hid-sony.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
> index fc82f02bae75..26fae90b931a 100644
> --- a/drivers/hid/hid-sony.c
> +++ b/drivers/hid/hid-sony.c
> @@ -2100,9 +2100,14 @@ static void sixaxis_send_output_report(struct
> sony_sc *sc)
>  		}
>  	}
>  
> -	hid_hw_raw_request(sc->hdev, report->report_id, (u8 *)report,
> -			sizeof(struct sixaxis_output_report),
> -			HID_OUTPUT_REPORT, HID_REQ_SET_REPORT);
> +	/* SHANWAN controllers require output reports via intr channel
> */
> +	if (sc->quirks & SHANWAN_GAMEPAD)
> +		hid_hw_output_report(sc->hdev, (u8 *)report,
> +				sizeof(struct sixaxis_output_report));
> +	else
> +		hid_hw_raw_request(sc->hdev, report->report_id, (u8
> *)report,
> +				sizeof(struct sixaxis_output_report),
> +				HID_OUTPUT_REPORT, HID_REQ_SET_REPORT);
>  }
>  
>  static void dualshock4_send_output_report(struct sony_sc *sc)
Benjamin Tissoires Jan. 9, 2019, 2:23 p.m. UTC | #2
On Wed, Jan 9, 2019 at 2:18 AM Hongye Yuan <outmatch@gmail.com> wrote:
>
> Rumble support on SHANWAN PS3 gamepad is not working when a user
> program has asked it to. If a HID Output Reports is sent via Control
> Channel then it will be discard by gamepad, thus rumble motor and led
> settings in Output Report are ignored.
>
> This patch therefore sends HID Output Report via Interrupt Channel to
> SHANWAN gamepad instead of Control Channel, fixing rumble motor and
> led settings.
>
> Signed-off-by: Hongye Yuan <outmatch@gmail.com>
>
> ---
>  Changes in v4:
>   - Explain what this patch fixes in detail.

Both patches applied to for-5.1/hid-sony

Thanks for quickly respinning the series.

Cheers,
Benjamin

> ---
>  drivers/hid/hid-sony.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
> index fc82f02bae75..26fae90b931a 100644
> --- a/drivers/hid/hid-sony.c
> +++ b/drivers/hid/hid-sony.c
> @@ -2100,9 +2100,14 @@ static void sixaxis_send_output_report(struct sony_sc *sc)
>                 }
>         }
>
> -       hid_hw_raw_request(sc->hdev, report->report_id, (u8 *)report,
> -                       sizeof(struct sixaxis_output_report),
> -                       HID_OUTPUT_REPORT, HID_REQ_SET_REPORT);
> +       /* SHANWAN controllers require output reports via intr channel */
> +       if (sc->quirks & SHANWAN_GAMEPAD)
> +               hid_hw_output_report(sc->hdev, (u8 *)report,
> +                               sizeof(struct sixaxis_output_report));
> +       else
> +               hid_hw_raw_request(sc->hdev, report->report_id, (u8 *)report,
> +                               sizeof(struct sixaxis_output_report),
> +                               HID_OUTPUT_REPORT, HID_REQ_SET_REPORT);
>  }
>
>  static void dualshock4_send_output_report(struct sony_sc *sc)
> --
> 2.20.1
>
diff mbox series

Patch

diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index fc82f02bae75..26fae90b931a 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -2100,9 +2100,14 @@  static void sixaxis_send_output_report(struct sony_sc *sc)
 		}
 	}
 
-	hid_hw_raw_request(sc->hdev, report->report_id, (u8 *)report,
-			sizeof(struct sixaxis_output_report),
-			HID_OUTPUT_REPORT, HID_REQ_SET_REPORT);
+	/* SHANWAN controllers require output reports via intr channel */
+	if (sc->quirks & SHANWAN_GAMEPAD)
+		hid_hw_output_report(sc->hdev, (u8 *)report,
+				sizeof(struct sixaxis_output_report));
+	else
+		hid_hw_raw_request(sc->hdev, report->report_id, (u8 *)report,
+				sizeof(struct sixaxis_output_report),
+				HID_OUTPUT_REPORT, HID_REQ_SET_REPORT);
 }
 
 static void dualshock4_send_output_report(struct sony_sc *sc)