Removed obsolete Linux joystick code
authorSam Lantinga <slouken@libsdl.org>
Sat, 01 Feb 2003 20:25:34 +0000
changeset 5892e58ece48b61
parent 588 2c6510c0a304
child 590 3f1e241519d9
Removed obsolete Linux joystick code
src/joystick/linux/SDL_sysjoystick.c
     1.1 --- a/src/joystick/linux/SDL_sysjoystick.c	Sat Feb 01 19:59:23 2003 +0000
     1.2 +++ b/src/joystick/linux/SDL_sysjoystick.c	Sat Feb 01 20:25:34 2003 +0000
     1.3 @@ -77,7 +77,6 @@
     1.4  struct joystick_hwdata {
     1.5  	int fd;
     1.6  	/* The current linux joystick driver maps hats to two axes */
     1.7 -	int analog_hat;		/* Well, except for analog hats */
     1.8  	struct hwdata_hat {
     1.9  		int axis[2];
    1.10  	} *hats;
    1.11 @@ -366,14 +365,8 @@
    1.12  	/* Remap hats and balls */
    1.13  	if (handled) {
    1.14  		if ( joystick->nhats > 0 ) {
    1.15 -			/* HACK: Analog hats map to only one axis */
    1.16 -			if (old_axes == (joystick->naxes+joystick->nhats)){
    1.17 -				joystick->hwdata->analog_hat = 1;
    1.18 -			} else {
    1.19 -				if ( allocate_hatdata(joystick) < 0 ) {
    1.20 -					joystick->nhats = 0;
    1.21 -				}
    1.22 -				joystick->hwdata->analog_hat = 0;
    1.23 +			if ( allocate_hatdata(joystick) < 0 ) {
    1.24 +				joystick->nhats = 0;
    1.25  			}
    1.26  		}
    1.27  		if ( joystick->nballs > 0 ) {
    1.28 @@ -547,20 +540,6 @@
    1.29  	}
    1.30  }
    1.31  
    1.32 -/* This was necessary for the Wingman Extreme Analog joystick */
    1.33 -static __inline__
    1.34 -void HandleAnalogHat(SDL_Joystick *stick, Uint8 hat, int value)
    1.35 -{
    1.36 -	const Uint8 position_map[] = {
    1.37 -		SDL_HAT_UP,
    1.38 -		SDL_HAT_RIGHT,
    1.39 -		SDL_HAT_DOWN,
    1.40 -		SDL_HAT_LEFT,
    1.41 -		SDL_HAT_CENTERED
    1.42 -	};
    1.43 -	SDL_PrivateJoystickHat(stick, hat, position_map[(value/16000)+2]);
    1.44 -}
    1.45 -
    1.46  static __inline__
    1.47  void HandleBall(SDL_Joystick *stick, Uint8 ball, int axis, int value)
    1.48  {
    1.49 @@ -589,21 +568,12 @@
    1.50  					break;
    1.51  				}
    1.52  				events[i].number -= joystick->naxes;
    1.53 -				if ( joystick->hwdata->analog_hat ) {
    1.54 -					other_axis = events[i].number;
    1.55 -					if ( other_axis < joystick->nhats ) {
    1.56 -						HandleAnalogHat(joystick, other_axis,
    1.57 -							events[i].value);
    1.58 -						break;
    1.59 -					}
    1.60 -				} else {
    1.61 -					other_axis = (events[i].number / 2);
    1.62 -					if ( other_axis < joystick->nhats ) {
    1.63 -						HandleHat(joystick, other_axis,
    1.64 -							events[i].number%2,
    1.65 -							events[i].value);
    1.66 -						break;
    1.67 -					}
    1.68 +				other_axis = (events[i].number / 2);
    1.69 +				if ( other_axis < joystick->nhats ) {
    1.70 +					HandleHat(joystick, other_axis,
    1.71 +						events[i].number%2,
    1.72 +						events[i].value);
    1.73 +					break;
    1.74  				}
    1.75  				events[i].number -= joystick->nhats*2;
    1.76  				other_axis = (events[i].number / 2);