src/joystick/darwin/SDL_sysjoystick_c.h
author Sam Lantinga
Fri, 11 Feb 2011 22:37:15 -0800
changeset 5262 b530ef003506
parent 4925 514f811a4887
child 5535 96594ac5fd1a
permissions -rw-r--r--
Happy 2011! :)
     1 /*
     2     SDL - Simple DirectMedia Layer
     3     Copyright (C) 1997-2011 Sam Lantinga
     4 
     5     This library is free software; you can redistribute it and/or
     6     modify it under the terms of the GNU Lesser General Public
     7     License as published by the Free Software Foundation; either
     8     version 2.1 of the License, or (at your option) any later version.
     9 
    10     This library is distributed in the hope that it will be useful,
    11     but WITHOUT ANY WARRANTY; without even the implied warranty of
    12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    13     Lesser General Public License for more details.
    14 
    15     You should have received a copy of the GNU Lesser General Public
    16     License along with this library; if not, write to the Free Software
    17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    18 
    19     Sam Lantinga
    20     slouken@libsdl.org
    21 */
    22 #include "SDL_config.h"
    23 
    24 #ifndef SDL_JOYSTICK_IOKIT_H
    25 
    26 
    27 #include <IOKit/hid/IOHIDLib.h>
    28 #include <IOKit/hid/IOHIDKeys.h>
    29 
    30 
    31 struct recElement
    32 {
    33     IOHIDElementCookie cookie;  /* unique value which identifies element, will NOT change */
    34     long usagePage, usage;      /* HID usage */
    35     long min;                   /* reported min value possible */
    36     long max;                   /* reported max value possible */
    37 #if 0
    38     /* TODO: maybe should handle the following stuff somehow? */
    39 
    40     long scaledMin;             /* reported scaled min value possible */
    41     long scaledMax;             /* reported scaled max value possible */
    42     long size;                  /* size in bits of data return from element */
    43     Boolean relative;           /* are reports relative to last report (deltas) */
    44     Boolean wrapping;           /* does element wrap around (one value higher than max is min) */
    45     Boolean nonLinear;          /* are the values reported non-linear relative to element movement */
    46     Boolean preferredState;     /* does element have a preferred state (such as a button) */
    47     Boolean nullState;          /* does element have null state */
    48 #endif                          /* 0 */
    49 
    50     /* runtime variables used for auto-calibration */
    51     long minReport;             /* min returned value */
    52     long maxReport;             /* max returned value */
    53 
    54     struct recElement *pNext;   /* next element in list */
    55 };
    56 typedef struct recElement recElement;
    57 
    58 struct joystick_hwdata
    59 {
    60     io_service_t ffservice;     /* Interface for force feedback, 0 = no ff */
    61     IOHIDDeviceInterface **interface;   /* interface to device, NULL = no interface */
    62 
    63     char product[256];          /* name of product */
    64     long usage;                 /* usage page from IOUSBHID Parser.h which defines general usage */
    65     long usagePage;             /* usage within above page from IOUSBHID Parser.h which defines specific usage */
    66 
    67     long axes;                  /* number of axis (calculated, not reported by device) */
    68     long buttons;               /* number of buttons (calculated, not reported by device) */
    69     long hats;                  /* number of hat switches (calculated, not reported by device) */
    70     long elements;              /* number of total elements (shouldbe total of above) (calculated, not reported by device) */
    71 
    72     recElement *firstAxis;
    73     recElement *firstButton;
    74     recElement *firstHat;
    75 
    76     int removed;
    77     int uncentered;
    78 
    79     struct joystick_hwdata *pNext;      /* next device */
    80 };
    81 typedef struct joystick_hwdata recDevice;
    82 
    83 
    84 #endif /* SDL_JOYSTICK_IOKIT_H */