Joysticks found but no GameControllers available

Hi,

the problem is originated from using QtGamepad which uses SDL2 as a backend and
does not detect the joysticks (2x Thrustmaster T16000).

I wrote the following small program to track down the problem:

#include <stdio.h>
#include <SDL2/SDL.h>

int main() {

	printf("Initializing SDL...\n");

        if (SDL_Init( SDL_INIT_GAMECONTROLLER | SDL_INIT_JOYSTICK ) < 0) {
                fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
                exit(1);
        }

	printf("SDL initialized.\n");

        printf("%i joysticks were found.\n\n", SDL_NumJoysticks() );
        printf("The names of the joysticks are:\n");

        SDL_GameController *controller = NULL;
        for(int i=0; i < SDL_NumJoysticks(); i++ ) {

                SDL_Joystick *joystick = SDL_JoystickOpen(i);
                printf("%s\n\n", SDL_JoystickName(joystick));
                SDL_JoystickClose(joystick);

                printf("IsGameController: %i\n",SDL_IsGameController(i));

                SDL_GameController *controller = NULL;
                controller = SDL_GameControllerOpen(i);
                if (controller) {
                        printf("GameControllerName: %s\n",SDL_GameControllerName(controller));
                        SDL_GameControllerClose(controller);
                        controller = NULL;
                } else {
                        printf("Failed to open GameController %i\n",i);
                }
        }

	printf("Quitting SDL...\n");
        SDL_Quit();

        return 0;
}

Compiled with: “gcc main.c -lSDL2 -o sdljstest2”.

The output is:Initializing SDL…

SDL initialized.
2 joysticks were found.

The names of the joysticks are:
Thrustmaster T.16000M

IsGameController: 0
Failed to open GameController 0

Thrustmaster T.16000M

IsGameController: 0
Failed to open GameController 1
Quitting SDL...

As far as I understand instead of using the joystick API directly, the GameController API should be used(?).
But why are the joysticks not recognized as a GameController (IsGameController==0)?
Is there something wrong in my code?
Thanks for any hints and help.

Your Thrustmaster T.16000M is not “game controller” in terms of SDL.
GameController API is intended for Xbox-style gamepads. It is working by means of joystick-to-gamecontroller mappings that are lying in SDL/SDL_gamecontrollerdb.h at main · libsdl-org/SDL · GitHub file.
There is no mappings for your joystick in it and I don’t think that they should be there.

Ok, thanks.
Then it seems to be the other way round…
Only if it is a gamepad I should use the GameController API, if not I use the already known joystick api.