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