comparison src/haptic/linux/SDL_syshaptic.c @ 2489:96adc8025331 gsoc2008_force_feedback

Exposed some of the joystick stuff to the haptic subsystem. Added SDL_JoystickIsHaptic().
author Edgar Simo <bobbens@gmail.com>
date Wed, 02 Jul 2008 08:24:35 +0000
parents 8e2bdbccf7ff
children be9b206d44af
comparison
equal deleted inserted replaced
2488:8e2bdbccf7ff 2489:96adc8025331
24 #ifdef SDL_JOYSTICK_LINUX 24 #ifdef SDL_JOYSTICK_LINUX
25 25
26 #include "SDL_haptic.h" 26 #include "SDL_haptic.h"
27 #include "../SDL_haptic_c.h" 27 #include "../SDL_haptic_c.h"
28 #include "../SDL_syshaptic.h" 28 #include "../SDL_syshaptic.h"
29 #include "SDL_joystick.h"
30 #include "../../joystick/SDL_sysjoystick.h" /* For the real SDL_Joystick */
31 #include "../../joystick/linux/SDL_sysjoystick_c.h" /* For joystick hwdata */
29 32
30 #include <unistd.h> /* close */ 33 #include <unistd.h> /* close */
31 #include <linux/input.h> 34 #include <linux/input.h>
32 #include <sys/ioctl.h> 35 #include <sys/ioctl.h>
33 #include <sys/types.h> 36 #include <sys/types.h>
238 if (haptic->hwdata != NULL) { 241 if (haptic->hwdata != NULL) {
239 free(haptic->hwdata); 242 free(haptic->hwdata);
240 haptic->hwdata = NULL; 243 haptic->hwdata = NULL;
241 } 244 }
242 return -1; 245 return -1;
246 }
247
248
249 /*
250 * Checks to see if a joystick has haptic features.
251 */
252 int
253 SDL_SYS_JoystickIsHaptic(SDL_Joystick * joystick)
254 {
255 if (EV_IsHaptic(joystick->hwdata->fd) > 0)
256 return 1;
257 return 0;
258 }
259
260
261 /*
262 * Opens a SDL_Haptic from a SDL_Joystick.
263 */
264 int
265 SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick)
266 {
243 } 267 }
244 268
245 269
246 /* 270 /*
247 * Closes the haptic device. 271 * Closes the haptic device.
602 626
603 return 0; 627 return 0;
604 } 628 }
605 629
606 630
607
608 #endif /* SDL_HAPTIC_LINUX */ 631 #endif /* SDL_HAPTIC_LINUX */