Updated Linux joystick code to support hotplug, GUIDs, etc.

This uses libudev for hotplug, but it's optional, so we'll just try to find
 some reasonable defaults without it (maybe an older Linux box or under
 FreeBSD's Linux emulation?).
This commit is contained in:
Ryan C. Gordon 2012-12-11 12:07:06 -05:00
parent 41a157a462
commit c8713a62c1
6 changed files with 537 additions and 152 deletions

View file

@ -19,14 +19,16 @@
3. This notice may not be removed or altered from any source distribution.
*/
#if SDL_INPUT_LINUXEV
#include <linux/input.h>
#endif
/* The private structure used to keep track of a joystick */
struct joystick_hwdata
{
int fd;
int device_instance;
SDL_bool removed;
JoystickGUID guid;
char *fname; /* Used in haptic subsystem */
/* The current linux joystick driver maps hats to two axes */
@ -41,8 +43,6 @@ struct joystick_hwdata
} *balls;
/* Support for the Linux 2.4 unified input interface */
#if SDL_INPUT_LINUXEV
SDL_bool is_hid;
Uint8 key_map[KEY_MAX - BTN_MISC];
Uint8 abs_map[ABS_MAX];
struct axis_correct
@ -50,5 +50,4 @@ struct joystick_hwdata
int used;
int coef[3];
} abs_correct[ABS_MAX];
#endif
};