src/haptic/linux/SDL_syshaptic.c
branchgsoc2008_force_feedback
changeset 2484 666472fd4cb0
parent 2483 9d52368ebcf5
child 2485 67978eea6d10
--- a/src/haptic/linux/SDL_syshaptic.c	Tue Jul 01 14:09:53 2008 +0000
+++ b/src/haptic/linux/SDL_syshaptic.c	Tue Jul 01 14:21:09 2008 +0000
@@ -519,13 +519,36 @@
    ie.type = EV_FF;
    ie.code = FF_GAIN;
    ie.value = (0xFFFFUL * gain) / 100;
-   printf("%d\n",ie.value);
 
-   if (write(haptic->hwdata->fd, &ie, sizeof(ie)) == -1) {
+   if (write(haptic->hwdata->fd, &ie, sizeof(ie)) < 0) {
       SDL_SetError("Error setting gain.");
+      return -1;
    }
 
+   return 0;
 }
 
 
+/*
+ * Sets the autocentering.
+ */
+int
+SDL_SYS_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter)
+{
+   struct input_event ie;
+
+   ie.type = EV_FF;
+   ie.code = FF_AUTOCENTER;
+   ie.value = (0xFFFFUL * autocenter) / 100;
+
+   if (write(haptic->hwdata->fd, &ie, sizeof(ie)) < 0) {
+      SDL_SetError("Error setting autocenter.");
+      return -1;
+   }
+
+   return 0;
+}
+
+
+
 #endif /* SDL_HAPTIC_LINUX */