src/haptic/darwin/SDL_syshaptic.c
branchgsoc2008_force_feedback
changeset 2550 b5b8a7f4a965
parent 2547 3cfe0ae232c0
child 2552 ee048e7bc909
--- a/src/haptic/darwin/SDL_syshaptic.c	Mon Jul 28 10:26:21 2008 +0000
+++ b/src/haptic/darwin/SDL_syshaptic.c	Wed Jul 30 10:28:37 2008 +0000
@@ -364,12 +364,30 @@
    }
 
    /* Get supported features. */
-   haptic->supported = GetSupportedFeatures(haptic->hwdata->device,
-                                            &haptic->neffects, &haptic->nplaying,
-                                            &haptic->naxes);
+   haptic->supported = GetSupportedFeatures( haptic->hwdata->device,
+                                             &haptic->neffects, &haptic->nplaying,
+                                             &haptic->naxes );
    if (haptic->supported == 0) { /* Error since device supports nothing. */
       goto open_err;
    }
+
+
+   /* Reset and then enable actuators. */
+   ret = FFDeviceSendForceFeedbackCommand( haptic->hwdata->device,
+                                           FFSFFC_RESET );
+   if (ret != FF_OK) {
+      SDL_SetError("Haptic: Unable to reset device: %s.", FFStrError(ret));
+      goto open_err;
+   }
+   ret = FFDeviceSendForceFeedbackCommand( haptic->hwdata->device,
+                                           FFSFFC_SETACTUATORSON  );
+   if (ret != FF_OK) {
+      SDL_SetError("Haptic: Unable to enable actuators: %s.", FFStrError(ret));
+      goto open_err;
+   }
+
+
+   /* Allocate effects memory. */
    haptic->effects = (struct haptic_effect *)
          SDL_malloc(sizeof(struct haptic_effect) * haptic->neffects);
    if (haptic->effects == NULL) {