Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Reset device and enable actuators when initializing.
  • Loading branch information
bobbens committed Jul 30, 2008
1 parent 3c0f6b5 commit f43c0a3
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions src/haptic/darwin/SDL_syshaptic.c
Expand Up @@ -364,12 +364,30 @@ SDL_SYS_HapticOpenFromService(SDL_Haptic * haptic, io_service_t service)
}

/* 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) {
Expand Down

0 comments on commit f43c0a3

Please sign in to comment.