src/joystick/darwin/SDL_sysjoystick_c.h
author Sam Lantinga <slouken@libsdl.org>
Sat, 31 Dec 2011 09:28:07 -0500
changeset 6138 4c64952a58fb
parent 5535 96594ac5fd1a
child 6690 9548c8a58103
permissions -rwxr-xr-x
Happy New Year!
     1 /*
     2   Simple DirectMedia Layer
     3   Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
     4 
     5   This software is provided 'as-is', without any express or implied
     6   warranty.  In no event will the authors be held liable for any damages
     7   arising from the use of this software.
     8 
     9   Permission is granted to anyone to use this software for any purpose,
    10   including commercial applications, and to alter it and redistribute it
    11   freely, subject to the following restrictions:
    12 
    13   1. The origin of this software must not be misrepresented; you must not
    14      claim that you wrote the original software. If you use this software
    15      in a product, an acknowledgment in the product documentation would be
    16      appreciated but is not required.
    17   2. Altered source versions must be plainly marked as such, and must not be
    18      misrepresented as being the original software.
    19   3. This notice may not be removed or altered from any source distribution.
    20 */
    21 #include "SDL_config.h"
    22 
    23 #ifndef SDL_JOYSTICK_IOKIT_H
    24 
    25 
    26 #include <IOKit/hid/IOHIDLib.h>
    27 #include <IOKit/hid/IOHIDKeys.h>
    28 
    29 
    30 struct recElement
    31 {
    32     IOHIDElementCookie cookie;  /* unique value which identifies element, will NOT change */
    33     long usagePage, usage;      /* HID usage */
    34     long min;                   /* reported min value possible */
    35     long max;                   /* reported max value possible */
    36 #if 0
    37     /* TODO: maybe should handle the following stuff somehow? */
    38 
    39     long scaledMin;             /* reported scaled min value possible */
    40     long scaledMax;             /* reported scaled max value possible */
    41     long size;                  /* size in bits of data return from element */
    42     Boolean relative;           /* are reports relative to last report (deltas) */
    43     Boolean wrapping;           /* does element wrap around (one value higher than max is min) */
    44     Boolean nonLinear;          /* are the values reported non-linear relative to element movement */
    45     Boolean preferredState;     /* does element have a preferred state (such as a button) */
    46     Boolean nullState;          /* does element have null state */
    47 #endif                          /* 0 */
    48 
    49     /* runtime variables used for auto-calibration */
    50     long minReport;             /* min returned value */
    51     long maxReport;             /* max returned value */
    52 
    53     struct recElement *pNext;   /* next element in list */
    54 };
    55 typedef struct recElement recElement;
    56 
    57 struct joystick_hwdata
    58 {
    59     io_service_t ffservice;     /* Interface for force feedback, 0 = no ff */
    60     IOHIDDeviceInterface **interface;   /* interface to device, NULL = no interface */
    61 
    62     char product[256];          /* name of product */
    63     long usage;                 /* usage page from IOUSBHID Parser.h which defines general usage */
    64     long usagePage;             /* usage within above page from IOUSBHID Parser.h which defines specific usage */
    65 
    66     long axes;                  /* number of axis (calculated, not reported by device) */
    67     long buttons;               /* number of buttons (calculated, not reported by device) */
    68     long hats;                  /* number of hat switches (calculated, not reported by device) */
    69     long elements;              /* number of total elements (shouldbe total of above) (calculated, not reported by device) */
    70 
    71     recElement *firstAxis;
    72     recElement *firstButton;
    73     recElement *firstHat;
    74 
    75     int removed;
    76     int uncentered;
    77 
    78     struct joystick_hwdata *pNext;      /* next device */
    79 };
    80 typedef struct joystick_hwdata recDevice;
    81 
    82 
    83 #endif /* SDL_JOYSTICK_IOKIT_H */