SDL2 AND SDL3 joystic/gamepad rumble doesn't work over Bluetooth

Initially I found out/thought from personal experience that SDL2 doesn’t support Rumble/Touchpad or Gyro (When on Bluetooth connection), I decided to jump to SDL3 because

this Game Controller Tester by POW Games project uses SDL3 and gets all three to function over bluetooth. So either they know how to make it work in SDL2/3 regardless, SDL3 has somehow solved it but not publicly stating why, or I’m dumb and don’t know how to use it over Bluetooth code wise… Because I have same issue under SDL3 too, I can make it rumble with USB, but not Bluetooth.

The testcontroller.c, when I build it, seems to work perfectly fine, I don’t know what I’m doing wrong, it would be much appreciated…

It depends on what controller you’re using. By default SDL will leave controllers in a compatible mode with other applications, but you can turn on hints to indicate that you’d like advanced features. Take a look at the hints at the beginning of main in testcontroller.c to see what options you have.


Hi @oosuke_ren , I sent you an email with code-snippets from my app which should help you. The hints you need which slouken mentioned are there.

1 Like

In a way it both helped and didn’t. Since I’m writing it in python, but pygame is for a way lter version that 3.4.4(windows xp) I decided to check their library (last resort) and saw that they’re resolving the bluetooth issue by setting SDL_HINTS throug the os.environ object, decided to test it, and yest, it turns out I can’t use SDL_SetHint with a secondary language.

Thank you, yes, I just saw it and somehow it inspired me to check the pygame library. Since you introduced a few SDL hints I hadn’t previously tried, decided to check if they’re properly set, and it turns out that when called Externally, SDL refuses to set hints, so it has to be done on OS level through supported for the language ways. This probably has to be stated somewhere for every incorporation of the library, especially since it took me around 16-20 hours to get this to work.

I’m glad you solved it in the end. I’m not sure I understand about the calling SDL externally. Hints are documented here SDL3/SDL_SetHint - SDL Wiki and there is a way to set them with environment variables, where SDL_SetHintWithPriority would be needed to override. Is that anything to do with the issue you had? If there’s something missing from the documentation, it can be added to help others in the future.

I can call SDL_SetHint() from BASIC, so I can’t think of any reason why you shouldn’t be able to call it from Python.

It is important to realise that both parameters are strings, and since it’s unlikely that the “secondary language” will know the symbolic versions of those strings (unless you add definitions yourself) you must substitute string literals.

The corresponding string literal is often subtly different from the symbol, and this can be a cause of problems if you don’t notice that. For example:


1 Like