Fixed force feedback detection of joystick devices gsoc2008_force_feedback
authorSam Lantinga <slouken@libsdl.org>
Mon, 11 Aug 2008 02:51:32 +0000
branchgsoc2008_force_feedback
changeset 2640 e8a54b6fd512
parent 2639 668fee3b268a
child 2641 e1e1be935178
Fixed force feedback detection of joystick devices
src/joystick/darwin/SDL_sysjoystick.c
--- a/src/joystick/darwin/SDL_sysjoystick.c	Sun Aug 10 19:53:58 2008 +0000
+++ b/src/joystick/darwin/SDL_sysjoystick.c	Mon Aug 11 02:51:32 2008 +0000
@@ -647,20 +647,6 @@
         if (!device)
             continue;
 
-        /* We have to do some storage of the io_service_t for
-         * SDL_HapticOpenFromJoystick */
-        if (FFIsForceFeedback((io_service_t)device) == FF_OK) {
-           device->ffservice = ioHIDDeviceObject;
-        }
-        else {
-           device->ffservice = 0;
-           /* dump device object, it is no longer needed */
-           result = IOObjectRelease(ioHIDDeviceObject);
-        }
-/*		if (KERN_SUCCESS != result)
-			HIDReportErrorNum ("IOObjectRelease error with ioHIDDeviceObject.", result);
-*/
-
         /* Filter device list to non-keyboard/mouse stuff */
         if ((device->usagePage != kHIDPage_GenericDesktop) ||
             ((device->usage != kHIDUsage_GD_Joystick &&
@@ -673,6 +659,15 @@
             continue;
         }
 
+        /* We have to do some storage of the io_service_t for
+         * SDL_HapticOpenFromJoystick */
+        if (FFIsForceFeedback(ioHIDDeviceObject) == FF_OK) {
+           device->ffservice = ioHIDDeviceObject;
+        }
+        else {
+           device->ffservice = 0;
+        }
+
         /* Add device to the end of the list */
         if (lastDevice)
             lastDevice->pNext = device;