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