SDL 2.0 in Linux doesn't generate joystick events

I’m using SDL 2.0 (compiled myself), and my code has a SDL_PollEvent loop that looks for joystick input events. But whenever I press buttons/axes on my joysticks, no joystick events are generated. Does the current version of SDL 2.0 not have joystick support for Linux?

Did you initialize the joystick subystem and open the joystick for input?------------------------
Nate Fries

Thank you, Nathan. I somehow didn’t notice that I needed to pass SDL_INIT_JOYSTICK to SDL_Init(). But after reading the wiki a bit, I saw that I needed to also open the joystick for input (call SDL_JoystickOpen(0), and call it for other joystick indices if I wanted to use other joysticks), AND I have to manually enable joystick events (call SDL_JoystickEventState(SDL_ENABLE)). Now my event processing loop works, and I can continue with development of my game.

The events should already be enabled, unless explicitly disabled.
Other than that, yes, you need to initialize the joystick and open it for
input.On Tue, Apr 23, 2013 at 9:38 AM, nightmareci wrote:

**
Thank you, Nathan. I somehow didn’t notice that I needed to pass
SDL_INIT_JOYSTICK to SDL_Init(). But after reading the wiki a bit, I saw
that I needed to also open the joystick for input (call
SDL_JoystickOpen(0), and call it for other joystick indices if I wanted to
use other joysticks), AND I have to manually enable joystick events (call
SDL_JoystickEventState(SDL_ENABLE)). Now my event processing loop works,
and I can continue with development of my game.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org