src/joystick/darwin/SDL_sysjoystick_c.h
author Sam Lantinga <slouken@libsdl.org>
Sun, 01 Jan 2017 18:33:28 -0800
changeset 10737 3406a0f8b041
parent 10595 9da2701eeb4a
child 11811 5d94cb6b24d3
permissions -rw-r--r--
Updated copyright for 2017
     1 /*
     2   Simple DirectMedia Layer
     3   Copyright (C) 1997-2017 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_internal.h"
    22 
    23 #ifndef SDL_JOYSTICK_IOKIT_H
    24 #define SDL_JOYSTICK_IOKIT_H
    25 
    26 #include <IOKit/hid/IOHIDLib.h>
    27 
    28 struct recElement
    29 {
    30     IOHIDElementRef elementRef;
    31     IOHIDElementCookie cookie;
    32     uint32_t usagePage, usage;      /* HID usage */
    33     SInt32 min;                   /* reported min value possible */
    34     SInt32 max;                   /* reported max value possible */
    35 
    36     /* runtime variables used for auto-calibration */
    37     SInt32 minReport;             /* min returned value */
    38     SInt32 maxReport;             /* max returned value */
    39 
    40     struct recElement *pNext;   /* next element in list */
    41 };
    42 typedef struct recElement recElement;
    43 
    44 struct joystick_hwdata
    45 {
    46     IOHIDDeviceRef deviceRef;   /* HIDManager device handle */
    47     io_service_t ffservice;     /* Interface for force feedback, 0 = no ff */
    48 
    49     char product[256];          /* name of product */
    50     uint32_t usage;                 /* usage page from IOUSBHID Parser.h which defines general usage */
    51     uint32_t usagePage;             /* usage within above page from IOUSBHID Parser.h which defines specific usage */
    52 
    53     int axes;                  /* number of axis (calculated, not reported by device) */
    54     int buttons;               /* number of buttons (calculated, not reported by device) */
    55     int hats;                  /* number of hat switches (calculated, not reported by device) */
    56     int elements;              /* number of total elements (should be total of above) (calculated, not reported by device) */
    57 
    58     recElement *firstAxis;
    59     recElement *firstButton;
    60     recElement *firstHat;
    61 
    62     SDL_bool removed;
    63 
    64     int instance_id;
    65     SDL_JoystickGUID guid;
    66 
    67     struct joystick_hwdata *pNext;      /* next device */
    68 };
    69 typedef struct joystick_hwdata recDevice;
    70 
    71 #endif /* SDL_JOYSTICK_IOKIT_H */
    72 
    73 /* vi: set ts=4 sw=4 expandtab: */