Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PATCH][REGRESSION] HIDAPI uses incorrect mapping for Xbox One S BT (0x045e 0x02e0) #3075

Closed
SDLBugzilla opened this issue Feb 11, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: 2.0.9
Reported for operating system, platform: macOS 10.13, x86

Comments on the original bug report:

On 2018-11-20 06:19:51 +0000, Cameron Gutman wrote:

The new HIDAPI support is causing an issue for a user with an Xbox One S controller connected via Bluetooth (VID = 0x045e, PID = 0x02e0). The code in SDL_hidapi_xbox360.c for handling input reports from Xbox One S gamepads only handles a single button mapping, however early Xbox One S firmwares had a different Bluetooth button mapping.

In case you weren't aware, the Xbox One S controllers change BT PID when their firmware is updated, so 0x02e0 is simply an older firmware on the same exact hardware that would later report 0x02fd when updated.

You can see the difference in SDL_gamecontrollerdb.h, where the mappings for the old firmware (030000005e040000e002000003090000) are different than mappings for the new firmware (030000005e040000fd02000003090000).

Because HIDAPI is overriding the native macOS joystick support, the existing correct mappings from SDL 2.0.8 don't work anymore after updating to SDL 2.0.9 (unless we set SDL_JOYSTICK_HIDAPI=0).

Original bug: moonlight-stream/moonlight-qt#133

On 2018-11-20 15:47:32 +0000, Sam Lantinga wrote:

I don't have access to the older firmware. Can you provide a tested patch?

Thanks!

On 2018-11-20 18:17:36 +0000, Cameron Gutman wrote:

I'm in the same boat too. I might be able to get the user to test some changes though.

How do you prefer I solve this? Should we handle it in HIDAPI_DriverXboxOneS_HandleStatePacket() itself or could/should we make a separate mapping for HIDAPI's joystick GUID for this device?

On 2018-11-21 18:32:02 +0000, Sam Lantinga wrote:

The mapping for all HIDAPI controllers is fixed, we should handle it in HIDAPI_DriverXboxOneS_HandleStatePacket()

On 2019-05-01 03:45:12 +0000, Cameron Gutman wrote:

Created attachment 3772
Patch to ignore this old firmware for HIDAPI

I can't seem to get my hands on this older firmware, so I've posted this patch as a workaround. Rather than having to set SDL_HINT_JOYSTICK_HIDAPI_XBOX=0 and disable all HIDAPI support for Xbox gamepads, we can just ignore the single broken one and leave the others intact. The Cocoa joystick code will handle this gamepad properly using the existing mapping that ships with SDL.

On 2019-06-08 17:30:31 +0000, Sam Lantinga wrote:

That works for me...
https://hg.libsdl.org/SDL/rev/096f2f3c4bdc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant