comparison src/joystick/darwin/SDL_sysjoystick_c.h @ 2632:9e7f58b1b255 gsoc2008_force_feedback

Exposed the darwin joystick hardware data to the haptic subsystem.
author Edgar Simo <bobbens@gmail.com>
date Wed, 06 Aug 2008 11:08:29 +0000
parents
children 2f826c229d77
comparison
equal deleted inserted replaced
2631:a0845d7f4398 2632:9e7f58b1b255
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 IOHIDDeviceInterface **interface; /* interface to device, NULL = no interface */
64
65 char product[256]; /* name of product */
66 long usage; /* usage page from IOUSBHID Parser.h which defines general usage */
67 long usagePage; /* usage within above page from IOUSBHID Parser.h which defines specific usage */
68
69 long axes; /* number of axis (calculated, not reported by device) */
70 long buttons; /* number of buttons (calculated, not reported by device) */
71 long hats; /* number of hat switches (calculated, not reported by device) */
72 long elements; /* number of total elements (shouldbe total of above) (calculated, not reported by device) */
73
74 recElement *firstAxis;
75 recElement *firstButton;
76 recElement *firstHat;
77
78 int removed;
79 int uncentered;
80
81 struct joystick_hwdata *pNext; /* next device */
82 };
83 typedef struct joystick_hwdata recDevice;
84
85
86 #endif /* SDL_JOYSTICK_IOKIT_H */
87