linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Input: xpad - Additional controller support
@ 2023-02-25  1:21 Vicki Pfau
  2023-02-25  1:21 ` [PATCH 1/3] Input: xpad - fix support for some third-party controllers Vicki Pfau
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Vicki Pfau @ 2023-02-25  1:21 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires, linux-input; +Cc: Pavel Rojtberg, Vicki Pfau

This series adds support for a handful of third-party controllers in addition
to some minor code cleanup.

The approach to the Xbox 360 controller support added in this series (in the
first patch) is different than an approach used in the separate downstream that
Pavel Rojtberg (CC'd) uses, which is based on a whitelist. Since the first
packet in that downstream approach is sent unconditionally on the Windows
driver, this eschews the whitelist. Please take note that this also replaces
the need for the whitelist for the two controllers mentioned in that downstream
approach, and as such should be considered to conflict with the approach that
patch takes.

Vicki Pfau (3):
  Input: xpad - fix support for some third-party controllers
  Input: xpad - remove unused field in VID/PID table
  Input: xpad - Add VID for Turtle Beach controllers

 drivers/input/joystick/xpad.c | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

-- 
2.39.2


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

* [PATCH 1/3] Input: xpad - fix support for some third-party controllers
  2023-02-25  1:21 [PATCH 0/3] Input: xpad - Additional controller support Vicki Pfau
@ 2023-02-25  1:21 ` Vicki Pfau
  2023-03-23 21:39   ` Lyude Paul
  2023-03-24  1:30   ` Dmitry Torokhov
  2023-02-25  1:21 ` [PATCH 2/3] Input: xpad - remove unused field in VID/PID table Vicki Pfau
  2023-02-25  1:21 ` [PATCH 3/3] Input: xpad - Add VID for Turtle Beach controllers Vicki Pfau
  2 siblings, 2 replies; 10+ messages in thread
From: Vicki Pfau @ 2023-02-25  1:21 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires, linux-input, Pavel Rojtberg
  Cc: Vicki Pfau, Andrey Smirnov

Some third-party controllers, such as the HORPIAD FPS for Nintendo Switch and
Gamesir-G3w, require a specific packet that the first-party XInput driver sends
before it will start sending reports. It's not currently known what this packet
does, but since the first-party driver always sends it's unlikely that this
could cause issues with existing controllers.

