comparison src/joystick/darwin/SDL_sysjoystick_c.h @ 2713:0906692aa6a4

Final merge of Google Summer of Code 2008 work... Force Feedback for SDL by Edgar Simo, mentored by Ryan C. Gordon
author Sam Lantinga <slouken@libsdl.org>
date Mon, 25 Aug 2008 09:55:03 +0000
parents
children caf3d5b2153f
comparison
equal deleted inserted replaced
2712:c4e697245676 2713:0906692aa6a4
1 /*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2004 Sam Lantinga
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 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 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public
16 License along with this library; if not, write to the Free
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 min; /* reported min value possible */
39 long max; /* reported max value possible */
40 #if 0
41 /* TODO: maybe should handle the following stuff somehow? */
42
43 long scaledMin; /* reported scaled min value possible */
44 long scaledMax; /* reported scaled max value possible */
45 long size; /* size in bits of data return from element */
46 Boolean relative; /* are reports relative to last report (deltas) */
47 Boolean wrapping; /* does element wrap around (one value higher than max is min) */
48 Boolean nonLinear; /* are the values reported non-linear relative to element movement */
49 Boolean preferredState; /* does element have a preferred state (such as a button) */
50 Boolean nullState; /* does element have null state */
51 #endif /* 0 */
52
53 /* runtime variables used for auto-calibration */
54 long minReport; /* min returned value */
55 long maxReport; /* max returned value */
56
57 struct recElement *pNext; /* next element in list */
58 };
59 typedef struct recElement recElement;
60
61 struct joystick_hwdata
62 {
63 io_service_t ffservice; /* Interface for force feedback, 0 = no ff */
64 IOHIDDeviceInterface **interface; /* interface to device, NULL = no interface */
65
66 char product[256]; /* name of product */
67 long usage; /* usage page from IOUSBHID Parser.h which defines general usage */
68 long usagePage; /* usage within above page from IOUSBHID Parser.h which defines specific usage */
69
70 long axes; /* number of axis (calculated, not reported by device) */
71 long buttons; /* number of buttons (calculated, not reported by device) */
72 long hats; /* number of hat switches (calculated, not reported by device) */
73 long elements; /* number of total elements (shouldbe total of above) (calculated, not reported by device) */
74
75 recElement *firstAxis;
76 recElement *firstButton;
77 recElement *firstHat;
78
79 int removed;
80 int uncentered;
81
82 struct joystick_hwdata *pNext; /* next device */
83 };
84 typedef struct joystick_hwdata recDevice;
85
86
87 #endif /* SDL_JOYSTICK_IOKIT_H */