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.
quoted
[0] https://github.com/paroj/xpad/issues
Signed-off-by: Benjamin Valentin <benpicco@googlemail.com>
Regards,
Cameron