Co-authored-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Vicki Pfau <vi@endrift.com>
---
 drivers/input/joystick/xpad.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index 403b57e8176b..04af2213407f 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -265,6 +265,7 @@ static const struct xpad_device {
 	{ 0x0f0d, 0x0067, "HORIPAD ONE", 0, XTYPE_XBOXONE },
 	{ 0x0f0d, 0x0078, "Hori Real Arcade Pro V Kai Xbox One", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE },
 	{ 0x0f0d, 0x00c5, "Hori Fighting Commander ONE", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE },
+	{ 0x0f0d, 0x00dc, "HORIPAD FPS for Nintendo Switch", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
 	{ 0x0f30, 0x010b, "Philips Recoil", 0, XTYPE_XBOX },
 	{ 0x0f30, 0x0202, "Joytech Advanced Controller", 0, XTYPE_XBOX },
 	{ 0x0f30, 0x8888, "BigBen XBMiniPad Controller", 0, XTYPE_XBOX },
@@ -2020,6 +2021,27 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
 		goto err_free_in_urb;
 	}
 
+	if (xpad->xtype == XTYPE_XBOX360) {
+		/* Some third-party controllers Xbox 360-style controllers
+		 * require this message to finish initialization */
+		uint8_t dummy[20];
+		int ret;
+
+		usb_control_msg_recv(udev, 0,
+				     /* bRequest */ 0x01,
+				     /* bmRequestType */
+				     USB_TYPE_VENDOR | USB_DIR_IN |
+				     USB_RECIP_INTERFACE,
+				     /* wValue */ 0x100,
+				     /* wIndex */ 0x00,
+				     dummy, sizeof(dummy),
+				     25,
+				     GFP_KERNEL);
+		if (ret)
+			dev_warn(&xpad->dev->dev,
+				 "unable to receive magic message: %d\n", ret);
+	}
+
 	ep_irq_in = ep_irq_out = NULL;
 
 	for (i = 0; i < 2; i++) {
-- 
2.39.2


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

* [PATCH 2/3] Input: xpad - remove unused field in VID/PID table
  2023-02-25  1:21 [PATCH 0/3] Input: xpad - Additional controller support Vicki Pfau
  2023-02-25  1:21 ` [PATCH 1/3] Input: xpad - fix support for some third-party controllers Vicki Pfau
@ 2023-02-25  1:21 ` Vicki Pfau
  2023-03-24  1:33   ` Dmitry Torokhov
  2023-02-25  1:21 ` [PATCH 3/3] Input: xpad - Add VID for Turtle Beach controllers Vicki Pfau
  2 siblings, 1 reply; 10+ messages in thread
From: Vicki Pfau @ 2023-02-25  1:21 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires, linux-input, Pavel Rojtberg; +Cc: Vicki Pfau

The list of specific VID/PID combinations for various controllers recently
added a new field "xtype". However, this field isn't used, nor filled in in the
table itself, and was likely added by mistake and overlooked during review.
Since this field isn't used, it's safe to remove.

Signed-off-by: Vicki Pfau <vi@endrift.com>
---
 drivers/input/joystick/xpad.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index 04af2213407f..d244ba22b85e 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -126,7 +126,6 @@ static const struct xpad_device {
 	char *name;
 	u8 mapping;
 	u8 xtype;
-	u8 packet_type;
 } xpad_device[] = {
 	{ 0x0079, 0x18d4, "GPD Win 2 X-Box Controller", 0, XTYPE_XBOX360 },
 	{ 0x03eb, 0xff01, "Wooting One (Legacy)", 0, XTYPE_XBOX360 },
-- 
2.39.2


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

* [PATCH 3/3] Input: xpad - Add VID for Turtle Beach controllers
  2023-02-25  1:21 [PATCH 0/3] Input: xpad - Additional controller support Vicki Pfau
  2023-02-25  1:21 ` [PATCH 1/3] Input: xpad - fix support for some third-party controllers Vicki Pfau
  2023-02-25  1:21 ` [PATCH 2/3] Input: xpad - remove unused field in VID/PID table Vicki Pfau
@ 2023-02-25  1:21 ` Vicki Pfau
  2023-03-24  1:33   ` Dmitry Torokhov
  2 siblings, 1 reply; 10+ messages in thread
From: Vicki Pfau @ 2023-02-25  1:21 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires, linux-input, Pavel Rojtberg; +Cc: Vicki Pfau

This adds support for the Turtle Beach REACT-R and Recon Xbox controllers

Signed-off-by: Vicki Pfau <vi@endrift.com>
---
 drivers/input/joystick/xpad.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index d244ba22b85e..a4f9a21f1355 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -475,6 +475,7 @@ static const struct usb_device_id xpad_table[] = {
 	XPAD_XBOX360_VENDOR(0x0f0d),		/* Hori Controllers */
 	XPAD_XBOXONE_VENDOR(0x0f0d),		/* Hori Controllers */
 	XPAD_XBOX360_VENDOR(0x1038),		/* SteelSeries Controllers */
+	XPAD_XBOXONE_VENDOR(0x10f5),		/* Turtle Beach Controllers */
 	XPAD_XBOX360_VENDOR(0x11c9),		/* Nacon GC100XF */
 	XPAD_XBOX360_VENDOR(0x1209),		/* Ardwiino Controllers */
 	XPAD_XBOX360_VENDOR(0x12ab),		/* X-Box 360 dance pads */
-- 
2.39.2


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

* Re: [PATCH 1/3] Input: xpad - fix support for some third-party controllers
  2023-02-25  1:21 ` [PATCH 1/3] Input: xpad - fix support for some third-party controllers Vicki Pfau
@ 2023-03-23 21:39   ` Lyude Paul
  2023-03-23 22:01     ` Lyude Paul
  2023-03-24  1:30   ` Dmitry Torokhov
  1 sibling, 1 reply; 10+ messages in thread
From: Lyude Paul @ 2023-03-23 21:39 UTC (permalink / raw)
  To: Vicki Pfau, Jiri Kosina, Benjamin Tissoires, linux-input,
	Pavel Rojtberg, Dmitry Torokhov
  Cc: Andrey Smirnov

Hey Dmitry, this patch series seems to have only gotten radio silence as well.
What could we do to get this moving?

On Fri, 2023-02-24 at 17:21 -0800, Vicki Pfau wrote:
> Some third-party controllers, such as the HORPIAD FPS for Nintendo Switch and
> Gamesir-G3w, require a specific packet that the first-party XInput driver sends
> before it will start sending reports. It's not currently known what this packet
> does, but since the first-party driver always sends it's unlikely that this
> could cause issues with existing controllers.
> 
> Co-authored-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> Signed-off-by: Vicki Pfau <vi@endrift.com>
> ---
>  drivers/input/joystick/xpad.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
> index 403b57e8176b..04af2213407f 100644
> --- a/drivers/input/joystick/xpad.c
> +++ b/drivers/input/joystick/xpad.c
> @@ -265,6 +265,7 @@ static const struct xpad_device {
>  	{ 0x0f0d, 0x0067, "HORIPAD ONE", 0, XTYPE_XBOXONE },
>  	{ 0x0f0d, 0x0078, "Hori Real Arcade Pro V Kai Xbox One", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE },
>  	{ 0x0f0d, 0x00c5, "Hori Fighting Commander ONE", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE },
> +	{ 0x0f0d, 0x00dc, "HORIPAD FPS for Nintendo Switch", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
>  	{ 0x0f30, 0x010b, "Philips Recoil", 0, XTYPE_XBOX },
>  	{ 0x0f30, 0x0202, "Joytech Advanced Controller", 0, XTYPE_XBOX },
>  	{ 0x0f30, 0x8888, "BigBen XBMiniPad Controller", 0, XTYPE_XBOX },
> @@ -2020,6 +2021,27 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
>  		goto err_free_in_urb;
>  	}
>  
> +	if (xpad->xtype == XTYPE_XBOX360) {
> +		/* Some third-party controllers Xbox 360-style controllers
> +		 * require this message to finish initialization */
> +		uint8_t dummy[20];
> +		int ret;
> +
> +		usb_control_msg_recv(udev, 0,
> +				     /* bRequest */ 0x01,
> +				     /* bmRequestType */
> +				     USB_TYPE_VENDOR | USB_DIR_IN |
> +				     USB_RECIP_INTERFACE,
> +				     /* wValue */ 0x100,
> +				     /* wIndex */ 0x00,
> +				     dummy, sizeof(dummy),
> +				     25,
> +				     GFP_KERNEL);
> +		if (ret)
> +			dev_warn(&xpad->dev->dev,
> +				 "unable to receive magic message: %d\n", ret);
> +	}
> +
>  	ep_irq_in = ep_irq_out = NULL;
>  
>  	for (i = 0; i < 2; i++) {

-- 
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat


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

* Re: [PATCH 1/3] Input: xpad - fix support for some third-party controllers
  2023-03-23 21:39   ` Lyude Paul
@ 2023-03-23 22:01     ` Lyude Paul
  0 siblings, 0 replies; 10+ messages in thread
From: Lyude Paul @ 2023-03-23 22:01 UTC (permalink / raw)
  To: Vicki Pfau, Jiri Kosina, Benjamin Tissoires, linux-input,
	Pavel Rojtberg, Dmitry Torokhov
  Cc: Andrey Smirnov

Ah wnoops, Vicki pointed out I made a mistake here and that this one is still
awaiting reviews from someone. will review in just a moment

On Thu, 2023-03-23 at 17:39 -0400, Lyude Paul wrote:
> Hey Dmitry, this patch series seems to have only gotten radio silence as well.
> What could we do to get this moving?
> 
> On Fri, 2023-02-24 at 17:21 -0800, Vicki Pfau wrote:
> > Some third-party controllers, such as the HORPIAD FPS for Nintendo Switch and
> > Gamesir-G3w, require a specific packet that the first-party XInput driver sends
> > before it will start sending reports. It's not currently known what this packet
> > does, but since the first-party driver always sends it's unlikely that this
> > could cause issues with existing controllers.
> > 
> > Co-authored-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> > Signed-off-by: Vicki Pfau <vi@endrift.com>
> > ---
> >  drivers/input/joystick/xpad.c | 22 ++++++++++++++++++++++
> >  1 file changed, 22 insertions(+)
> > 
> > diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
> > index 403b57e8176b..04af2213407f 100644
> > --- a/drivers/input/joystick/xpad.c
> > +++ b/drivers/input/joystick/xpad.c
> > @@ -265,6 +265,7 @@ static const struct xpad_device {
> >  	{ 0x0f0d, 0x0067, "HORIPAD ONE", 0, XTYPE_XBOXONE },
> >  	{ 0x0f0d, 0x0078, "Hori Real Arcade Pro V Kai Xbox One", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE },
> >  	{ 0x0f0d, 0x00c5, "Hori Fighting Commander ONE", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE },
> > +	{ 0x0f0d, 0x00dc, "HORIPAD FPS for Nintendo Switch", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
> >  	{ 0x0f30, 0x010b, "Philips Recoil", 0, XTYPE_XBOX },
> >  	{ 0x0f30, 0x0202, "Joytech Advanced Controller", 0, XTYPE_XBOX },
> >  	{ 0x0f30, 0x8888, "BigBen XBMiniPad Controller", 0, XTYPE_XBOX },
> > @@ -2020,6 +2021,27 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
> >  		goto err_free_in_urb;
> >  	}
> >  
> > +	if (xpad->xtype == XTYPE_XBOX360) {
> > +		/* Some third-party controllers Xbox 360-style controllers
> > +		 * require this message to finish initialization */
> > +		uint8_t dummy[20];
> > +		int ret;
> > +
> > +		usb_control_msg_recv(udev, 0,
> > +				     /* bRequest */ 0x01,
> > +				     /* bmRequestType */
> > +				     USB_TYPE_VENDOR | USB_DIR_IN |
> > +				     USB_RECIP_INTERFACE,
> > +				     /* wValue */ 0x100,
> > +				     /* wIndex */ 0x00,
> > +				     dummy, sizeof(dummy),
> > +				     25,
> > +				     GFP_KERNEL);
> > +		if (ret)
> > +			dev_warn(&xpad->dev->dev,
> > +				 "unable to receive magic message: %d\n", ret);
> > +	}
> > +
> >  	ep_irq_in = ep_irq_out = NULL;
> >  
> >  	for (i = 0; i < 2; i++) {
> 

-- 
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat


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

* Re: [PATCH 1/3] Input: xpad - fix support for some third-party controllers
  2023-02-25  1:21 ` [PATCH 1/3] Input: xpad - fix support for some third-party controllers Vicki Pfau
  2023-03-23 21:39   ` Lyude Paul
@ 2023-03-24  1:30   ` Dmitry Torokhov
  2023-03-24  4:06     ` Vicki Pfau
  1 sibling, 1 reply; 10+ messages in thread
From: Dmitry Torokhov @ 2023-03-24  1:30 UTC (permalink / raw)
  To: Vicki Pfau
  Cc: Jiri Kosina, Benjamin Tissoires, linux-input, Pavel Rojtberg,
	Andrey Smirnov

On Fri, Feb 24, 2023 at 05:21:46PM -0800, Vicki Pfau wrote:
> Some third-party controllers, such as the HORPIAD FPS for Nintendo Switch and
> Gamesir-G3w, require a specific packet that the first-party XInput driver sends
> before it will start sending reports. It's not currently known what this packet
> does, but since the first-party driver always sends it's unlikely that this
> could cause issues with existing controllers.
> 
> Co-authored-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> Signed-off-by: Vicki Pfau <vi@endrift.com>
> ---
>  drivers/input/joystick/xpad.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
> index 403b57e8176b..04af2213407f 100644
> --- a/drivers/input/joystick/xpad.c
> +++ b/drivers/input/joystick/xpad.c
> @@ -265,6 +265,7 @@ static const struct xpad_device {
>  	{ 0x0f0d, 0x0067, "HORIPAD ONE", 0, XTYPE_XBOXONE },
>  	{ 0x0f0d, 0x0078, "Hori Real Arcade Pro V Kai Xbox One", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE },
>  	{ 0x0f0d, 0x00c5, "Hori Fighting Commander ONE", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE },
> +	{ 0x0f0d, 0x00dc, "HORIPAD FPS for Nintendo Switch", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
>  	{ 0x0f30, 0x010b, "Philips Recoil", 0, XTYPE_XBOX },
>  	{ 0x0f30, 0x0202, "Joytech Advanced Controller", 0, XTYPE_XBOX },
>  	{ 0x0f30, 0x8888, "BigBen XBMiniPad Controller", 0, XTYPE_XBOX },
> @@ -2020,6 +2021,27 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
>  		goto err_free_in_urb;
>  	}
>  
> +	if (xpad->xtype == XTYPE_XBOX360) {
> +		/* Some third-party controllers Xbox 360-style controllers
> +		 * require this message to finish initialization */
> +		uint8_t dummy[20];
> +		int ret;
> +
> +		usb_control_msg_recv(udev, 0,
> +				     /* bRequest */ 0x01,
> +				     /* bmRequestType */
> +				     USB_TYPE_VENDOR | USB_DIR_IN |
> +				     USB_RECIP_INTERFACE,
> +				     /* wValue */ 0x100,
> +				     /* wIndex */ 0x00,
> +				     dummy, sizeof(dummy),
> +				     25,
> +				     GFP_KERNEL);
> +		if (ret)
> +			dev_warn(&xpad->dev->dev,
> +				 "unable to receive magic message: %d\n", ret);

You are not setting "ret", how was this tested?

> +	}
> +
>  	ep_irq_in = ep_irq_out = NULL;
>  
>  	for (i = 0; i < 2; i++) {
> -- 
> 2.39.2
> 

-- 
Dmitry

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

* Re: [PATCH 2/3] Input: xpad - remove unused field in VID/PID table
  2023-02-25  1:21 ` [PATCH 2/3] Input: xpad - remove unused field in VID/PID table Vicki Pfau
@ 2023-03-24  1:33   ` Dmitry Torokhov
  0 siblings, 0 replies; 10+ messages in thread
From: Dmitry Torokhov @ 2023-03-24  1:33 UTC (permalink / raw)
  To: Vicki Pfau; +Cc: Jiri Kosina, Benjamin Tissoires, linux-input, Pavel Rojtberg

On Fri, Feb 24, 2023 at 05:21:47PM -0800, Vicki Pfau wrote:
> The list of specific VID/PID combinations for various controllers recently
> added a new field "xtype". However, this field isn't used, nor filled in in the
> table itself, and was likely added by mistake and overlooked during review.
> Since this field isn't used, it's safe to remove.
> 
> Signed-off-by: Vicki Pfau <vi@endrift.com>

Applied, thank you.

-- 
Dmitry

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

* Re: [PATCH 3/3] Input: xpad - Add VID for Turtle Beach controllers
  2023-02-25  1:21 ` [PATCH 3/3] Input: xpad - Add VID for Turtle Beach controllers Vicki Pfau
@ 2023-03-24  1:33   ` Dmitry Torokhov
  0 siblings, 0 replies; 10+ messages in thread
From: Dmitry Torokhov @ 2023-03-24  1:33 UTC (permalink / raw)
  To: Vicki Pfau; +Cc: Jiri Kosina, Benjamin Tissoires, linux-input, Pavel Rojtberg

On Fri, Feb 24, 2023 at 05:21:48PM -0800, Vicki Pfau wrote:
> This adds support for the Turtle Beach REACT-R and Recon Xbox controllers
> 
> Signed-off-by: Vicki Pfau <vi@endrift.com>

Applied, thank you.

-- 
Dmitry

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

* Re: [PATCH 1/3] Input: xpad - fix support for some third-party controllers
  2023-03-24  1:30   ` Dmitry Torokhov
@ 2023-03-24  4:06     ` Vicki Pfau
  0 siblings, 0 replies; 10+ messages in thread
From: Vicki Pfau @ 2023-03-24  4:06 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Jiri Kosina, Benjamin Tissoires, linux-input, Pavel Rojtberg,
	Andrey Smirnov



On 3/23/23 18:30, Dmitry Torokhov wrote:
> On Fri, Feb 24, 2023 at 05:21:46PM -0800, Vicki Pfau wrote:
>> Some third-party controllers, such as the HORPIAD FPS for Nintendo Switch and
>> Gamesir-G3w, require a specific packet that the first-party XInput driver sends
>> before it will start sending reports. It's not currently known what this packet
>> does, but since the first-party driver always sends it's unlikely that this
>> could cause issues with existing controllers.
>>
>> Co-authored-by: Andrey Smirnov <andrew.smirnov@gmail.com>
>> Signed-off-by: Vicki Pfau <vi@endrift.com>
>> ---
>>  drivers/input/joystick/xpad.c | 22 ++++++++++++++++++++++
>>  1 file changed, 22 insertions(+)
>>
>> diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
>> index 403b57e8176b..04af2213407f 100644
>> --- a/drivers/input/joystick/xpad.c
>> +++ b/drivers/input/joystick/xpad.c
>> @@ -265,6 +265,7 @@ static const struct xpad_device {
>>  	{ 0x0f0d, 0x0067, "HORIPAD ONE", 0, XTYPE_XBOXONE },
>>  	{ 0x0f0d, 0x0078, "Hori Real Arcade Pro V Kai Xbox One", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE },
>>  	{ 0x0f0d, 0x00c5, "Hori Fighting Commander ONE", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE },
>> +	{ 0x0f0d, 0x00dc, "HORIPAD FPS for Nintendo Switch", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
>>  	{ 0x0f30, 0x010b, "Philips Recoil", 0, XTYPE_XBOX },
>>  	{ 0x0f30, 0x0202, "Joytech Advanced Controller", 0, XTYPE_XBOX },
>>  	{ 0x0f30, 0x8888, "BigBen XBMiniPad Controller", 0, XTYPE_XBOX },
>> @@ -2020,6 +2021,27 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
>>  		goto err_free_in_urb;
>>  	}
>>  
>> +	if (xpad->xtype == XTYPE_XBOX360) {
>> +		/* Some third-party controllers Xbox 360-style controllers
>> +		 * require this message to finish initialization */
>> +		uint8_t dummy[20];
>> +		int ret;
>> +
>> +		usb_control_msg_recv(udev, 0,
>> +				     /* bRequest */ 0x01,
>> +				     /* bmRequestType */
>> +				     USB_TYPE_VENDOR | USB_DIR_IN |
>> +				     USB_RECIP_INTERFACE,
>> +				     /* wValue */ 0x100,
>> +				     /* wIndex */ 0x00,
>> +				     dummy, sizeof(dummy),
>> +				     25,
>> +				     GFP_KERNEL);
>> +		if (ret)
>> +			dev_warn(&xpad->dev->dev,
>> +				 "unable to receive magic message: %d\n", ret);
> 
> You are not setting "ret", how was this tested?

Presumably with a stack frame that had that space unwittingly initialized to zero. Good catch, thanks. I've resubmitted with this fixed in v2.

> 
>> +	}
>> +
>>  	ep_irq_in = ep_irq_out = NULL;
>>  
>>  	for (i = 0; i < 2; i++) {
>> -- 
>> 2.39.2
>>
> 

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

end of thread, other threads:[~2023-03-24  4:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-25  1:21 [PATCH 0/3] Input: xpad - Additional controller support Vicki Pfau
2023-02-25  1:21 ` [PATCH 1/3] Input: xpad - fix support for some third-party controllers Vicki Pfau
2023-03-23 21:39   ` Lyude Paul
2023-03-23 22:01     ` Lyude Paul
2023-03-24  1:30   ` Dmitry Torokhov
2023-03-24  4:06     ` Vicki Pfau
2023-02-25  1:21 ` [PATCH 2/3] Input: xpad - remove unused field in VID/PID table Vicki Pfau
2023-03-24  1:33   ` Dmitry Torokhov
2023-02-25  1:21 ` [PATCH 3/3] Input: xpad - Add VID for Turtle Beach controllers Vicki Pfau
2023-03-24  1:33   ` Dmitry Torokhov

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).