# HG changeset patch # User Edgar Simo # Date 1218574171 0 # Node ID ef0ba67154c1f055e05a75fa57585e0e3deaa7a0 # Parent 91fd5d3cb90e5086cc424ab115f9ec433af2d677 More comments. Some code clean up. diff -r 91fd5d3cb90e -r ef0ba67154c1 src/haptic/linux/SDL_syshaptic.c --- a/src/haptic/linux/SDL_syshaptic.c Tue Aug 12 20:46:39 2008 +0000 +++ b/src/haptic/linux/SDL_syshaptic.c Tue Aug 12 20:49:31 2008 +0000 @@ -30,23 +30,19 @@ #include "../../joystick/linux/SDL_sysjoystick_c.h" /* For joystick hwdata */ #include /* close */ -#include -#include -#include -#include -#include -#include +#include /* Force feedback linux stuff. */ +#include /* O_RDWR */ #include /* INT_MAX */ -#include -#include -#include +#include /* errno, strerror */ +#include /* atan2 */ +/* Just in case. */ #ifndef M_PI # define M_PI 3.14159265358979323846 #endif -#define MAX_HAPTICS 32 +#define MAX_HAPTICS 32 /* It's doubtful someone has more then 32 evdev */ /* @@ -54,8 +50,8 @@ */ static struct { - char *fname; - SDL_Haptic *haptic; + char *fname; /* Dev path name (like /dev/input/event1) */ + SDL_Haptic *haptic; /* Assosciated haptic. */ } SDL_hapticlist[MAX_HAPTICS]; @@ -64,7 +60,7 @@ */ struct haptic_hwdata { - int fd; + int fd; /* File descriptor of the device. */ char *fname; /* Points to the name in SDL_hapticlist. */ }; @@ -348,6 +344,7 @@ return -1; } + /* Is it a mouse? */ if (EV_IsMouse(fd)) { close(fd); return i; @@ -469,6 +466,10 @@ ff_button = 0; + /* + * Not sure what the proper syntax is because this actually isn't implemented + * in the current kernel from what I've seen (2.6.26). + */ if (button != 0) { ff_button = BTN_GAMEPAD + button - 1; } @@ -648,6 +649,10 @@ dest->u.condition[1].deadband = CLAMP(condition->deadband[1]); dest->u.condition[1].center = condition->center[1]; + /* + * There is no envelope in the linux force feedback api for conditions. + */ + break; case SDL_HAPTIC_RAMP: