| Summary: | Haptic: SDL_SYS_HapticOpenFromJoystick failed on macOS mojave 10.14 | ||
|---|---|---|---|
| Product: | SDL | Reporter: | haxpor |
| Component: | haptic | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED WONTFIX | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | cameron.gutman, maxime.leblanc, meyraud705 |
| Version: | 2.0.9 | Keywords: | target-2.0.14 |
| Hardware: | x86_64 | ||
| OS: | Other | ||
|
Description
haxpor
2018-10-18 03:09:24 UTC
Update: Tested with official release of 2.0.9, and the issue is still there. Using SDL 2.0.11 on macOS Catalina we are having the same issue. Just running the `testhaptic` or `testrumble` returns ``` 2019-12-20 16:26:10.491 testrumble[6730:34686] INFO: 0 Haptic devices detected. 2019-12-20 16:26:10.491 testrumble[6730:34686] ERROR: No Haptic devices found! ``` This is with an Xbox One S Bluetooth gamepad. This gamepad works well when testing through https://html5gamepad.com/ and it has vibrations. On Windows, SDL_HapticOpenFromJoystick does not work on joysticks that use hidapi driver. I think it is the same on other platform. Try using SDL_JoystickRumble instead. (In reply to meyraud705 from comment #3) > On Windows, SDL_HapticOpenFromJoystick does not work on joysticks that use > hidapi driver. I think it is the same on other platform. > > Try using SDL_JoystickRumble instead. I also encountered this issue (and addressed it by using the new SDL_GameControllerRumble() function). However, I don't think this is a real fix. Breaking SDL_HapticOpenFromJoystick() for HIDAPI joysticks results in a de facto regression from 2.0.8 to 2.0.9+, since many common joysticks that were previously handled using native drivers with SDL_Haptic support are now using HIDAPI by default. That means we will break haptics for games that update to the latest SDL (or worse, games that simply get built against the latest SDL downstream in a Linux distro or something, where the version of SDL used is outside of the game developer's control). I think the proper solution is to write a HIDAPI haptics driver that uses SDL_JoystickRumble() on the backend. I'll look into that if nobody beats me to it. Even using HIDAPI, which is no by default available on macOS, it does not get the controller to rumble. I have run some more testes and it appears that the controller rumbles only when wired and using the controller360 driver. When in bluetooth, I cannot get it to rumble even though it should work since I get it to rumble when on this page : https://html5gamepad.com/ Ok, I downloaded all 10 gigabytes of Chromium source to see how this works (firefox, fwiw, doesn't rumble a bluetooth Xbox One controller on a Mac on html5gamepad.com, either, but it did work with Chrome!), and they appear to be talking to it as a raw HID device. In SDL, the Haptic API uses macOS's force feedback API, and these controllers just do not report themselves as able to vibrate under that API, so it fails. SDL_JoystickRumble() (and the equivalent SDL_GameControllerRumble) _do_ work when used with hidapi, the same way this works in Chrome. I intend to remove the haptic API in 2.1, leaving just SDL_JoystickRumble(), and I don't intend to change the existing haptic code in 2.0, so I'm marking this as WONTFIX. If you need it on a Mac in the meantime, use SDL_JoystickRumble and build with hidapi support. --ryan. |