Fixed force feedback detection of joystick devices gsoc2008_force_feedback
authorSam Lantinga
Mon, 11 Aug 2008 02:51:32 +0000
branchgsoc2008_force_feedback
changeset 2640e8a54b6fd512
parent 2639 668fee3b268a
child 2641 e1e1be935178
Fixed force feedback detection of joystick devices
src/joystick/darwin/SDL_sysjoystick.c
     1.1 --- a/src/joystick/darwin/SDL_sysjoystick.c	Sun Aug 10 19:53:58 2008 +0000
     1.2 +++ b/src/joystick/darwin/SDL_sysjoystick.c	Mon Aug 11 02:51:32 2008 +0000
     1.3 @@ -647,20 +647,6 @@
     1.4          if (!device)
     1.5              continue;
     1.6  
     1.7 -        /* We have to do some storage of the io_service_t for
     1.8 -         * SDL_HapticOpenFromJoystick */
     1.9 -        if (FFIsForceFeedback((io_service_t)device) == FF_OK) {
    1.10 -           device->ffservice = ioHIDDeviceObject;
    1.11 -        }
    1.12 -        else {
    1.13 -           device->ffservice = 0;
    1.14 -           /* dump device object, it is no longer needed */
    1.15 -           result = IOObjectRelease(ioHIDDeviceObject);
    1.16 -        }
    1.17 -/*		if (KERN_SUCCESS != result)
    1.18 -			HIDReportErrorNum ("IOObjectRelease error with ioHIDDeviceObject.", result);
    1.19 -*/
    1.20 -
    1.21          /* Filter device list to non-keyboard/mouse stuff */
    1.22          if ((device->usagePage != kHIDPage_GenericDesktop) ||
    1.23              ((device->usage != kHIDUsage_GD_Joystick &&
    1.24 @@ -673,6 +659,15 @@
    1.25              continue;
    1.26          }
    1.27  
    1.28 +        /* We have to do some storage of the io_service_t for
    1.29 +         * SDL_HapticOpenFromJoystick */
    1.30 +        if (FFIsForceFeedback(ioHIDDeviceObject) == FF_OK) {
    1.31 +           device->ffservice = ioHIDDeviceObject;
    1.32 +        }
    1.33 +        else {
    1.34 +           device->ffservice = 0;
    1.35 +        }
    1.36 +
    1.37          /* Add device to the end of the list */
    1.38          if (lastDevice)
    1.39              lastDevice->pNext = device;