src/joystick/linux/SDL_sysjoystick.c
changeset 211 0cc95f442f3a
parent 0 74212992fb08
child 221 50620ec9c86a
equal deleted inserted replaced
210:582abf60e21e 211:0cc95f442f3a
   141 	/* The base path of the joystick devices */
   141 	/* The base path of the joystick devices */
   142 	const char *joydev_pattern[2] = {
   142 	const char *joydev_pattern[2] = {
   143 		"/dev/js%d",
   143 		"/dev/js%d",
   144 #ifdef USE_INPUT_EVENTS
   144 #ifdef USE_INPUT_EVENTS
   145 		"/dev/input/event%d"
   145 		"/dev/input/event%d"
   146 #else
   146 #endif
   147 		"/dev/input/js%d"
   147 		"/dev/input/js%d"
   148 #endif
       
   149 	};
   148 	};
   150 	int numjoysticks;
   149 	int numjoysticks;
   151 	int i, j, done;
   150 	int i, j, done;
   152 	int fd;
   151 	int fd;
   153 	char path[PATH_MAX];
   152 	char path[PATH_MAX];
   220 				}
   219 				}
   221 			} else {
   220 			} else {
   222 				done = 1;
   221 				done = 1;
   223 			}
   222 			}
   224 		}
   223 		}
       
   224         /* This is a special case...
       
   225            If we're looking at the /dev/input event devices, and we found
       
   226            at least one, then we don't want to look at the input joystick
       
   227            devices, since they're built on top of devices that we've already
       
   228            seen, so we're done.
       
   229          */
       
   230         if ( i > 0 && j > 0 ) {
       
   231             done = 1;
       
   232         }
   225 	}
   233 	}
   226 	return(numjoysticks);
   234 	return(numjoysticks);
   227 }
   235 }
   228 
   236 
   229 /* Function to get the device-dependent name of a joystick */
   237 /* Function to get the device-dependent name of a joystick */