diff mbox

[PATCHv4] HID: sony: Enable Gasia third-party PS3 controllers

Message ID 20150216150659.db522f3d.cand@gmx.com (mailing list archive)
State New, archived
Delegated to: Jiri Kosina
Headers show

Commit Message

Lauri Kasanen Feb. 16, 2015, 1:06 p.m. UTC
Without this, my "Gasia Co.,Ltd PS(R) Gamepad" would not send
any events. Now everything works including the leds.

Based on work by Andrew Haines and Antonio Ospite.

cc: Antonio Ospite <ao2@ao2.it>
cc: Andrew Haines <AndrewD207@aol.com>
Signed-off-by: Lauri Kasanen <cand@gmx.com>
---
 drivers/hid/hid-sony.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

Antonio: size 8 works.

v4:
- use size 8

v3:
- reuse the dummy heap buffer
- skip later checks if the earlier ones fail

v2:
- edited error messages
- use output_report

Comments

Antonio Ospite Feb. 16, 2015, 4:59 p.m. UTC | #1
On Mon, 16 Feb 2015 15:06:59 +0200
Lauri Kasanen <cand@gmx.com> wrote:

> Without this, my "Gasia Co.,Ltd PS(R) Gamepad" would not send
> any events. Now everything works including the leds.
> 
> Based on work by Andrew Haines and Antonio Ospite.
> 
> cc: Antonio Ospite <ao2@ao2.it>
> cc: Andrew Haines <AndrewD207@aol.com>
> Signed-off-by: Lauri Kasanen <cand@gmx.com>

Reviewed-by: Antonio Ospite <ao2@ao2.it>

Original controllers still work fine after this change.
Some follow-up patches are on their way.

Thanks,
   Antonio

> ---
>  drivers/hid/hid-sony.c | 22 +++++++++++++++++++++-
>  1 file changed, 21 insertions(+), 1 deletion(-)
> 
> Antonio: size 8 works.
> 
> v4:
> - use size 8
> 
> v3:
> - reuse the dummy heap buffer
> - skip later checks if the earlier ones fail
> 
> v2:
> - edited error messages
> - use output_report
> 
> diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
> index 31e9d25..f3d44e5 100644
> --- a/drivers/hid/hid-sony.c
> +++ b/drivers/hid/hid-sony.c
> @@ -1139,9 +1139,29 @@ static int sixaxis_set_operational_usb(struct hid_device *hdev)
>  	ret = hid_hw_raw_request(hdev, 0xf2, buf, 17, HID_FEATURE_REPORT,
>  				 HID_REQ_GET_REPORT);
>  
> +	if (ret < 0) {
> +		hid_err(hdev, "can't set operational mode: step 1\n");
> +		goto out;
> +	}
> +
> +	/*
> +	 * Some compatible controllers like the Speedlink Strike FX and
> +	 * Gasia need another query plus an USB interrupt to get operational.
> +	 */
> +	ret = hid_hw_raw_request(hdev, 0xf5, buf, 8, HID_FEATURE_REPORT,
> +				 HID_REQ_GET_REPORT);
> +
> +	if (ret < 0) {
> +		hid_err(hdev, "can't set operational mode: step 2\n");
> +		goto out;
> +	}
> +
> +	ret = hid_hw_output_report(hdev, buf, 1);
> +
>  	if (ret < 0)
> -		hid_err(hdev, "can't set operational mode\n");
> +		hid_err(hdev, "can't set operational mode: step 3\n");
>  
> +out:
>  	kfree(buf);
>  
>  	return ret;
> -- 
> 1.8.3.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-input" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Antonio Ospite Feb. 16, 2015, 5:12 p.m. UTC | #2
Hi,

here are a few cleanups for hid-sony.

Changes are meant to follow the patch titled:
[PATCHv4] HID: sony: Enable Gasia third-party PS3 controllers

Frank, hi, I'd like to have your explicit ack at least for patch 1 and
2.

Thanks,
   Antonio


Antonio Ospite (5):
  HID: sony: Fix a WARNING shown when rmmod-ing the driver
  HID: sony: Use the minimum accepted size for feature report 0xf2
  HID: sony: Don't use magic numbers in sixaxis_set_operational_usb()
  HID: sony: Use __u8 * for the buffer in sixaxis_set_operational_usb()
  HID: sony: Coding style cleanups in sixaxis_set_operational_usb()

 drivers/hid/hid-sony.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)
Frank Praznik Feb. 16, 2015, 9:48 p.m. UTC | #3
On 2/16/2015 12:12, Antonio Ospite wrote:
> Hi,
>
> here are a few cleanups for hid-sony.
>
> Changes are meant to follow the patch titled:
> [PATCHv4] HID: sony: Enable Gasia third-party PS3 controllers
>
> Frank, hi, I'd like to have your explicit ack at least for patch 1 and
> 2.
>
> Thanks,
>     Antonio
>
>
> Antonio Ospite (5):
>    HID: sony: Fix a WARNING shown when rmmod-ing the driver
>    HID: sony: Use the minimum accepted size for feature report 0xf2
>    HID: sony: Don't use magic numbers in sixaxis_set_operational_usb()
>    HID: sony: Use __u8 * for the buffer in sixaxis_set_operational_usb()
>    HID: sony: Coding style cleanups in sixaxis_set_operational_usb()
>
>   drivers/hid/hid-sony.c | 21 +++++++++++----------
>   1 file changed, 11 insertions(+), 10 deletions(-)
>
Hi Antonio, could you resend patch #1?  It didn't show up in my email 
and it's not on any of the web-based lists either.

Regards,
Frank
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Antonio Ospite Feb. 16, 2015, 10:29 p.m. UTC | #4
On Mon, 16 Feb 2015 16:48:53 -0500
Frank Praznik <frank.praznik@gmail.com> wrote:

