The source is very basic:
#include <SDL.h>
int main(int argc, char *argv[])
{
if (SDL_Init(SDL_INIT_JOYSTICK))
{
return 1;
}
int num_joy, i;
num_joy=SDL_NumJoysticks();
printf("%d joysticks found\n", num_joy);
for(i=0;i<num_joy;i++)
printf("%s\n", SDL_JoystickName(i));
SDL_Quit();
return 0;
}
This outputs the names of connected joysticks on Ubuntu 12.04, but not on my Mavericks Mac, with SDL 1.2.15, installed from Homebrew. Running it as root makes no difference. I assuming at this point that this is just a bug in SDL, but I'd love to be shown that I'm doing something wrong here.
Source here: https://github.com/mikepurvis/joystick_sdl