Fixed bug 2024 - Update OSX Joystick code to fully support Saitek p2500 gamepad
authorSam Lantinga <slouken@libsdl.org>
Sat, 10 Aug 2013 10:55:12 -0700
changeset 762636e493277423
parent 7624 ac9f3b12c42a
child 7627 401c4e0f492f
Fixed bug 2024 - Update OSX Joystick code to fully support Saitek p2500 gamepad

Patrick Maloney

Saitek p2500 (Cyborg Rumble Force Pad) has a D-pad, two analog sticks, and numerous buttons. SDL 2.x on OSX detected everything except the right-side analog stick. The right-side stick is considered a 'simulation device' with the axes mapped to throttle and rudder.

The patch adds support for throttle and rudder on the HID simulation page.
src/joystick/darwin/SDL_sysjoystick.c
     1.1 --- a/src/joystick/darwin/SDL_sysjoystick.c	Sat Aug 10 10:49:26 2013 -0700
     1.2 +++ b/src/joystick/darwin/SDL_sysjoystick.c	Sat Aug 10 10:55:12 2013 -0700
     1.3 @@ -362,6 +362,22 @@
     1.4                          }
     1.5                      }
     1.6                      break;
     1.7 +                case kHIDPage_Simulation:
     1.8 +		    switch (usage) {
     1.9 +			case kHIDUsage_Sim_Rudder:
    1.10 +			case kHIDUsage_Sim_Throttle:
    1.11 +                            element = (recElement *)
    1.12 +                                NewPtrClear(sizeof(recElement));
    1.13 +                            if (element) {
    1.14 +                                pDevice->axes++;
    1.15 +                                headElement = &(pDevice->firstAxis);
    1.16 +                            }
    1.17 +			    break;
    1.18 +
    1.19 +			default:
    1.20 +			    break;
    1.21 +		    }
    1.22 +                    break;
    1.23                  case kHIDPage_Button:
    1.24                      element = (recElement *)
    1.25                          NewPtrClear(sizeof(recElement));