comparison src/haptic/darwin/SDL_syshaptic.c @ 2550:b5b8a7f4a965 gsoc2008_force_feedback

Reset device and enable actuators when initializing.
author Edgar Simo <bobbens@gmail.com>
date Wed, 30 Jul 2008 10:28:37 +0000
parents 3cfe0ae232c0
children ee048e7bc909
comparison
equal deleted inserted replaced
2549:491e43f427ee 2550:b5b8a7f4a965
362 FFStrError(ret)); 362 FFStrError(ret));
363 goto creat_err; 363 goto creat_err;
364 } 364 }
365 365
366 /* Get supported features. */ 366 /* Get supported features. */
367 haptic->supported = GetSupportedFeatures(haptic->hwdata->device, 367 haptic->supported = GetSupportedFeatures( haptic->hwdata->device,
368 &haptic->neffects, &haptic->nplaying, 368 &haptic->neffects, &haptic->nplaying,
369 &haptic->naxes); 369 &haptic->naxes );
370 if (haptic->supported == 0) { /* Error since device supports nothing. */ 370 if (haptic->supported == 0) { /* Error since device supports nothing. */
371 goto open_err; 371 goto open_err;
372 } 372 }
373
374
375 /* Reset and then enable actuators. */
376 ret = FFDeviceSendForceFeedbackCommand( haptic->hwdata->device,
377 FFSFFC_RESET );
378 if (ret != FF_OK) {
379 SDL_SetError("Haptic: Unable to reset device: %s.", FFStrError(ret));
380 goto open_err;
381 }
382 ret = FFDeviceSendForceFeedbackCommand( haptic->hwdata->device,
383 FFSFFC_SETACTUATORSON );
384 if (ret != FF_OK) {
385 SDL_SetError("Haptic: Unable to enable actuators: %s.", FFStrError(ret));
386 goto open_err;
387 }
388
389
390 /* Allocate effects memory. */
373 haptic->effects = (struct haptic_effect *) 391 haptic->effects = (struct haptic_effect *)
374 SDL_malloc(sizeof(struct haptic_effect) * haptic->neffects); 392 SDL_malloc(sizeof(struct haptic_effect) * haptic->neffects);
375 if (haptic->effects == NULL) { 393 if (haptic->effects == NULL) {
376 SDL_OutOfMemory(); 394 SDL_OutOfMemory();
377 goto open_err; 395 goto open_err;