# HG changeset patch # User Edgar Simo # Date 1217413717 0 # Node ID b5b8a7f4a9658eb85ee9f5751d72c14bbfd9e9bb # Parent 491e43f427eeaf4595d4cd9348ff268fe318ef3f Reset device and enable actuators when initializing. diff -r 491e43f427ee -r b5b8a7f4a965 src/haptic/darwin/SDL_syshaptic.c --- 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) {