21 #include "../../SDL_internal.h"
23 #ifdef SDL_JOYSTICK_HIDAPI
31 #include "../SDL_sysjoystick.h"
34 #include "../../SDL_hints_c.h"
36 #if defined(__WIN32__)
37 #include "../../core/windows/SDL_windows.h"
38 #include "../windows/SDL_rawinputjoystick_c.h"
41 #if defined(__MACOSX__)
42 #include <CoreFoundation/CoreFoundation.h>
43 #include <mach/mach.h>
44 #include <IOKit/IOKitLib.h>
45 #include <IOKit/hid/IOHIDDevice.h>
46 #include <IOKit/usb/USBSpec.h>
49 #if defined(__LINUX__)
50 #include "../../core/linux/SDL_udev.h"
51 #ifdef SDL_USE_LIBUDEV
62 #ifdef SDL_JOYSTICK_HIDAPI_PS4
65 #ifdef SDL_JOYSTICK_HIDAPI_PS5
68 #ifdef SDL_JOYSTICK_HIDAPI_STEAM
71 #ifdef SDL_JOYSTICK_HIDAPI_SWITCH
74 #ifdef SDL_JOYSTICK_HIDAPI_XBOX360
78 #ifdef SDL_JOYSTICK_HIDAPI_XBOXONE
81 #ifdef SDL_JOYSTICK_HIDAPI_GAMECUBE
85 static int SDL_HIDAPI_numdrivers = 0;
88 static int SDL_HIDAPI_numjoysticks = 0;
92 #if defined(SDL_USE_LIBUDEV)
93 static const SDL_UDEV_Symbols * usyms =
NULL;
102 #if defined(__WIN32__)
104 WNDCLASSEXA m_wndClass;
106 HDEVNOTIFY m_hNotify;
107 double m_flLastWin32MessageCheck;
110 #if defined(__MACOSX__)
111 IONotificationPortRef m_notificationPort;
112 mach_port_t m_notificationMach;
115 #if defined(SDL_USE_LIBUDEV)
116 struct udev *m_pUdev;
117 struct udev_monitor *m_pUdevMonitor;
120 } SDL_HIDAPI_discovery;
124 struct _DEV_BROADCAST_HDR
127 DWORD dbch_devicetype;
131 typedef struct _DEV_BROADCAST_DEVICEINTERFACE_A
134 DWORD dbcc_devicetype;
138 } DEV_BROADCAST_DEVICEINTERFACE_A, *PDEV_BROADCAST_DEVICEINTERFACE_A;
140 typedef struct _DEV_BROADCAST_HDR DEV_BROADCAST_HDR;
141 #define DBT_DEVICEARRIVAL 0x8000
142 #define DBT_DEVICEREMOVECOMPLETE 0x8004
143 #define DBT_DEVTYP_DEVICEINTERFACE 0x00000005
144 #define DBT_DEVNODES_CHANGED 0x0007
145 #define DBT_CONFIGCHANGED 0x0018
146 #define DBT_DEVICETYPESPECIFIC 0x8005
147 #define DBT_DEVINSTSTARTED 0x8008
149 #include <initguid.h>
150 DEFINE_GUID(GUID_DEVINTERFACE_USB_DEVICE, 0xA5DCBF10L, 0x6530, 0x11D2, 0x90, 0x1F, 0x00, 0xC0, 0x4F, 0xB9, 0x51, 0xED);
152 static LRESULT CALLBACK ControllerWndProc(HWND hwnd, UINT
message, WPARAM wParam, LPARAM lParam)
155 case WM_DEVICECHANGE:
157 case DBT_DEVICEARRIVAL:
158 case DBT_DEVICEREMOVECOMPLETE:
159 if (((DEV_BROADCAST_HDR*)lParam)->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) {
160 SDL_HIDAPI_discovery.m_bHaveDevicesChanged =
SDL_TRUE;
167 return DefWindowProc(hwnd,
message, wParam, lParam);
172 #if defined(__MACOSX__)
173 static void CallbackIOServiceFunc(
void *
context, io_iterator_t portIterator)
177 while ((entry = IOIteratorNext(portIterator)) != 0) {
178 IOObjectRelease(entry);
185 HIDAPI_InitializeDiscovery()
187 SDL_HIDAPI_discovery.m_bHaveDevicesChanged =
SDL_TRUE;
188 SDL_HIDAPI_discovery.m_bCanGetNotifications =
SDL_FALSE;
189 SDL_HIDAPI_discovery.m_unLastDetect = 0;
191 #if defined(__WIN32__)
194 SDL_zero(SDL_HIDAPI_discovery.m_wndClass);
195 SDL_HIDAPI_discovery.m_wndClass.hInstance = GetModuleHandle(
NULL);
196 SDL_HIDAPI_discovery.m_wndClass.lpszClassName =
"SDL_HIDAPI_DEVICE_DETECTION";
197 SDL_HIDAPI_discovery.m_wndClass.lpfnWndProc = ControllerWndProc;
198 SDL_HIDAPI_discovery.m_wndClass.cbSize =
sizeof(WNDCLASSEX);
200 RegisterClassExA(&SDL_HIDAPI_discovery.m_wndClass);
201 SDL_HIDAPI_discovery.m_hwndMsg = CreateWindowExA(0,
"SDL_HIDAPI_DEVICE_DETECTION",
NULL, 0, 0, 0, 0, 0, HWND_MESSAGE,
NULL,
NULL,
NULL);
204 DEV_BROADCAST_DEVICEINTERFACE_A devBroadcast;
207 devBroadcast.dbcc_size =
sizeof( devBroadcast );
208 devBroadcast.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
209 devBroadcast.dbcc_classguid = GUID_DEVINTERFACE_USB_DEVICE;
215 SDL_HIDAPI_discovery.m_hNotify = RegisterDeviceNotification( SDL_HIDAPI_discovery.m_hwndMsg, &devBroadcast, DEVICE_NOTIFY_WINDOW_HANDLE | DEVICE_NOTIFY_ALL_INTERFACE_CLASSES );
216 SDL_HIDAPI_discovery.m_bCanGetNotifications = ( SDL_HIDAPI_discovery.m_hNotify != 0 );
220 #if defined(__MACOSX__)
221 SDL_HIDAPI_discovery.m_notificationPort = IONotificationPortCreate(kIOMasterPortDefault);
222 if (SDL_HIDAPI_discovery.m_notificationPort) {
224 io_iterator_t portIterator = 0;
226 IOReturn
result = IOServiceAddMatchingNotification(
227 SDL_HIDAPI_discovery.m_notificationPort,
228 kIOFirstMatchNotification,
229 IOServiceMatching(kIOHIDDeviceKey),
230 CallbackIOServiceFunc, &SDL_HIDAPI_discovery.m_bHaveDevicesChanged, &portIterator);
234 while ((entry = IOIteratorNext(portIterator)) != 0) {
235 IOObjectRelease(entry);
238 IONotificationPortDestroy(SDL_HIDAPI_discovery.m_notificationPort);
239 SDL_HIDAPI_discovery.m_notificationPort = nil;
243 io_iterator_t portIterator = 0;
245 IOReturn
result = IOServiceAddMatchingNotification(
246 SDL_HIDAPI_discovery.m_notificationPort,
247 kIOTerminatedNotification,
248 IOServiceMatching(kIOHIDDeviceKey),
249 CallbackIOServiceFunc, &SDL_HIDAPI_discovery.m_bHaveDevicesChanged, &portIterator);
253 while ((entry = IOIteratorNext(portIterator)) != 0) {
254 IOObjectRelease(entry);
257 IONotificationPortDestroy(SDL_HIDAPI_discovery.m_notificationPort);
258 SDL_HIDAPI_discovery.m_notificationPort = nil;
263 SDL_HIDAPI_discovery.m_notificationMach = MACH_PORT_NULL;
264 if (SDL_HIDAPI_discovery.m_notificationPort) {
265 SDL_HIDAPI_discovery.m_notificationMach = IONotificationPortGetMachPort(SDL_HIDAPI_discovery.m_notificationPort);
268 SDL_HIDAPI_discovery.m_bCanGetNotifications = (SDL_HIDAPI_discovery.m_notificationMach != MACH_PORT_NULL);
272 #if defined(SDL_USE_LIBUDEV)
273 SDL_HIDAPI_discovery.m_pUdev =
NULL;
274 SDL_HIDAPI_discovery.m_pUdevMonitor =
NULL;
275 SDL_HIDAPI_discovery.m_nUdevFd = -1;
277 usyms = SDL_UDEV_GetUdevSyms();
279 SDL_HIDAPI_discovery.m_pUdev = usyms->udev_new();
281 if (SDL_HIDAPI_discovery.m_pUdev) {
282 SDL_HIDAPI_discovery.m_pUdevMonitor = usyms->udev_monitor_new_from_netlink(SDL_HIDAPI_discovery.m_pUdev,
"udev");
283 if (SDL_HIDAPI_discovery.m_pUdevMonitor) {
284 usyms->udev_monitor_enable_receiving(SDL_HIDAPI_discovery.m_pUdevMonitor);
285 SDL_HIDAPI_discovery.m_nUdevFd = usyms->udev_monitor_get_fd(SDL_HIDAPI_discovery.m_pUdevMonitor);
286 SDL_HIDAPI_discovery.m_bCanGetNotifications =
SDL_TRUE;
294 HIDAPI_UpdateDiscovery()
296 if (!SDL_HIDAPI_discovery.m_bCanGetNotifications) {
297 const Uint32 SDL_HIDAPI_DETECT_INTERVAL_MS = 3000;
299 if (!SDL_HIDAPI_discovery.m_unLastDetect ||
SDL_TICKS_PASSED(now, SDL_HIDAPI_discovery.m_unLastDetect + SDL_HIDAPI_DETECT_INTERVAL_MS)) {
300 SDL_HIDAPI_discovery.m_bHaveDevicesChanged =
SDL_TRUE;
301 SDL_HIDAPI_discovery.m_unLastDetect = now;
306 #if defined(__WIN32__)
309 if (
SDL_ThreadID() == SDL_HIDAPI_discovery.m_nThreadID) {
311 while (PeekMessage(&msg, SDL_HIDAPI_discovery.m_hwndMsg, 0, 0, PM_NOREMOVE)) {
312 if (GetMessageA(&msg, SDL_HIDAPI_discovery.m_hwndMsg, 0, 0) != 0) {
313 TranslateMessage(&msg);
314 DispatchMessage(&msg);
321 #if defined(__MACOSX__)
322 if (SDL_HIDAPI_discovery.m_notificationPort) {
323 struct { mach_msg_header_t hdr;
char payload[ 4096 ]; } msg;
324 while (mach_msg(&msg.hdr, MACH_RCV_MSG | MACH_RCV_TIMEOUT, 0,
sizeof(msg), SDL_HIDAPI_discovery.m_notificationMach, 0, MACH_PORT_NULL) == KERN_SUCCESS) {
325 IODispatchCalloutFromMessage(
NULL, &msg.hdr, SDL_HIDAPI_discovery.m_notificationPort);
330 #if defined(SDL_USE_LIBUDEV)
331 if (SDL_HIDAPI_discovery.m_nUdevFd >= 0) {
338 struct pollfd PollUdev;
339 struct udev_device *pUdevDevice;
341 PollUdev.fd = SDL_HIDAPI_discovery.m_nUdevFd;
342 PollUdev.events = POLLIN;
343 if (poll(&PollUdev, 1, 0) != 1) {
347 SDL_HIDAPI_discovery.m_bHaveDevicesChanged =
SDL_TRUE;
349 pUdevDevice = usyms->udev_monitor_receive_device(SDL_HIDAPI_discovery.m_pUdevMonitor);
351 usyms->udev_device_unref(pUdevDevice);
359 HIDAPI_ShutdownDiscovery()
361 #if defined(__WIN32__)
362 if (SDL_HIDAPI_discovery.m_hNotify)
363 UnregisterDeviceNotification(SDL_HIDAPI_discovery.m_hNotify);
365 if (SDL_HIDAPI_discovery.m_hwndMsg) {
366 DestroyWindow(SDL_HIDAPI_discovery.m_hwndMsg);
369 UnregisterClassA(SDL_HIDAPI_discovery.m_wndClass.lpszClassName, SDL_HIDAPI_discovery.m_wndClass.hInstance);
372 #if defined(__MACOSX__)
373 if (SDL_HIDAPI_discovery.m_notificationPort) {
374 IONotificationPortDestroy(SDL_HIDAPI_discovery.m_notificationPort);
378 #if defined(SDL_USE_LIBUDEV)
380 if (SDL_HIDAPI_discovery.m_pUdevMonitor) {
381 usyms->udev_monitor_unref(SDL_HIDAPI_discovery.m_pUdevMonitor);
383 if (SDL_HIDAPI_discovery.m_pUdev) {
384 usyms->udev_unref(SDL_HIDAPI_discovery.m_pUdev);
386 SDL_UDEV_ReleaseUdevSyms();
413 static void HIDAPI_JoystickDetect(
void);
414 static void HIDAPI_JoystickClose(SDL_Joystick *
joystick);
434 const Uint16 USAGE_PAGE_GENERIC_DESKTOP = 0x0001;
435 const Uint16 USAGE_JOYSTICK = 0x0004;
436 const Uint16 USAGE_GAMEPAD = 0x0005;
437 const Uint16 USAGE_MULTIAXISCONTROLLER = 0x0008;
446 if (
device->usage_page &&
device->usage_page != USAGE_PAGE_GENERIC_DESKTOP) {
449 if (
device->usage &&
device->usage != USAGE_JOYSTICK &&
device->usage != USAGE_GAMEPAD &&
device->usage != USAGE_MULTIAXISCONTROLLER) {
465 HIDAPI_GetDeviceByIndex(
int device_index,
SDL_JoystickID *pJoystickID)
470 if (device_index < device->num_joysticks) {
472 *pJoystickID =
device->joysticks[device_index];
476 device_index -=
device->num_joysticks;
484 HIDAPI_GetJoystickByInfo(
const char *
path,
Uint16 vendor_id,
Uint16 product_id)
488 if (
device->vendor_id == vendor_id &&
device->product_id == product_id &&
529 while (
device->num_joysticks) {
538 SDL_HIDAPIDriverHintChanged(
void *userdata,
const char *
name,
const char *oldValue,
const char *hint)
558 SDL_HIDAPI_numdrivers = 0;
562 ++SDL_HIDAPI_numdrivers;
571 HIDAPI_CleanupDeviceDriver(
device);
573 HIDAPI_SetupDeviceDriver(
device);
580 HIDAPI_JoystickInit(
void)
588 #if defined(__MACOSX__) || defined(__IPHONEOS__) || defined(__TVOS__)
593 SDL_SetError(
"Couldn't initialize hidapi, framework not available");
608 SDL_HIDAPIDriverHintChanged,
NULL);
609 HIDAPI_InitializeDiscovery();
610 HIDAPI_JoystickDetect();
628 device->joysticks = joysticks;
629 device->joysticks[
device->num_joysticks++] = joystickID;
630 ++SDL_HIDAPI_numjoysticks;
635 *pJoystickID = joystickID;
645 for (
i = 0;
i <
device->num_joysticks; ++
i) {
646 if (
device->joysticks[
i] == joystickID) {
656 --SDL_HIDAPI_numjoysticks;
657 if (
device->num_joysticks == 0) {
662 if (!shutting_down) {
671 HIDAPI_JoystickGetCount(
void)
673 return SDL_HIDAPI_numjoysticks;
677 HIDAPI_ConvertString(
const wchar_t *wide_string)
684 if (
sizeof(
wchar_t) ==
sizeof(
Uint16)) {
686 }
else if (
sizeof(
wchar_t) ==
sizeof(
Uint32)) {
700 for (curr = SDL_HIDAPI_devices, last =
NULL; curr; last = curr, curr = curr->
next) {
740 device->guid.data[14] =
'h';
741 device->guid.data[15] = 0;
748 char *product_string = HIDAPI_ConvertString(info->
product_string);
749 char *serial_number = HIDAPI_ConvertString(info->
serial_number);
758 name =
"Xbox 360 Controller";
761 name =
"Xbox One Controller";
764 name =
"PS3 Controller";
767 name =
"PS4 Controller";
770 name =
"PS5 Controller";
773 name =
"Nintendo Switch Pro Controller";
785 if (manufacturer_string) {
788 if (product_string) {
792 if (serial_number && *serial_number) {
793 device->serial = serial_number;
810 SDL_HIDAPI_devices =
device;
813 HIDAPI_SetupDeviceDriver(
device);
816 SDL_Log(
"Added HIDAPI device '%s' VID 0x%.4x, PID 0x%.4x, version %d, serial %s, interface %d, interface_class %d, interface_subclass %d, interface_protocol %d, usage page 0x%.4x, usage 0x%.4x, path = %s, driver = %s (%s)\n",
device->name,
device->vendor_id,
device->product_id,
device->version,
device->serial ?
device->serial :
"NONE",
device->interface_number,
device->interface_class,
device->interface_subclass,
device->interface_protocol,
device->usage_page,
device->usage,
device->path,
device->driver ?
device->driver->hint :
"NONE",
device->driver &&
device->driver->enabled ?
"ENABLED" :
"DISABLED");
827 SDL_Log(
"Removing HIDAPI device '%s' VID 0x%.4x, PID 0x%.4x, version %d, serial %s, interface %d, interface_class %d, interface_subclass %d, interface_protocol %d, usage page 0x%.4x, usage 0x%.4x, path = %s, driver = %s (%s)\n",
device->name,
device->vendor_id,
device->product_id,
device->version,
device->serial ?
device->serial :
"NONE",
device->interface_number,
device->interface_class,
device->interface_subclass,
device->interface_protocol,
device->usage_page,
device->usage,
device->path,
device->driver ?
device->driver->hint :
"NONE",
device->driver &&
device->driver->enabled ?
"ENABLED" :
"DISABLED");
830 for (curr = SDL_HIDAPI_devices, last =
NULL; curr; last = curr, curr = curr->
next) {
833 last->
next = curr->next;
835 SDL_HIDAPI_devices = curr->
next;
838 HIDAPI_CleanupDeviceDriver(
device);
856 HIDAPI_UpdateDeviceList(
void)
864 device = SDL_HIDAPI_devices;
871 if (SDL_HIDAPI_numdrivers > 0) {
874 for (info = devs; info; info = info->
next) {
879 HIDAPI_AddDevice(info);
887 device = SDL_HIDAPI_devices;
938 if (HIDAPI_JoystickInit() < 0) {
949 #if defined(SDL_JOYSTICK_HIDAPI_XBOX360) || defined(SDL_JOYSTICK_HIDAPI_XBOXONE)
957 HIDAPI_UpdateDeviceList();
967 device = SDL_HIDAPI_devices;
984 HIDAPI_JoystickDetect(
void)
987 HIDAPI_UpdateDiscovery();
988 if (SDL_HIDAPI_discovery.m_bHaveDevicesChanged) {
990 HIDAPI_UpdateDeviceList();
991 SDL_HIDAPI_discovery.m_bHaveDevicesChanged =
SDL_FALSE;
1006 device = SDL_HIDAPI_devices;
1023 HIDAPI_JoystickGetDeviceName(
int device_index)
1028 device = HIDAPI_GetDeviceByIndex(device_index,
NULL);
1038 HIDAPI_JoystickGetDevicePlayerIndex(
int device_index)
1042 int player_index = -1;
1044 device = HIDAPI_GetDeviceByIndex(device_index, &instance_id);
1046 player_index =
device->driver->GetDevicePlayerIndex(
device, instance_id);
1049 return player_index;
1053 HIDAPI_JoystickSetDevicePlayerIndex(
int device_index,
int player_index)
1058 device = HIDAPI_GetDeviceByIndex(device_index, &instance_id);
1060 device->driver->SetDevicePlayerIndex(
device, instance_id, player_index);
1065 HIDAPI_JoystickGetDeviceGUID(
int device_index)
1070 device = HIDAPI_GetDeviceByIndex(device_index,
NULL);
1081 HIDAPI_JoystickGetDeviceInstanceID(
int device_index)
1084 HIDAPI_GetDeviceByIndex(device_index, &joystickID);
1089 HIDAPI_JoystickOpen(SDL_Joystick *
joystick,
int device_index)
1115 HIDAPI_JoystickRumble(SDL_Joystick *
joystick,
Uint16 low_frequency_rumble,
Uint16 high_frequency_rumble)
1132 HIDAPI_JoystickRumbleTriggers(SDL_Joystick *
joystick,
Uint16 left_rumble,
Uint16 right_rumble)
1149 HIDAPI_JoystickHasLED(SDL_Joystick *
joystick)
1189 SDL_SetError(
"SetSensorsEnabled failed, device disconnected");
1197 HIDAPI_JoystickUpdate(SDL_Joystick *
joystick)
1203 HIDAPI_JoystickClose(SDL_Joystick *
joystick)
1214 for (
i = 0;
i < 3; ++
i) {
1232 HIDAPI_JoystickQuit(
void)
1238 HIDAPI_ShutdownDiscovery();
1240 SDL_HIDAPI_QuitRumble();
1242 while (SDL_HIDAPI_devices) {
1243 HIDAPI_DelDevice(SDL_HIDAPI_devices);
1254 SDL_HIDAPIDriverHintChanged,
NULL);
1270 HIDAPI_JoystickInit,
1271 HIDAPI_JoystickGetCount,
1272 HIDAPI_JoystickDetect,
1273 HIDAPI_JoystickGetDeviceName,
1274 HIDAPI_JoystickGetDevicePlayerIndex,
1275 HIDAPI_JoystickSetDevicePlayerIndex,
1276 HIDAPI_JoystickGetDeviceGUID,
1277 HIDAPI_JoystickGetDeviceInstanceID,
1278 HIDAPI_JoystickOpen,
1279 HIDAPI_JoystickRumble,
1280 HIDAPI_JoystickRumbleTriggers,
1281 HIDAPI_JoystickHasLED,
1282 HIDAPI_JoystickSetLED,
1283 HIDAPI_JoystickSetSensorsEnabled,
1284 HIDAPI_JoystickUpdate,
1285 HIDAPI_JoystickClose,
1286 HIDAPI_JoystickQuit,
1287 HIDAPI_JoystickGetGamepadMapping
#define SDL_assert(condition)
#define SDL_LockJoysticks
#define SDL_DelHintCallback
#define SDL_AtomicTryLock
#define SDL_JoystickFromInstanceID
#define SDL_UnlockJoysticks
#define SDL_GetHintBoolean
#define SDL_AddHintCallback
#define SDL_OutOfMemory()
@ SDL_CONTROLLER_TYPE_XBOX360
@ SDL_CONTROLLER_TYPE_PS4
@ SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO
@ SDL_CONTROLLER_TYPE_PS3
@ SDL_CONTROLLER_TYPE_PS5
@ SDL_CONTROLLER_TYPE_XBOXONE
#define USB_PACKET_LENGTH
SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverPS4
SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverSteam
void HIDAPI_UpdateDevices(void)
void HIDAPI_DumpPacket(const char *prefix, Uint8 *data, int size)
SDL_bool HIDAPI_JoystickConnected(SDL_HIDAPI_Device *device, SDL_JoystickID *pJoystickID)
void HIDAPI_JoystickDisconnected(SDL_HIDAPI_Device *device, SDL_JoystickID joystickID)
SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverGameCube
SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverXbox360
SDL_bool HIDAPI_IsDevicePresent(Uint16 vendor_id, Uint16 product_id, Uint16 version, const char *name)
SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverXboxOne
SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverSwitch
SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverPS5
SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverXbox360W
SDL_bool SDL_GetStringBoolean(const char *value, SDL_bool default_value)
#define SDL_HINT_JOYSTICK_HIDAPI
A variable controlling whether the HIDAPI joystick drivers should be used.
void SDL_PrivateJoystickRemoved(SDL_JoystickID device_instance)
SDL_bool SDL_ShouldIgnoreJoystick(const char *name, SDL_JoystickGUID guid)
void SDL_PrivateJoystickAdded(SDL_JoystickID device_instance)
SDL_GameControllerType SDL_GetJoystickGameControllerType(const char *name, Uint16 vendor, Uint16 product, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
SDL_JoystickID SDL_GetNextJoystickInstanceID()
char * SDL_CreateJoystickName(Uint16 vendor, Uint16 product, const char *vendor_name, const char *product_name)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLuint GLuint GLsizei GLenum type
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLuint GLsizei const GLchar * message
GLuint const GLchar * name
GLsizei const GLchar *const * path
GLuint GLsizei GLsizei * length
GLsizei const GLchar *const * string
#define SDL_arraysize(array)
#define SDL_HARDWARE_BUS_USB
SDL_JoystickDriver SDL_HIDAPI_JoystickDriver
unsigned long SDL_threadID
Uint32 SDL_GetTicks(void)
Get the number of milliseconds since the SDL library initialization.
#define SDL_TICKS_PASSED(A, B)
Compare SDL ticks values, and return true if A has passed B.
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
struct hid_device_info HID_API_EXPORT *HID_API_CALL hid_enumerate(unsigned short vendor_id, unsigned short product_id)
Enumerate the HID Devices.
int HID_API_EXPORT HID_API_CALL hid_init(void)
Initialize the HIDAPI library.
int HID_API_EXPORT HID_API_CALL hid_exit(void)
Finalize the HIDAPI library.
void HID_API_EXPORT HID_API_CALL hid_free_enumeration(struct hid_device_info *devs)
Free an enumeration Linked List.
static SDL_AudioDeviceID device
SDL_bool(* IsSupportedDevice)(const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
struct _SDL_HIDAPI_Device * next
unsigned short product_id
struct hid_device_info * next
wchar_t * manufacturer_string
unsigned short release_number
unsigned short usage_page
static SDL_Joystick * joystick
#define USB_VENDOR_MICROSOFT
#define USB_PRODUCT_XBOX_ONE_XINPUT_CONTROLLER
#define USB_PRODUCT_XBOX_ONE_RAW_INPUT_CONTROLLER
static screen_context_t context