linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cameron Gutman <aicommander@gmail.com>
To: Benjamin Valentin <benpicco@googlemail.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	linux-input@vger.kernel.org, Lee Jones <lee.jones@linaro.org>
Subject: Re: Input: xpad - add more Xbox one controller IDs
Date: Sun, 14 Nov 2021 15:14:38 -0600	[thread overview]
Message-ID: <74100aa9-d2aa-6bdd-46be-0d4ffb6496c8@gmail.com> (raw)
In-Reply-To: <20211114213731.2573be3a@rechenknecht2k11>

On 11/14/21 14:37, Benjamin Valentin wrote:
> On Sun, 14 Nov 2021 20:51:22 +0100
> Benjamin Valentin <benpicco@googlemail.com> wrote:
> 
>> The problem is that the gamepad then gets assigned the type
>> XTYPE_UNKNOWN which excludes it from all run-time code path switches.
> 
> Ah sorry for the noise. xpad_probe() already takes care of detecting
> the gamepad type for the XTYPE_UNKNOWN case.
> And this works for my Xbox 360 pad - not sure what's wrong with jstest,
> but that is unrelated.

Ah okay good, that's what I was expecting.

> 
> To avoid that confusion, how about
> 
> diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
> index 4c914f75a902..155ee644295d 100644
> --- a/drivers/input/joystick/xpad.c
> +++ b/drivers/input/joystick/xpad.c
>  @@ -1783,14 +1785,19 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
>  
>  	if (xpad->xtype == XTYPE_UNKNOWN) {
>  		if (intf->cur_altsetting->desc.bInterfaceClass == USB_CLASS_VENDOR_SPEC) {
> -			if (intf->cur_altsetting->desc.bInterfaceProtocol == 129)
> +			if (intf->cur_altsetting->desc.bInterfaceProtocol == 129) {
>  				xpad->xtype = XTYPE_XBOX360W;
> -			else if (intf->cur_altsetting->desc.bInterfaceProtocol == 208)
> +				xpad->name = "Generic Xbox 360 wireless pad";
> +			} else if (intf->cur_altsetting->desc.bInterfaceProtocol == 208) {
>  				xpad->xtype = XTYPE_XBOXONE;
> -			else
> +				xpad->name = "Generic Xbox One pad";
> +			} else {
>  				xpad->xtype = XTYPE_XBOX360;
> +				xpad->name = "Generic Xbox 360 pad";
> +			}
>  		} else {
>  			xpad->xtype = XTYPE_XBOX;
> +			xpad->name = "Generic Xbox classic pad";
>  		}
>  
>  		if (dpad_to_buttons)
> 
> 

I like this idea. There's a small risk of causing userspace breakages for
games matching "Generic X-Box pad" by name, but we already run that risk
each time we update xpad_devices[] anyway. You might even consider dropping
"Generic" from the name and just call them "Xbox One gamepad" or similar.

Can you also replace "Generic X-Box pad" with NULL in xpad_devices[]? I
don't think it would ever be used anymore after this change.


Regards,
Cameron

  reply	other threads:[~2021-11-14 21:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-13 12:17 Input: xpad - add more Xbox one controller IDs Benjamin Valentin
2021-11-13 12:20 ` [PATCH] Input: xpad - remove 'rumble support' from TODO Benjamin Valentin
2021-11-14  1:34 ` Input: xpad - add more Xbox one controller IDs Cameron Gutman
2021-11-14 19:51   ` Benjamin Valentin
2021-11-14 20:37     ` Benjamin Valentin
2021-11-14 21:14       ` Cameron Gutman [this message]
2021-11-16 15:52         ` Benjamin Valentin
2021-11-14 21:05     ` Cameron Gutman

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=74100aa9-d2aa-6bdd-46be-0d4ffb6496c8@gmail.com \
    --to=aicommander@gmail.com \
    --cc=benpicco@googlemail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-input@vger.kernel.org \
    /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).