Draft: New input APIs to get controller type (Guitar, Wheel, etc) #47
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds input APIs to get the "type" of the controller - a plastic guitar, racing wheel, dance mat etc - so if a game developer wanted to handle specific cases with these controllers, or a controller tester homebrew wanted display the different inputs provided by a given class of device, they could do that.
For wireless controllers, the information is fetched out of the link report. This currently isn't fetched when the wireless adapter is detected, so only newly connected controllers are given a controller type.
For wired controllers, currently a hardcoded list of VID/PID pairs is used for guitars in particular. The information is reported in one of the descriptors (type 0x21) and ideally should be fetched from there. (We should also probably check for the XUSB descriptors on all connected devices to avoid needing a big VID/PID whitelist for every single controller that might exist like the Linux drivers have...)
When a controller is disconnected, the type is set to CTRL_TYPE_NONE to indicate being disconnected.