Re: Input: xpad - add more Xbox one controller IDs
From: Benjamin Valentin <benpicco@googlemail.com>
Date: 2021-11-14 19:51:42
On Sat, 13 Nov 2021 19:34:54 -0600 Cameron Gutman [off-list ref] wrote:
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.
The problem is that the gamepad then gets assigned the type
XTYPE_UNKNOWN which excludes it from all run-time code path switches.
E.g. if I comment out
// { 0x045e, 0x028e, "Microsoft X-Box 360 pad", 0, XTYPE_XBOX360 },
my X-Box 360 pad will not only lose any LED or rumble support, it will
also not report any input events with jstest because
xpad360_process_packet() is no longer called.
I'll try to check on how to read out the OS descriptor string, maybe
that allows us to detect the type on init and provide a better default
experience.
Best,
Benjamin