linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mattijs Korpershoek <mkorpershoek@baylibre.com>
To: Vicki Pfau <vi@endrift.com>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Michael Cullen <michael@michaelcullen.name>,
	Marcos Alano <marcoshalano@gmail.com>,
	linux-input@vger.kernel.org
Cc: Vicki Pfau <vi@endrift.com>
Subject: Re: [PATCH] Input: xpad - fix PowerA EnWired Controller guide button
Date: Fri, 14 Oct 2022 15:00:05 +0200	[thread overview]
Message-ID: <87v8omzhka.fsf@baylibre.com> (raw)
In-Reply-To: <20221006221209.2016372-1-vi@endrift.com>

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

  reply	other threads:[~2022-10-14 13:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-06 22:12 [PATCH] Input: xpad - fix PowerA EnWired Controller guide button Vicki Pfau
2022-10-14 13:00 ` Mattijs Korpershoek [this message]
2023-02-25  1:14 ` Lyude Paul
2023-02-25 18:27   ` Dmitry Torokhov
2023-02-28  0:32     ` Vicki Pfau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v8omzhka.fsf@baylibre.com \
    --to=mkorpershoek@baylibre.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=marcoshalano@gmail.com \
    --cc=michael@michaelcullen.name \
    --cc=vi@endrift.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).