src/joystick/linux/SDL_sysjoystick.c
branchSDL-1.2
changeset 12076 3e05d58dc84f
parent 6325 9cff1c7c0fff
     1.1 --- a/src/joystick/linux/SDL_sysjoystick.c	Thu Aug 02 10:47:28 2018 +0300
     1.2 +++ b/src/joystick/linux/SDL_sysjoystick.c	Tue Aug 07 10:10:02 2018 +0300
     1.3 @@ -826,6 +826,9 @@
     1.4  		return(-1);
     1.5  	}
     1.6  	SDL_memset(joystick->hwdata, 0, sizeof(*joystick->hwdata));
     1.7 +#if SDL_INPUT_LINUXEV
     1.8 +	SDL_memset(joystick->hwdata->abs_map, ABS_MAX, sizeof(*joystick->hwdata->abs_map)*ABS_MAX);
     1.9 +#endif
    1.10  	joystick->hwdata->fd = fd;
    1.11  
    1.12  	/* Set the joystick to non-blocking read mode */
    1.13 @@ -1123,15 +1126,17 @@
    1.14  							events[i].value);
    1.15  					break;
    1.16  				    default:
    1.17 -					events[i].value = EV_AxisCorrect(joystick, code, events[i].value);
    1.18 +					if (joystick->hwdata->abs_map[code] != ABS_MAX ) {
    1.19 +					  events[i].value = EV_AxisCorrect(joystick, code, events[i].value);
    1.20  #ifndef NO_LOGICAL_JOYSTICKS
    1.21 -					if (!LogicalJoystickAxis(joystick,
    1.22 +					  if (!LogicalJoystickAxis(joystick,
    1.23  				           joystick->hwdata->abs_map[code],
    1.24  					   events[i].value))
    1.25  #endif
    1.26 -					SDL_PrivateJoystickAxis(joystick,
    1.27 +					  SDL_PrivateJoystickAxis(joystick,
    1.28  				           joystick->hwdata->abs_map[code],
    1.29  					   events[i].value);
    1.30 +					}
    1.31  					break;
    1.32  				}
    1.33  				break;