linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cameron Gutman <aicommander@gmail.com>
To: Benjamin Valentin <benpicco@googlemail.com>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	linux-input@vger.kernel.org
Cc: Lee Jones <lee.jones@linaro.org>
Subject: Re: Input: xpad - add more Xbox one controller IDs
Date: Sat, 13 Nov 2021 19:34:54 -0600	[thread overview]
Message-ID: <dd40fcf9-582f-d5fd-4eec-ef06a8ecdf3b@gmail.com> (raw)
In-Reply-To: <20211113131734.46fbc9bf@rechenknecht2k11>

On 11/13/21 06:17, Benjamin Valentin wrote:
> These are collected from issue reports on [0].
> 
> I wonder a bit why we need to maintain this list to begin with, when
> the consoles (and Windows) can apparently identify any new third party
> controller just fine.

There are 2 related problems here:

1) Detection of compatible gamepads
2) User-visible identification of gamepads and quirks

For 1, the way Windows does it is via the Microsoft OS descriptor [0].
AFAIK, the specific OS descriptor strings are "XUSB20" for Xbox 360 and
"XGIP10" for Xbox One.

That functionality is handled by xpad_table[] and the bInterfaceProtocol
detection logic in xpad_probe(). The xpad_device[] entry isn't required for
detection or functionality of devices, unless those devices need special
treatment like MAP_TRIGGERS_TO_BUTTONS or something.

Since the protocols are vendor-defined, we end up having to maintain the
vendor list. If we could detect that Microsoft OS descriptor, that would
avoid the need to maintain the xpad_table[] vendor list.

2 is the main reason xpad_device[] exists (other than special devices).
Most devices have pretty useless string descriptors which doesn't really
allow userspace to provide a human-friendly descriptor for the user. OTOH,
Windows totally abdicates this responsibility and just refers to XInput
gamepads by a player index, so maybe it's not something we have to solve.

[0]: https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/microsoft-os-1-0-descriptors-specification

> I don't have *that* many controllers to do extensive tests, but I wonder
> if there could be a better way.
>> [0] https://github.com/paroj/xpad/issues
> 
> Signed-off-by: Benjamin Valentin <benpicco@googlemail.com>

Regards,
Cameron

  parent reply	other threads:[~2021-11-14  1:35 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 ` Cameron Gutman [this message]
2021-11-14 19:51   ` Input: xpad - add more Xbox one controller IDs Benjamin Valentin
2021-11-14 20:37     ` Benjamin Valentin
2021-11-14 21:14       ` Cameron Gutman
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=dd40fcf9-582f-d5fd-4eec-ef06a8ecdf3b@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).