mirror of
https://github.com/MiyooCFW/buildroot.git
synced 2025-09-27 22:24:19 +03:00
26 lines
982 B
Diff
26 lines
982 B
Diff
diff --git a/src/joystick/linux/SDL_sysjoystick.c b/src/joystick/linux/SDL_sysjoystick.c
|
|
index c5cd0bb..20f7b0d 100644
|
|
--- a/src/joystick/linux/SDL_sysjoystick.c
|
|
+++ b/src/joystick/linux/SDL_sysjoystick.c
|
|
@@ -583,7 +583,7 @@ static SDL_bool JS_ConfigJoystick(SDL_Joystick *joystick, int fd)
|
|
SDL_bool handled;
|
|
unsigned char n;
|
|
int tmp_naxes, tmp_nhats, tmp_nballs;
|
|
- const char *name;
|
|
+ const char *name, *ptr;
|
|
char *env, env_name[128];
|
|
int i;
|
|
|
|
@@ -604,8 +604,9 @@ static SDL_bool JS_ConfigJoystick(SDL_Joystick *joystick, int fd)
|
|
name = SDL_SYS_JoystickName(joystick->index);
|
|
|
|
/* Generic analog joystick support */
|
|
- if ( SDL_strstr(name, "Analog") == name && SDL_strstr(name, "-hat") ) {
|
|
- if ( SDL_sscanf(name,"Analog %d-axis %*d-button %d-hat",
|
|
+ ptr = SDL_strstr(name, "Analog");
|
|
+ if ( ptr != NULL && SDL_strstr(ptr, "-hat") ) {
|
|
+ if ( SDL_sscanf(ptr,"Analog %d-axis %*d-button %d-hat",
|
|
&tmp_naxes, &tmp_nhats) == 2 ) {
|
|
|
|
joystick->naxes = tmp_naxes;
|