linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] HID: sony: disable descriptor fixup for FutureMax Dance Mat
@ 2016-07-21 16:54 Mikko Perttunen
  2016-07-25  9:15 ` Benjamin Tissoires
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Mikko Perttunen @ 2016-07-21 16:54 UTC (permalink / raw)
  To: jikos, benjamin.tissoires; +Cc: ao2, linux-input, linux-kernel, Mikko Perttunen

From: Mikko Perttunen <mperttunen@nvidia.com>

The FutureMax Dance Mat claims to be a SixAxis controller
but breaks if descriptor fixups are applied. Detect the
device using its USB product string and disable fixups
when it is detected.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
---
v2: don't use usb device properties

 drivers/hid/hid-sony.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 310436a..29a1aa9 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -51,6 +51,7 @@
 #define NAVIGATION_CONTROLLER_USB BIT(9)
 #define NAVIGATION_CONTROLLER_BT  BIT(10)
 #define SINO_LITE_CONTROLLER      BIT(11)
+#define FUTUREMAX_DANCE_MAT       BIT(12)
 
 #define SIXAXIS_CONTROLLER (SIXAXIS_CONTROLLER_USB | SIXAXIS_CONTROLLER_BT)
 #define MOTION_CONTROLLER (MOTION_CONTROLLER_USB | MOTION_CONTROLLER_BT)
@@ -1125,7 +1126,7 @@ static u8 *sony_report_fixup(struct hid_device *hdev, u8 *rdesc,
 {
 	struct sony_sc *sc = hid_get_drvdata(hdev);
 
-	if (sc->quirks & SINO_LITE_CONTROLLER)
+	if (sc->quirks & (SINO_LITE_CONTROLLER | FUTUREMAX_DANCE_MAT))
 		return rdesc;
 
 	/*
@@ -2289,6 +2290,9 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
 	struct sony_sc *sc;
 	unsigned int connect_mask = HID_CONNECT_DEFAULT;
 
+	if (!strcmp(hdev->name, "FutureMax Dance Mat"))
+		quirks |= FUTUREMAX_DANCE_MAT;
+
 	sc = devm_kzalloc(&hdev->dev, sizeof(*sc), GFP_KERNEL);
 	if (sc == NULL) {
 		hid_err(hdev, "can't alloc sony descriptor\n");
-- 
2.9.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] HID: sony: disable descriptor fixup for FutureMax Dance Mat
  2016-07-21 16:54 [PATCH v2] HID: sony: disable descriptor fixup for FutureMax Dance Mat Mikko Perttunen
@ 2016-07-25  9:15 ` Benjamin Tissoires
  2016-07-25 10:23 ` Antonio Ospite
  2016-08-02 14:43 ` Jiri Kosina
  2 siblings, 0 replies; 5+ messages in thread
From: Benjamin Tissoires @ 2016-07-25  9:15 UTC (permalink / raw)
  To: Mikko Perttunen; +Cc: jikos, ao2, linux-input, linux-kernel, Mikko Perttunen

On Jul 21 2016 or thereabouts, Mikko Perttunen wrote:
> From: Mikko Perttunen <mperttunen@nvidia.com>
> 
> The FutureMax Dance Mat claims to be a SixAxis controller
> but breaks if descriptor fixups are applied. Detect the
> device using its USB product string and disable fixups
> when it is detected.
> 
> Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>

Works for me but I'd like to get Antonio's ACK or Rev-by.

Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Cheers,
Benjamin

