Mercurial > sdl-ios-xcode
diff src/joystick/linux/SDL_sysjoystick.c @ 2713:0906692aa6a4
Final merge of Google Summer of Code 2008 work...
Force Feedback for SDL
by Edgar Simo, mentored by Ryan C. Gordon
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 25 Aug 2008 09:55:03 +0000 |
parents | a5de28552be4 |
children | 204be4fc2726 |
line wrap: on
line diff
--- a/src/joystick/linux/SDL_sysjoystick.c Mon Aug 25 08:50:37 2008 +0000 +++ b/src/joystick/linux/SDL_sysjoystick.c Mon Aug 25 09:55:03 2008 +0000 @@ -31,13 +31,11 @@ #include <sys/ioctl.h> #include <limits.h> /* For the definition of PATH_MAX */ #include <linux/joystick.h> -#if SDL_INPUT_LINUXEV -#include <linux/input.h> -#endif #include "SDL_joystick.h" #include "../SDL_sysjoystick.h" #include "../SDL_joystick_c.h" +#include "SDL_sysjoystick_c.h" /* Special joystick configurations */ static struct @@ -278,35 +276,6 @@ } SDL_joylist[MAX_JOYSTICKS]; -/* The private structure used to keep track of a joystick */ -struct joystick_hwdata -{ - int fd; - /* The current linux joystick driver maps hats to two axes */ - struct hwdata_hat - { - int axis[2]; - } *hats; - /* The current linux joystick driver maps balls to two axes */ - struct hwdata_ball - { - int axis[2]; - } *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 - { - int used; - int coef[3]; - } abs_correct[ABS_MAX]; -#endif -}; - - #ifndef NO_LOGICAL_JOYSTICKS static int @@ -805,6 +774,7 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick) { int fd; + char *fname; SDL_logical_joydecl(int realindex); SDL_logical_joydecl(SDL_Joystick * realjoy = NULL); @@ -818,13 +788,16 @@ return (-1); fd = realjoy->hwdata->fd; + fname = realjoy->hwdata->fname; } else { fd = open(SDL_joylist[joystick->index].fname, O_RDONLY, 0); + fname = SDL_joylist[joystick->index].fname; } SDL_joylist[joystick->index].joy = joystick; #else fd = open(SDL_joylist[joystick->index].fname, O_RDONLY, 0); + fname = SDL_joylist[joystick->index].fname; #endif if (fd < 0) { @@ -840,6 +813,7 @@ } SDL_memset(joystick->hwdata, 0, sizeof(*joystick->hwdata)); joystick->hwdata->fd = fd; + joystick->hwdata->fname = fname; /* Set the joystick to non-blocking read mode */ fcntl(fd, F_SETFL, O_NONBLOCK);