Mercurial > sdl-ios-xcode
comparison src/joystick/darwin/SDL_sysjoystick.c @ 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 | dbc6d1893869 |
children | 2f826c229d77 |
comparison
equal
deleted
inserted
replaced
2631:a0845d7f4398 | 2632:9e7f58b1b255 |
---|---|
49 #include <Carbon/Carbon.h> /* for NewPtrClear, DisposePtr */ | 49 #include <Carbon/Carbon.h> /* for NewPtrClear, DisposePtr */ |
50 | 50 |
51 #include "SDL_joystick.h" | 51 #include "SDL_joystick.h" |
52 #include "../SDL_sysjoystick.h" | 52 #include "../SDL_sysjoystick.h" |
53 #include "../SDL_joystick_c.h" | 53 #include "../SDL_joystick_c.h" |
54 | 54 #include "SDL_sysjoystick_c.h" |
55 struct recElement | |
56 { | |
57 IOHIDElementCookie cookie; /* unique value which identifies element, will NOT change */ | |
58 long min; /* reported min value possible */ | |
59 long max; /* reported max value possible */ | |
60 #if 0 | |
61 /* TODO: maybe should handle the following stuff somehow? */ | |
62 | |
63 long scaledMin; /* reported scaled min value possible */ | |
64 long scaledMax; /* reported scaled max value possible */ | |
65 long size; /* size in bits of data return from element */ | |
66 Boolean relative; /* are reports relative to last report (deltas) */ | |
67 Boolean wrapping; /* does element wrap around (one value higher than max is min) */ | |
68 Boolean nonLinear; /* are the values reported non-linear relative to element movement */ | |
69 Boolean preferredState; /* does element have a preferred state (such as a button) */ | |
70 Boolean nullState; /* does element have null state */ | |
71 #endif /* 0 */ | |
72 | |
73 /* runtime variables used for auto-calibration */ | |
74 long minReport; /* min returned value */ | |
75 long maxReport; /* max returned value */ | |
76 | |
77 struct recElement *pNext; /* next element in list */ | |
78 }; | |
79 typedef struct recElement recElement; | |
80 | |
81 struct joystick_hwdata | |
82 { | |
83 IOHIDDeviceInterface **interface; /* interface to device, NULL = no interface */ | |
84 | |
85 char product[256]; /* name of product */ | |
86 long usage; /* usage page from IOUSBHID Parser.h which defines general usage */ | |
87 long usagePage; /* usage within above page from IOUSBHID Parser.h which defines specific usage */ | |
88 | |
89 long axes; /* number of axis (calculated, not reported by device) */ | |
90 long buttons; /* number of buttons (calculated, not reported by device) */ | |
91 long hats; /* number of hat switches (calculated, not reported by device) */ | |
92 long elements; /* number of total elements (shouldbe total of above) (calculated, not reported by device) */ | |
93 | |
94 recElement *firstAxis; | |
95 recElement *firstButton; | |
96 recElement *firstHat; | |
97 | |
98 int removed; | |
99 int uncentered; | |
100 | |
101 struct joystick_hwdata *pNext; /* next device */ | |
102 }; | |
103 typedef struct joystick_hwdata recDevice; | |
104 | 55 |
105 | 56 |
106 /* Linked list of all available devices */ | 57 /* Linked list of all available devices */ |
107 static recDevice *gpDeviceList = NULL; | 58 static recDevice *gpDeviceList = NULL; |
108 | 59 |