SDL  2.0
SDL_sysjoystick_c.h
Go to the documentation of this file.
1 /*
2  Simple DirectMedia Layer
3  Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
4 
5  This software is provided 'as-is', without any express or implied
6  warranty. In no event will the authors be held liable for any damages
7  arising from the use of this software.
8 
9  Permission is granted to anyone to use this software for any purpose,
10  including commercial applications, and to alter it and redistribute it
11  freely, subject to the following restrictions:
12 
13  1. The origin of this software must not be misrepresented; you must not
14  claim that you wrote the original software. If you use this software
15  in a product, an acknowledgment in the product documentation would be
16  appreciated but is not required.
17  2. Altered source versions must be plainly marked as such, and must not be
18  misrepresented as being the original software.
19  3. This notice may not be removed or altered from any source distribution.
20 */
21 #include "../../SDL_internal.h"
22 
23 #ifndef SDL_JOYSTICK_IOKIT_H
24 #define SDL_JOYSTICK_IOKIT_H
25 
26 #include <IOKit/hid/IOHIDLib.h>
27 #include <ForceFeedback/ForceFeedback.h>
28 #include <ForceFeedback/ForceFeedbackConstants.h>
29 
30 struct recElement
31 {
32  IOHIDElementRef elementRef;
33  IOHIDElementCookie cookie;
34  uint32_t usagePage, usage; /* HID usage */
35  SInt32 min; /* reported min value possible */
36  SInt32 max; /* reported max value possible */
37 
38  /* runtime variables used for auto-calibration */
39  SInt32 minReport; /* min returned value */
40  SInt32 maxReport; /* max returned value */
41 
42  struct recElement *pNext; /* next element in list */
43 };
44 typedef struct recElement recElement;
45 
47 {
48  IOHIDDeviceRef deviceRef; /* HIDManager device handle */
49  io_service_t ffservice; /* Interface for force feedback, 0 = no ff */
50  FFDeviceObjectReference ffdevice;
51  FFEFFECT *ffeffect;
52  FFEffectObjectReference ffeffect_ref;
54 
55  char product[256]; /* name of product */
56  uint32_t usage; /* usage page from IOUSBHID Parser.h which defines general usage */
57  uint32_t usagePage; /* usage within above page from IOUSBHID Parser.h which defines specific usage */
58 
59  int axes; /* number of axis (calculated, not reported by device) */
60  int buttons; /* number of buttons (calculated, not reported by device) */
61  int hats; /* number of hat switches (calculated, not reported by device) */
62  int elements; /* number of total elements (should be total of above) (calculated, not reported by device) */
63 
67 
69 
72 
73  struct joystick_hwdata *pNext; /* next device */
74 };
75 typedef struct joystick_hwdata recDevice;
76 
77 #endif /* SDL_JOYSTICK_IOKIT_H */
78 
79 /* vi: set ts=4 sw=4 expandtab: */
joystick_hwdata::guid
SDL_JoystickGUID guid
Definition: SDL_sysjoystick_c.h:71
recElement
Definition: SDL_sysjoystick_c.h:30
recElement::min
SInt32 min
Definition: SDL_sysjoystick_c.h:35
joystick_hwdata::buttons
int buttons
Definition: SDL_sysjoystick_c.h:60
recElement::cookie
IOHIDElementCookie cookie
Definition: SDL_sysjoystick_c.h:33
joystick_hwdata::instance_id
int instance_id
Definition: SDL_sysjoystick_c.h:70
recElement::max
SInt32 max
Definition: SDL_sysjoystick_c.h:36
joystick_hwdata::firstHat
recElement * firstHat
Definition: SDL_sysjoystick_c.h:66
recElement::elementRef
IOHIDElementRef elementRef
Definition: SDL_sysjoystick_c.h:32
joystick_hwdata::axes
int axes
Definition: SDL_sysjoystick_c.h:59
recElement::usage
uint32_t usage
Definition: SDL_sysjoystick_c.h:34
recElement::maxReport
SInt32 maxReport
Definition: SDL_sysjoystick_c.h:40
joystick_hwdata::removed
SDL_bool removed
Definition: SDL_sysjoystick_c.h:68
joystick_hwdata::elements
int elements
Definition: SDL_sysjoystick_c.h:62
joystick_hwdata::hats
int hats
Definition: SDL_sysjoystick_c.h:61
recElement::minReport
SInt32 minReport
Definition: SDL_sysjoystick_c.h:39
recElement::usagePage
uint32_t usagePage
Definition: SDL_sysjoystick_c.h:34
joystick_hwdata::usagePage
uint32_t usagePage
Definition: SDL_sysjoystick_c.h:57
joystick_hwdata::firstAxis
recElement * firstAxis
Definition: SDL_sysjoystick_c.h:64
joystick_hwdata::ffeffect_ref
FFEffectObjectReference ffeffect_ref
Definition: SDL_sysjoystick_c.h:52
recElement::pNext
struct recElement * pNext
Definition: SDL_sysjoystick_c.h:42
joystick_hwdata::ff_initialized
SDL_bool ff_initialized
Definition: SDL_sysjoystick_c.h:53
uint32_t
unsigned int uint32_t
Definition: SDL_config_windows.h:63
joystick_hwdata::product
char product[256]
Definition: SDL_sysjoystick_c.h:55
joystick_hwdata::pNext
struct joystick_hwdata * pNext
Definition: SDL_sysjoystick_c.h:73
joystick_hwdata::usage
uint32_t usage
Definition: SDL_sysjoystick_c.h:56
joystick_hwdata::deviceRef
IOHIDDeviceRef deviceRef
Definition: SDL_sysjoystick_c.h:48
joystick_hwdata::ffservice
io_service_t ffservice
Definition: SDL_sysjoystick_c.h:49
joystick_hwdata::ffeffect
FFEFFECT * ffeffect
Definition: SDL_sysjoystick_c.h:51
joystick_hwdata::ffdevice
FFDeviceObjectReference ffdevice
Definition: SDL_sysjoystick_c.h:50
SDL_JoystickGUID
Definition: SDL_joystick.h:70
joystick_hwdata::firstButton
recElement * firstButton
Definition: SDL_sysjoystick_c.h:65
joystick_hwdata
Definition: SDL_sysjoystick_c.h:46
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:161