SDL/examples/input/02-joystick-events
..
joystick-events.c
README.txt

This example code looks for joystick input in the event handler, and
reports any changes as a flood of info.