> ---
> v2: don't use usb device properties
> 
>  drivers/hid/hid-sony.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
> index 310436a..29a1aa9 100644
> --- a/drivers/hid/hid-sony.c
> +++ b/drivers/hid/hid-sony.c
> @@ -51,6 +51,7 @@
>  #define NAVIGATION_CONTROLLER_USB BIT(9)
>  #define NAVIGATION_CONTROLLER_BT  BIT(10)
>  #define SINO_LITE_CONTROLLER      BIT(11)
> +#define FUTUREMAX_DANCE_MAT       BIT(12)
>  
>  #define SIXAXIS_CONTROLLER (SIXAXIS_CONTROLLER_USB | SIXAXIS_CONTROLLER_BT)
>  #define MOTION_CONTROLLER (MOTION_CONTROLLER_USB | MOTION_CONTROLLER_BT)
> @@ -1125,7 +1126,7 @@ static u8 *sony_report_fixup(struct hid_device *hdev, u8 *rdesc,
>  {
>  	struct sony_sc *sc = hid_get_drvdata(hdev);
>  
> -	if (sc->quirks & SINO_LITE_CONTROLLER)
> +	if (sc->quirks & (SINO_LITE_CONTROLLER | FUTUREMAX_DANCE_MAT))
>  		return rdesc;
>  
>  	/*
> @@ -2289,6 +2290,9 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
>  	struct sony_sc *sc;
>  	unsigned int connect_mask = HID_CONNECT_DEFAULT;
>  
> +	if (!strcmp(hdev->name, "FutureMax Dance Mat"))
> +		quirks |= FUTUREMAX_DANCE_MAT;
> +
>  	sc = devm_kzalloc(&hdev->dev, sizeof(*sc), GFP_KERNEL);
>  	if (sc == NULL) {
>  		hid_err(hdev, "can't alloc sony descriptor\n");
> -- 
> 2.9.0
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] HID: sony: disable descriptor fixup for FutureMax Dance Mat
  2016-07-21 16:54 [PATCH v2] HID: sony: disable descriptor fixup for FutureMax Dance Mat Mikko Perttunen
  2016-07-25  9:15 ` Benjamin Tissoires
@ 2016-07-25 10:23 ` Antonio Ospite
  2016-07-25 15:12   ` Mikko Perttunen
  2016-08-02 14:43 ` Jiri Kosina
  2 siblings, 1 reply; 5+ messages in thread
From: Antonio Ospite @ 2016-07-25 10:23 UTC (permalink / raw)
  To: Mikko Perttunen
  Cc: jikos, benjamin.tissoires, linux-input, linux-kernel,
	Mikko Perttunen

On Thu, 21 Jul 2016 19:54:48 +0300
Mikko Perttunen <mikko.perttunen@kapsi.fi> wrote:

> From: Mikko Perttunen <mperttunen@nvidia.com>
> 
> The FutureMax Dance Mat claims to be a SixAxis controller
> but breaks if descriptor fixups are applied. Detect the
> device using its USB product string and disable fixups
> when it is detected.
> 
> Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>

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

> ---
> v2: don't use usb device properties
> 
>  drivers/hid/hid-sony.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
> index 310436a..29a1aa9 100644
> --- a/drivers/hid/hid-sony.c
> +++ b/drivers/hid/hid-sony.c
> @@ -51,6 +51,7 @@
>  #define NAVIGATION_CONTROLLER_USB BIT(9)
>  #define NAVIGATION_CONTROLLER_BT  BIT(10)
>  #define SINO_LITE_CONTROLLER      BIT(11)
> +#define FUTUREMAX_DANCE_MAT       BIT(12)
>  
>  #define SIXAXIS_CONTROLLER (SIXAXIS_CONTROLLER_USB | SIXAXIS_CONTROLLER_BT)
>  #define MOTION_CONTROLLER (MOTION_CONTROLLER_USB | MOTION_CONTROLLER_BT)
> @@ -1125,7 +1126,7 @@ static u8 *sony_report_fixup(struct hid_device *hdev, u8 *rdesc,
>  {
>  	struct sony_sc *sc = hid_get_drvdata(hdev);
>  
> -	if (sc->quirks & SINO_LITE_CONTROLLER)
> +	if (sc->quirks & (SINO_LITE_CONTROLLER | FUTUREMAX_DANCE_MAT))
>  		return rdesc;
>  
>  	/*
> @@ -2289,6 +2290,9 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
>  	struct sony_sc *sc;
>  	unsigned int connect_mask = HID_CONNECT_DEFAULT;
>  
> +	if (!strcmp(hdev->name, "FutureMax Dance Mat"))
> +		quirks |= FUTUREMAX_DANCE_MAT;
> +
>  	sc = devm_kzalloc(&hdev->dev, sizeof(*sc), GFP_KERNEL);
>  	if (sc == NULL) {
>  		hid_err(hdev, "can't alloc sony descriptor\n");
> -- 
> 2.9.0
> 


-- 
Antonio Ospite
http://ao2.it

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] HID: sony: disable descriptor fixup for FutureMax Dance Mat
  2016-07-25 10:23 ` Antonio Ospite
@ 2016-07-25 15:12   ` Mikko Perttunen
  0 siblings, 0 replies; 5+ messages in thread
From: Mikko Perttunen @ 2016-07-25 15:12 UTC (permalink / raw)
  To: Antonio Ospite
  Cc: jikos, benjamin.tissoires, linux-input, linux-kernel,
	Mikko Perttunen

> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> Acked-by: Antonio Ospite <ao2@ao2.it>

Thanks!

Mikko



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] HID: sony: disable descriptor fixup for FutureMax Dance Mat
  2016-07-21 16:54 [PATCH v2] HID: sony: disable descriptor fixup for FutureMax Dance Mat Mikko Perttunen
  2016-07-25  9:15 ` Benjamin Tissoires
  2016-07-25 10:23 ` Antonio Ospite
@ 2016-08-02 14:43 ` Jiri Kosina
  2 siblings, 0 replies; 5+ messages in thread
From: Jiri Kosina @ 2016-08-02 14:43 UTC (permalink / raw)
  To: Mikko Perttunen
  Cc: benjamin.tissoires, ao2, linux-input, linux-kernel,
	Mikko Perttunen

On Thu, 21 Jul 2016, Mikko Perttunen wrote:

> From: Mikko Perttunen <mperttunen@nvidia.com>
> 
> The FutureMax Dance Mat claims to be a SixAxis controller
> but breaks if descriptor fixups are applied. Detect the
> device using its USB product string and disable fixups
> when it is detected.

What a mess; kudos to the HW vendors again.

Applied to for-4.8/upstream-fixes, thanks.

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-08-02 18:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-21 16:54 [PATCH v2] HID: sony: disable descriptor fixup for FutureMax Dance Mat Mikko Perttunen
2016-07-25  9:15 ` Benjamin Tissoires
2016-07-25 10:23 ` Antonio Ospite
2016-07-25 15:12   ` Mikko Perttunen
2016-08-02 14:43 ` Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).