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