src/haptic/linux/SDL_syshaptic.c
branchgsoc2008_force_feedback
changeset 2517 37c13c12c878
parent 2515 030fc4375e63
child 2518 07a5b225b9c9
--- a/src/haptic/linux/SDL_syshaptic.c	Thu Jul 10 17:52:57 2008 +0000
+++ b/src/haptic/linux/SDL_syshaptic.c	Thu Jul 10 17:54:08 2008 +0000
@@ -36,6 +36,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <linux/limits.h>
+#include <limits.h> /* INT_MAX */
 #include <string.h>
 #include <errno.h>
 #include <math.h>
@@ -672,14 +673,17 @@
  * Runs an effect.
  */
 int
-SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect * effect)
+SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect * effect, int iterations)
 {
    struct input_event run;
 
    /* Prepare to run the effect */
    run.type = EV_FF;
    run.code = effect->hweffect->effect.id;
-   run.value = 1;
+   if (iterations == SDL_HAPTIC_INFINITY)
+      run.value = INT_MAX;
+   else
+      run.value = iterations;
 
    if (write(haptic->hwdata->fd, (const void*) &run, sizeof(run)) < 0) {
       SDL_SetError("Haptic: Unable to run the effect: %s", strerror(errno));