diff src/joystick/linux/SDL_sysjoystick.c @ 2490:be9b206d44af gsoc2008_force_feedback

Some more error checking. Implemented SDL_HapticOpenFromJoystick().
author Edgar Simo <bobbens@gmail.com>
date Wed, 02 Jul 2008 09:52:44 +0000
parents 96adc8025331
children
line wrap: on
line diff
--- a/src/joystick/linux/SDL_sysjoystick.c	Wed Jul 02 08:24:35 2008 +0000
+++ b/src/joystick/linux/SDL_sysjoystick.c	Wed Jul 02 09:52:44 2008 +0000
@@ -774,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);
 
@@ -787,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) {
@@ -809,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);