From 0a3513dc63f611367083f27346b20fc8b8dea67f Mon Sep 17 00:00:00 2001 From: Edgar Simo Date: Tue, 12 Aug 2008 20:49:31 +0000 Subject: [PATCH] More comments. Some code clean up. --- src/haptic/linux/SDL_syshaptic.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/haptic/linux/SDL_syshaptic.c b/src/haptic/linux/SDL_syshaptic.c index f0c282164..13d90eee5 100644 --- a/src/haptic/linux/SDL_syshaptic.c +++ b/src/haptic/linux/SDL_syshaptic.c @@ -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 @@ static struct */ 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 @@ SDL_SYS_HapticMouse(void) return -1; } + /* Is it a mouse? */ if (EV_IsMouse(fd)) { close(fd); return i; @@ -469,6 +466,10 @@ SDL_SYS_ToButton( Uint16 button ) 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 @@ SDL_SYS_ToFFEffect( struct ff_effect * dest, SDL_HapticEffect * src ) 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: