linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: xpad - fix PowerA EnWired Controller guide button
@ 2022-10-06 22:12 Vicki Pfau
  2022-10-14 13:00 ` Mattijs Korpershoek
  2023-02-25  1:14 ` Lyude Paul
  0 siblings, 2 replies; 5+ messages in thread
From: Vicki Pfau @ 2022-10-06 22:12 UTC (permalink / raw)
  To: Dmitry Torokhov, Michael Cullen, Marcos Alano, linux-input; +Cc: Vicki Pfau

Some Xbox One controllers require more complete versions of the controller
start-up sequence used in official software in order to function properly.
This patch adds a usb_set_interface call that matches official startup and
nominally disabled the audio interface, which isn't supported in the xpad
driver in the first place.

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

diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index 18190b529bca..6449665d7b61 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -1509,6 +1509,13 @@ static int xpad_start_input(struct usb_xpad *xpad)
 		return -EIO;
 
 	if (xpad->xtype == XTYPE_XBOXONE) {
+		/* Explicitly disable the audio interface. This is needed for some
+		 * controllers, such as the PowerA Enhanced Wired Controller
+		 * for Series X|S (0x20d6:0x200e) to report the guide button */
+		error = usb_set_interface(xpad->udev, 1, 0);
+		if (error)
+			return error;
+
 		error = xpad_start_xbox_one(xpad);
 		if (error) {
 			usb_kill_urb(xpad->irq_in);
-- 
2.38.0


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

* Re: [PATCH] Input: xpad - fix PowerA EnWired Controller guide button
  2022-10-06 22:12 [PATCH] Input: xpad - fix PowerA EnWired Controller guide button Vicki Pfau
@ 2022-10-14 13:00 ` Mattijs Korpershoek
  2023-02-25  1:14 ` Lyude Paul
  1 sibling, 0 replies; 5+ messages in thread
From: Mattijs Korpershoek @ 2022-10-14 13:00 UTC (permalink / raw)
  To: Vicki Pfau, Dmitry Torokhov, Michael Cullen, Marcos Alano, linux-input
  Cc: Vicki Pfau

Hi Vicki,

Thank you for your patch.

On Thu, Oct 06, 2022 at 15:12, Vicki Pfau <vi@endrift.com> wrote:

> Some Xbox One controllers require more complete versions of the controller
> start-up sequence used in official software in order to function properly.
> This patch adds a usb_set_interface call that matches official startup and
> nominally disabled the audio interface, which isn't supported in the xpad
> driver in the first place.
>
> Signed-off-by: Vicki Pfau <vi@endrift.com>
> ---
>  drivers/input/joystick/xpad.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
> index 18190b529bca..6449665d7b61 100644
> --- a/drivers/input/joystick/xpad.c
> +++ b/drivers/input/joystick/xpad.c
> @@ -1509,6 +1509,13 @@ static int xpad_start_input(struct usb_xpad *xpad)
>  		return -EIO;
>  
>  	if (xpad->xtype == XTYPE_XBOXONE) {
> +		/* Explicitly disable the audio interface. This is needed for some
> +		 * controllers, such as the PowerA Enhanced Wired Controller
> +		 * for Series X|S (0x20d6:0x200e) to report the guide button */
> +		error = usb_set_interface(xpad->udev, 1, 0);

Can't we call this in probe() ?
It seems suspicious to be called here as the usb_set_interace() doc
states:

"Also, drivers must not change altsettings while urbs are scheduled for
endpoints in that interface;"

However, we just called usb_submit_urb() before. I'm not 100% sure but I
think we are contradicting the documentation here.


> +		if (error)

Shouldn't we call usb_kill_urb() here before returing the error?
It seems that's what is done in the other error path below.

> +			return error;
> +
>  		error = xpad_start_xbox_one(xpad);
>  		if (error) {
>  			usb_kill_urb(xpad->irq_in);
> -- 
> 2.38.0

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

* Re: [PATCH] Input: xpad - fix PowerA EnWired Controller guide button
  2022-10-06 22:12 [PATCH] Input: xpad - fix PowerA EnWired Controller guide button Vicki Pfau
  2022-10-14 13:00 ` Mattijs Korpershoek
@ 2023-02-25  1:14 ` Lyude Paul
  2023-02-25 18:27   ` Dmitry Torokhov
  1 sibling, 1 reply; 5+ messages in thread
From: Lyude Paul @ 2023-02-25  1:14 UTC (permalink / raw)
  To: Vicki Pfau, Dmitry Torokhov, Michael Cullen, Marcos Alano, linux-input

Poke, Dmitry - any chance we could get this pushed?

On Thu, 2022-10-06 at 15:12 -0700, Vicki Pfau wrote:
> Some Xbox One controllers require more complete versions of the controller
> start-up sequence used in official software in order to function properly.
> This patch adds a usb_set_interface call that matches official startup and
> nominally disabled the audio interface, which isn't supported in the xpad
> driver in the first place.
> 
> Signed-off-by: Vicki Pfau <vi@endrift.com>
> ---
>  drivers/input/joystick/xpad.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
> index 18190b529bca..6449665d7b61 100644
> --- a/drivers/input/joystick/xpad.c
> +++ b/drivers/input/joystick/xpad.c
> @@ -1509,6 +1509,13 @@ static int xpad_start_input(struct usb_xpad *xpad)
>  		return -EIO;
>  
>  	if (xpad->xtype == XTYPE_XBOXONE) {
> +		/* Explicitly disable the audio interface. This is needed for some
> +		 * controllers, such as the PowerA Enhanced Wired Controller
> +		 * for Series X|S (0x20d6:0x200e) to report the guide button */
> +		error = usb_set_interface(xpad->udev, 1, 0);
> +		if (error)
> +			return error;
> +
>  		error = xpad_start_xbox_one(xpad);
>  		if (error) {
>  			usb_kill_urb(xpad->irq_in);

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


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

* Re: [PATCH] Input: xpad - fix PowerA EnWired Controller guide button
  2023-02-25  1:14 ` Lyude Paul
@ 2023-02-25 18:27   ` Dmitry Torokhov
  2023-02-28  0:32     ` Vicki Pfau
  0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Torokhov @ 2023-02-25 18:27 UTC (permalink / raw)
  To: Lyude Paul; +Cc: Vicki Pfau, Michael Cullen, Marcos Alano, linux-input

Hi Lyude,

On Sat, Feb 25, 2023 at 02:14:27AM +0100, Lyude Paul wrote:
> Poke, Dmitry - any chance we could get this pushed?

I was waiting for Vicki to respond to Mattijs' comments...

Thanks.

-- 
Dmitry

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

* Re: [PATCH] Input: xpad - fix PowerA EnWired Controller guide button
  2023-02-25 18:27   ` Dmitry Torokhov
@ 2023-02-28  0:32     ` Vicki Pfau
  0 siblings, 0 replies; 5+ messages in thread
From: Vicki Pfau @ 2023-02-28  0:32 UTC (permalink / raw)
  To: Dmitry Torokhov, Lyude Paul; +Cc: Michael Cullen, Marcos Alano, linux-input

Hi Dmitry,

On 2/25/23 10:27, Dmitry Torokhov wrote:
> Hi Lyude,
> 
> On Sat, Feb 25, 2023 at 02:14:27AM +0100, Lyude Paul wrote:
>> Poke, Dmitry - any chance we could get this pushed?
> 
> I was waiting for Vicki to respond to Mattijs' comments...
> 
> Thanks.
> 

I'm a little confused as to what's happened here. This appears to be the thread for the v1 of this patch, but the v2 appeared later in a separate series (https://lore.kernel.org/linux-input/20230203022758.3982393-1-vi@endrift.com/T/#m98b35653c34a180e08cebb63b43b3690943f6e77) that was reviewed already. It moves the check into a separate function that will wind up properly freeing the URB if it fails. I tried moving it directly into probe, but that broke resume; it works properly when put in this function.

Vicki

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

end of thread, other threads:[~2023-02-28  0:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-06 22:12 [PATCH] Input: xpad - fix PowerA EnWired Controller guide button Vicki Pfau
2022-10-14 13:00 ` Mattijs Korpershoek
2023-02-25  1:14 ` Lyude Paul
2023-02-25 18:27   ` Dmitry Torokhov
2023-02-28  0:32     ` Vicki Pfau

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