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
This is ancient history now, but the issue turned out to be that my controller (Logitech F710) was in XInput mode instead of DirectInput mode, by the switch on top of the unit. XInput is not supported on Mac OS X.
Flipping the switch (to "D") makes the controller work as expected.
cf. http://cantonbecker.com/etcetera/2015/logitech-f710-for-os-x-macintosh-setup/