SDL Forum Index
SDL
Simple DirectMedia Layer Forums
Reply to topic
[Linux][SDL2.0.4] - Bug ? or normal behavior ?
videca


Joined: 04 Feb 2017
Posts: 2
Reply with quote
Hello,

I'm trying to handle Joysticks with SDL2, the actual version I'm using is 2.0.4 (from the distrib repo) on linux 4.4.0 (LinuxMint 18 )

I'm facing what seems to me, a stranger behavior :

I have a loop with SDL_WaitEvent(&event);
I have only one joystick (Logitech Extreme 3D Pro) which I'm connecting and disconnecting, again and again

When SDL_JOYDEVICEADDED appears 'event.jdevice.which' is always 0, which seems logic given that I've only one joystick

But for every next events SDL_JOYBUTTONDOWN / SDL_JOYBUTTONUP / SDL_JOYAXISMOTION / SDL_JOYHATMOTION / SDL_JOYDEVICEREMOVED,
the 'event.j*.which' value is incrementing Shocked each time I disconnect and reconnect the joystick

When SDL_JOYDEVICEADDED appears, I'm calling SDL_JoystickOpen()
when SDL_JOYDEVICEREMOVED appears, I'm calling SDL_JoystickClose();

- Did I miss something ? Rolling Eyes Is there something else than SDL_JoystickClose() to call, to release all ressources of one joystick ?
- Do you have the same behavior ?
- Don't you think that the normal behavior should be : when a SDL_JOYDEVICEADDED 'event.jdevice.which' should match every other 'event.j*.which' of other events, and most of all, should not increment when disconnecting/connecting ?

Thanks.
View user's profileSend private message
[Linux][SDL2.0.4] - Bug ? or normal behavior ?
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