> On 2/16/2015 12:12, Antonio Ospite wrote:
> > Hi,
> >
> > here are a few cleanups for hid-sony.
> >
> > Changes are meant to follow the patch titled:
> > [PATCHv4] HID: sony: Enable Gasia third-party PS3 controllers
> >
> > Frank, hi, I'd like to have your explicit ack at least for patch 1 and
> > 2.
> >
> > Thanks,
> >     Antonio
> >
> >
> > Antonio Ospite (5):
> >    HID: sony: Fix a WARNING shown when rmmod-ing the driver
> >    HID: sony: Use the minimum accepted size for feature report 0xf2
> >    HID: sony: Don't use magic numbers in sixaxis_set_operational_usb()
> >    HID: sony: Use __u8 * for the buffer in sixaxis_set_operational_usb()
> >    HID: sony: Coding style cleanups in sixaxis_set_operational_usb()
> >
> >   drivers/hid/hid-sony.c | 21 +++++++++++----------
> >   1 file changed, 11 insertions(+), 10 deletions(-)
> >
> Hi Antonio, could you resend patch #1?  It didn't show up in my email 
> and it's not on any of the web-based lists either.
> 

Done. Let me know if you didn't get it this time either.

I noticed that git-send-email set a later date, it shouldn't be a
problem but if it is patch 1/5 could be applied as 6/5 instead.

Thanks,
   Antonio
Jiri Kosina Feb. 17, 2015, 12:18 p.m. UTC | #5
On Mon, 16 Feb 2015, Antonio Ospite wrote:

> On Mon, 16 Feb 2015 15:06:59 +0200
> Lauri Kasanen <cand@gmx.com> wrote:
> 
> > Without this, my "Gasia Co.,Ltd PS(R) Gamepad" would not send
> > any events. Now everything works including the leds.
> > 
> > Based on work by Andrew Haines and Antonio Ospite.
> > 
> > cc: Antonio Ospite <ao2@ao2.it>
> > cc: Andrew Haines <AndrewD207@aol.com>
> > Signed-off-by: Lauri Kasanen <cand@gmx.com>
> 
> Reviewed-by: Antonio Ospite <ao2@ao2.it>

Applied.
Frank Praznik Feb. 17, 2015, 6:03 p.m. UTC | #6
On 2/16/2015 12:12, Antonio Ospite wrote:
> Hi,
>
> here are a few cleanups for hid-sony.
>
> Changes are meant to follow the patch titled:
> [PATCHv4] HID: sony: Enable Gasia third-party PS3 controllers
>
> Frank, hi, I'd like to have your explicit ack at least for patch 1 and
> 2.
>
> Thanks,
>     Antonio
>
>
> Antonio Ospite (5):
>    HID: sony: Fix a WARNING shown when rmmod-ing the driver
>    HID: sony: Use the minimum accepted size for feature report 0xf2
>    HID: sony: Don't use magic numbers in sixaxis_set_operational_usb()
>    HID: sony: Use __u8 * for the buffer in sixaxis_set_operational_usb()
>    HID: sony: Coding style cleanups in sixaxis_set_operational_usb()
>
>   drivers/hid/hid-sony.c | 21 +++++++++++----------
>   1 file changed, 11 insertions(+), 10 deletions(-)
>

The series looks good to me.  Thanks for tackling the last bit of magic 
constant cleanup.
For the entire series:

Acked-by: Frank Praznik <frank.praznik@oh.rr.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jiri Kosina Feb. 18, 2015, 8:41 p.m. UTC | #7
On Mon, 16 Feb 2015, Antonio Ospite wrote:

> Hi,
> 
> here are a few cleanups for hid-sony.
> 
> Changes are meant to follow the patch titled:
> [PATCHv4] HID: sony: Enable Gasia third-party PS3 controllers
> 
> Frank, hi, I'd like to have your explicit ack at least for patch 1 and
> 2.
> 
> Thanks,
>    Antonio
> 
> 
> Antonio Ospite (5):
>   HID: sony: Fix a WARNING shown when rmmod-ing the driver
>   HID: sony: Use the minimum accepted size for feature report 0xf2
>   HID: sony: Don't use magic numbers in sixaxis_set_operational_usb()
>   HID: sony: Use __u8 * for the buffer in sixaxis_set_operational_usb()
>   HID: sony: Coding style cleanups in sixaxis_set_operational_usb()

I have applied 1/5 to for-3.20/upstream-fixes and 2-5 to for-3.21/sony. 
Thanks,
diff mbox

Patch

diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 31e9d25..f3d44e5 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -1139,9 +1139,29 @@  static int sixaxis_set_operational_usb(struct hid_device *hdev)
 	ret = hid_hw_raw_request(hdev, 0xf2, buf, 17, HID_FEATURE_REPORT,
 				 HID_REQ_GET_REPORT);
 
+	if (ret < 0) {
+		hid_err(hdev, "can't set operational mode: step 1\n");
+		goto out;
+	}
+
+	/*
+	 * Some compatible controllers like the Speedlink Strike FX and
+	 * Gasia need another query plus an USB interrupt to get operational.
+	 */
+	ret = hid_hw_raw_request(hdev, 0xf5, buf, 8, HID_FEATURE_REPORT,
+				 HID_REQ_GET_REPORT);
+
+	if (ret < 0) {
+		hid_err(hdev, "can't set operational mode: step 2\n");
+		goto out;
+	}
+
+	ret = hid_hw_output_report(hdev, buf, 1);
+
 	if (ret < 0)
-		hid_err(hdev, "can't set operational mode\n");
+		hid_err(hdev, "can't set operational mode: step 3\n");
 
+out:
 	kfree(buf);
 
 	return ret;