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