| Summary: | Xbox Series X controller detected wrong by HIDAPI in MacOS | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Brian Torres-Gil <bugzilla> |
| Component: | joystick | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | cameron.gutman |
| Version: | 2.0.14 | ||
| Hardware: | x86 | ||
| OS: | macOS 10.15 | ||
| Attachments: |
Test script to detect controller
Patch |
||
|
Description
Brian Torres-Gil
2021-01-31 19:38:24 UTC
Does it work with the latest SDL snapshot? http://www.libsdl.org/tmp/SDL-2.0.zip If not, what version of OS are you running on? (In reply to Sam Lantinga from comment #1) > Does it work with the latest SDL snapshot? > http://www.libsdl.org/tmp/SDL-2.0.zip > > If not, what version of OS are you running on? Hi Sam, thanks for the quick reply. I just tested with the .zip file you provided. I used my test script and also jstest-sdl. (https://github.com/meleu/jstest-sdl) First, I compiled the SDL2 library in the .zip with ./configure and make. Next, I compiled and linked the test scripts against 2.0.14 and confirmed the issue is there as usual. Then, I compiled and linked these scripts the same way against the 2.0.15-14845 version in the .zip file and confirmed the same behavior is unchanged from 2.0.14. The main test where the issue is visible is `jstest-sdl -e 0` which prints all events from the controller. Other controllers produce events, but this controller doesn't produce any unless SDL_JOYSTICK_HIDAPI=0 is set. Let me know if I can collect any other info for you. I'm running MacOS 10.15.7 (19H2) on a MacBook Pro 2019. I can also reproduce this on an Intel MacBook Pro 13" 2020 running macOS 11.1. SDL recognizes the controller but no input is ever received from it as long as HIDAPI is enabled. With HIDAPI disabled, it works fine (except rumble, of course). Can you guys debug this? I'm not seeing Xbox controllers show up at all on my Mac Pro running 10.15.7. Created attachment 4757 [details]
Patch
This issue was that the IsBluetoothXboxOneController() function in SDL_hidapi_xbox360.c was missing the addition of USB_PRODUCT_XBOX_ONE_SERIES_X_BLUETOOTH which was present in the SDL_hidapi_xboxone.c version of the same function.
It was only broken on macOS because macOS has the special codepath for wired Xbox One controllers to be handled by SDL_hidapi_xbox360 (for 360Controller).
I moved the correct version of that function to a central location where both SDL_hidapi_xboxone.c and SDL_hidapi_xbox360.c can use it, so this mismatch won't happen again.
I applied Cameron's patch to the SDL-2.0.zip file provided earlier and tested again with jstest-sdl. I'm now getting events when the buttons are pushed! So the fix is verified. Thank you very much for the attention to this issue. I'm very grateful. Looks good, thanks! https://hg.libsdl.org/SDL/rev/540762271974 |