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