SDL Forum Index
SDL
Simple DirectMedia Layer Forums
Reply to topic
Different results with sdl_numjoysticks
Tinkh


Joined: 15 Mar 2017
Posts: 1
Reply with quote
The function sdl_numjoysticks does not return me always the same value (at init time). I explain.

I have two computers : one with DEBIAN6.0 (where I want to use my joysticks) and one with windows (where I work usually). I am connecting to the DEBIAN computer with MobaXterm (XDMCP session).
I made a little test program to print the number of joysticks.

Code:
#include <stdlib.h>
#include <stdio.h>
#include <SDL/SDL.h>
#include <SDL/SDL_joystick.h>

int NbJS,NJS;
void main() {
    if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) < 0)
    {
        fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
        exit(0);
    }

    NbJS=SDL_NumJoysticks();
    fprintf(stderr, "%i joysticks were found.\n\n", NbJS );

    for(NJS=0;NJS<NbJS;NJS++)
    {
        SDL_JoystickOpen(NJS);
        fprintf(stderr, "Joystick %d :%s\n",NJS,SDL_JoystickName(NJS));
    }

    SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
}

When I was connecting to the DEBIAN computer, it is OK and the function SDL_NumJoysticks() find two Joysticks :

2 joysticks were found.

Joystick 0 :Mad Catz Pro Flight Cessna Rudder Pedals

Joystick 1 :Madcatz Saitek Pro Flight X-55 Rhino Stick
When I was connecting directly in the DEBIAN computer, I do not have the same result :

1 joysticks were found.

Joystick 0 :Madcatz Saitek Pro Flight X-55 Rhino Stick
If I remove this stick, the DEBIAN computer finds correctly Mad Catz Pro Flight Cessna Rudder Pedals.

I used SDL 1.2.14. I can not explain that. If anybody has an explaination ... If I upgrade SDL, does it resolve the problem ? I am not sure to be allowed to do this update.
View user's profileSend private message
Different results with sdl_numjoysticks
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic