Trouble using haptics on macOs High Sierra


#1

Hello !

We are currently working on a game using Unity, and needed to implement a cross platform haptics system, so we decided to use SDL for that (by using the SDL2 C# Wrapper with the last SDL2 version downloaded today).

We are using this driver for the controller (an xbox360 controller), it support rumble since we can use it in the driver setting window.

On Windows everything is working as expected, but on Mac we can’t open the haptic with joystick, it throws the folowwing error : SDL_SYS_HapticOpenFromService failed.

Here is the code that cause problem :

    for (int i = 0; i < SDL.SDL_NumJoysticks();++i)
    {
        if (SDL.SDL_IsGameController(i) == SDL.SDL_bool.SDL_TRUE)
        {
            IntPtr l_joystick = SDL.SDL_JoystickOpen(i);

            if (SDL.SDL_JoystickIsHaptic(l_joystick) != 0)
            {
                //Add the joystick to the list and open his haptic
                m_joysticks.Add(i,l_joystick);
                m_haptics.Add(i,SDL.SDL_HapticOpenFromJoystick(l_joystick));
                Debug.LogError(SDL.SDL_GetError());
            }
        }
    }

The error is thrown by the last line where the haptics is oppened, and we have no idea where it could come from.

Any help is appreciated !

Edit : add more information
Edit : After a few test (but no change in code), we now have the error “There are 0 haptic devices available”, even though SDL_JoystickIsHaptic return 1.