Exposed the darwin joystick hardware data to the haptic subsystem. gsoc2008_force_feedback
authorEdgar Simo <bobbens@gmail.com>
Wed, 06 Aug 2008 11:08:29 +0000
branchgsoc2008_force_feedback
changeset 26329e7f58b1b255
parent 2631 a0845d7f4398
child 2633 6b0d1f494c10
Exposed the darwin joystick hardware data to the haptic subsystem.
src/haptic/darwin/SDL_syshaptic.c
src/joystick/darwin/SDL_sysjoystick.c
src/joystick/darwin/SDL_sysjoystick_c.h
     1.1 --- a/src/haptic/darwin/SDL_syshaptic.c	Wed Aug 06 11:02:13 2008 +0000
     1.2 +++ b/src/haptic/darwin/SDL_syshaptic.c	Wed Aug 06 11:08:29 2008 +0000
     1.3 @@ -27,7 +27,7 @@
     1.4  #include "../SDL_syshaptic.h"
     1.5  #include "SDL_joystick.h"
     1.6  #include "../../joystick/SDL_sysjoystick.h" /* For the real SDL_Joystick */
     1.7 -/*#include "../../joystick/dawrin/SDL_sysjoystick_c.h"*/ /* For joystick hwdata */ 
     1.8 +#include "../../joystick/dawrin/SDL_sysjoystick_c.h" /* For joystick hwdata */ 
     1.9  
    1.10  #include <IOKit/IOKitLib.h>
    1.11  #include <IOKit/hid/IOHIDKeys.h>
     2.1 --- a/src/joystick/darwin/SDL_sysjoystick.c	Wed Aug 06 11:02:13 2008 +0000
     2.2 +++ b/src/joystick/darwin/SDL_sysjoystick.c	Wed Aug 06 11:08:29 2008 +0000
     2.3 @@ -51,56 +51,7 @@
     2.4  #include "SDL_joystick.h"
     2.5  #include "../SDL_sysjoystick.h"
     2.6  #include "../SDL_joystick_c.h"
     2.7 -
     2.8 -struct recElement
     2.9 -{
    2.10 -    IOHIDElementCookie cookie;  /* unique value which identifies element, will NOT change */
    2.11 -    long min;                   /* reported min value possible */
    2.12 -    long max;                   /* reported max value possible */
    2.13 -#if 0
    2.14 -    /* TODO: maybe should handle the following stuff somehow? */
    2.15 -
    2.16 -    long scaledMin;             /* reported scaled min value possible */
    2.17 -    long scaledMax;             /* reported scaled max value possible */
    2.18 -    long size;                  /* size in bits of data return from element */
    2.19 -    Boolean relative;           /* are reports relative to last report (deltas) */
    2.20 -    Boolean wrapping;           /* does element wrap around (one value higher than max is min) */
    2.21 -    Boolean nonLinear;          /* are the values reported non-linear relative to element movement */
    2.22 -    Boolean preferredState;     /* does element have a preferred state (such as a button) */
    2.23 -    Boolean nullState;          /* does element have null state */
    2.24 -#endif                          /* 0 */
    2.25 -
    2.26 -    /* runtime variables used for auto-calibration */
    2.27 -    long minReport;             /* min returned value */
    2.28 -    long maxReport;             /* max returned value */
    2.29 -
    2.30 -    struct recElement *pNext;   /* next element in list */
    2.31 -};
    2.32 -typedef struct recElement recElement;
    2.33 -
    2.34 -struct joystick_hwdata
    2.35 -{
    2.36 -    IOHIDDeviceInterface **interface;   /* interface to device, NULL = no interface */
    2.37 -
    2.38 -    char product[256];          /* name of product */
    2.39 -    long usage;                 /* usage page from IOUSBHID Parser.h which defines general usage */
    2.40 -    long usagePage;             /* usage within above page from IOUSBHID Parser.h which defines specific usage */
    2.41 -
    2.42 -    long axes;                  /* number of axis (calculated, not reported by device) */
    2.43 -    long buttons;               /* number of buttons (calculated, not reported by device) */
    2.44 -    long hats;                  /* number of hat switches (calculated, not reported by device) */
    2.45 -    long elements;              /* number of total elements (shouldbe total of above) (calculated, not reported by device) */
    2.46 -
    2.47 -    recElement *firstAxis;
    2.48 -    recElement *firstButton;
    2.49 -    recElement *firstHat;
    2.50 -
    2.51 -    int removed;
    2.52 -    int uncentered;
    2.53 -
    2.54 -    struct joystick_hwdata *pNext;      /* next device */
    2.55 -};
    2.56 -typedef struct joystick_hwdata recDevice;
    2.57 +#include "SDL_sysjoystick_c.h"
    2.58  
    2.59  
    2.60  /* Linked list of all available devices */
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/src/joystick/darwin/SDL_sysjoystick_c.h	Wed Aug 06 11:08:29 2008 +0000
     3.3 @@ -0,0 +1,87 @@
     3.4 +/*
     3.5 +	SDL - Simple DirectMedia Layer
     3.6 +    Copyright (C) 1997-2004 Sam Lantinga
     3.7 +
     3.8 +	This library is free software; you can redistribute it and/or
     3.9 +	modify it under the terms of the GNU Library General Public
    3.10 +	License as published by the Free Software Foundation; either
    3.11 +	version 2 of the License, or (at your option) any later version.
    3.12 +
    3.13 +	This library is distributed in the hope that it will be useful,
    3.14 +	but WITHOUT ANY WARRANTY; without even the implied warranty of
    3.15 +	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    3.16 +	Library General Public License for more details.
    3.17 +
    3.18 +	You should have received a copy of the GNU Library General Public
    3.19 +	License along with this library; if not, write to the Free
    3.20 +	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    3.21 +
    3.22 +	Sam Lantinga
    3.23 +	slouken@libsdl.org
    3.24 +*/
    3.25 +#include "SDL_config.h"
    3.26 +
    3.27 +#ifndef SDL_JOYSTICK_IOKIT_H
    3.28 +
    3.29 +
    3.30 +#if MAC_OS_X_VERSION_MIN_REQUIRED == 1030
    3.31 +#include "10.3.9-FIX/IOHIDLib.h"
    3.32 +#else
    3.33 +#include <IOKit/hid/IOHIDLib.h>
    3.34 +#endif
    3.35 +#include <IOKit/hid/IOHIDKeys.h>
    3.36 +
    3.37 +
    3.38 +struct recElement
    3.39 +{
    3.40 +    IOHIDElementCookie cookie;  /* unique value which identifies element, will NOT change */
    3.41 +    long min;                   /* reported min value possible */
    3.42 +    long max;                   /* reported max value possible */
    3.43 +#if 0
    3.44 +    /* TODO: maybe should handle the following stuff somehow? */
    3.45 +
    3.46 +    long scaledMin;             /* reported scaled min value possible */
    3.47 +    long scaledMax;             /* reported scaled max value possible */
    3.48 +    long size;                  /* size in bits of data return from element */
    3.49 +    Boolean relative;           /* are reports relative to last report (deltas) */
    3.50 +    Boolean wrapping;           /* does element wrap around (one value higher than max is min) */
    3.51 +    Boolean nonLinear;          /* are the values reported non-linear relative to element movement */
    3.52 +    Boolean preferredState;     /* does element have a preferred state (such as a button) */
    3.53 +    Boolean nullState;          /* does element have null state */
    3.54 +#endif                          /* 0 */
    3.55 +
    3.56 +    /* runtime variables used for auto-calibration */
    3.57 +    long minReport;             /* min returned value */
    3.58 +    long maxReport;             /* max returned value */
    3.59 +
    3.60 +    struct recElement *pNext;   /* next element in list */
    3.61 +};
    3.62 +typedef struct recElement recElement;
    3.63 +
    3.64 +struct joystick_hwdata
    3.65 +{
    3.66 +    IOHIDDeviceInterface **interface;   /* interface to device, NULL = no interface */
    3.67 +
    3.68 +    char product[256];          /* name of product */
    3.69 +    long usage;                 /* usage page from IOUSBHID Parser.h which defines general usage */
    3.70 +    long usagePage;             /* usage within above page from IOUSBHID Parser.h which defines specific usage */
    3.71 +
    3.72 +    long axes;                  /* number of axis (calculated, not reported by device) */
    3.73 +    long buttons;               /* number of buttons (calculated, not reported by device) */
    3.74 +    long hats;                  /* number of hat switches (calculated, not reported by device) */
    3.75 +    long elements;              /* number of total elements (shouldbe total of above) (calculated, not reported by device) */
    3.76 +
    3.77 +    recElement *firstAxis;
    3.78 +    recElement *firstButton;
    3.79 +    recElement *firstHat;
    3.80 +
    3.81 +    int removed;
    3.82 +    int uncentered;
    3.83 +
    3.84 +    struct joystick_hwdata *pNext;      /* next device */
    3.85 +};
    3.86 +typedef struct joystick_hwdata recDevice;
    3.87 +
    3.88 +
    3.89 +#endif /* SDL_JOYSTICK_IOKIT_H */
    3.90 +