mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-21 17:21:44 +00:00
Fix uses of undefined macro identifiers (-Wundef)
* Fix -Wundef warnings due to use of unguarded SDL_LOADSO_DISABLED
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_WINDOWS
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_ANDROID
* Fix -Wundef warnings due to use of unguarded SDL_LOADSO_DUMMY
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_COCOA
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_UIKIT
* Fix -Wundef warnings due to use of unguarded SDL_TIMERS_DISABLED
* Fix -Wundef warnings due to use of unguarded SDL_EVENTS_DISABLED
* Fix -Wundef warnings due to use of unguarded SDL_TIMER_DUMMY
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DISABLED
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DISABLED
* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_DISABLED
* Fix -Wundef warnings due to use of unguarded SDL_HAPTIC_DISABLED
* Fix -Wundef warnings due to use of unguarded SDL_SENSOR_DISABLED
* Fix -Wundef warnings due to use of unguarded __ANDROID__
* Fix -Wundef warnings due to use of unguarded __IOS__
* Fix -Wundef warnings due to use of unguarded EMULATE_CAS
* Fix -Wundef warnings due to use of unguarded SDL_ATOMIC_DISABLED
* Fix -Wundef warnings due to use of unguarded SDL_THREADS_DISABLED
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_SNDIO
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_NETBSD
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_WASAPI
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_DSOUND
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_HAIKU
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_COREAUDIO
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_AAUDIO
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_OPENSLES
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_ANDROID
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_PS2
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_PSP
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_VITA
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_N3DS
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_EMSCRIPTEN
* Fix -Wundef warnings due to use of unguarded SDL_NEON_INTRINSICS
* Fix -Wundef warnings due to use of unguarded SDL_ALTIVEC_BLITTERS
* Fix -Wundef warnings due to use of unguarded __VITA__
* Fix -Wundef warnings due to use of unguarded __3DS__
* Fix -Wundef warnings due to use of unguarded SDL_DYNAPI_PROC_NO_VARARGS
* Fix -Wundef warnings due to use of unguarded __APPLE__
* Fix -Wundef warnings due to use of unguarded __WINRT__
* Fix -Wundef warnings due to use of unguarded SDL_HIDAPI_DISABLED
* Fix -Wundef warnings due to use of unguarded __TVOS__
* Fix -Wundef warnings due to use of unguarded HAVE_DRIVER_BACKEND
* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_XINPUT
* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_WGI
* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_DINPUT
* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_MFI
* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_EMSCRIPTEN
* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_PS2
* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_PSP
* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_VITA
* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_N3DS
* Fix -Wundef warnings due to use of unguarded __MACOS__
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_D3D
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_WINRT
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_RPI
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_VITA_PVR_OGL
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_VIVANTE
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_D3D11
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_D3D12
* Fix -Wundef warnings due to use of unguarded SDL_RENDER_DISABLED
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_METAL
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_PS2
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_PSP
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_VITA_GXM
* Fix -Wundef warnings due to use of unguarded SDL_ARM_SIMD_BLITTERS
* Fix -Wundef warnings due to use of unguarded SDL_ARM_NEON_BLITTERS
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_HAIKU
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_PS2
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_PSP
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_VITA
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_N3DS
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_KMSDRM
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_RISCOS
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_EMSCRIPTEN
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_NGAGE
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_METAL
* Fix -Wundef warnings due to use of unguarded SDL_LSX_INTRINSICS
* Fix -Wundef warnings due to use of unguarded HAVE_PTHREAD_NP_H
* Fix -Wundef warnings due to use of unguarded __RISCOS__
* Fix -Wundef warnings due to use of unguarded FAKE_RECURSIVE_MUTEX
* Fix -Wundef warnings due to use of unguarded USE_POSIX_SPAWN
* textureData is only needed when SDL is built with YUV support
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_ALSA
* Fix -Wundef warnings due to use of unguarded SDL_SSE3_INTRINSICS
* Fix -Wundef warnings due to use of unguarded SDL_SSE4_2_INTRINSICS
* Fix -Wundef warnings due to use of unguarded SDL_SSE4_1_INTRINSICS
* Fix -Wundef warnings due to use of unguarded SDL_AVX512F_INTRINSICS
* Fix -Wundef warnings due to use of unguarded SDL_SSE2_INTRINSICS
* Fix -Wundef warnings due to use of unguarded SDL_AVX_INTRINSICS
* Fix -Wundef warnings due to use of unguarded SDL_AVX2_INTRINSICS
* Fix -Wundef warnings due to use of unguarded SDL_SSE_INTRINSICS
* Fix -Wundef warnings due to use of unguarded SDL_MMX_INTRINSICS
* Fix -Wundef warnings due to use of unguarded HAVE_CLOCK_GETTIME
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_DISK
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_DUMMY
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_DUMMY
* Fix -Wundef warnings due to use of unguarded HAVE_GCC_ATOMICS
* Fix -Wundef warnings due to use of unguarded HAVE_GCC_SYNC_LOCK_TEST_AND_SET
* Fix -Wundef warnings due to use of unguarded SDL_USE_LIBDBUS
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_JACK
* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_VIRTUAL
* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_LINUX
* Fix -Wundef warnings due to use of unguarded HAVE_LIBC
* Fix -Wundef warnings due to disabling SDL_LIBC
* Fix -Wundef warnings due to use of unguarded HAVE_PLATFORM_BACKEND
* Fix -Wundef warnings due to use of unguarded DEBUG
* Fix -Wundef warnings due to use of unguarded HAVE_LINUX_INPUT_H
* Fix -Werror=unused-variable when building with SDL_LIBC=OFF
* Fix -Wundef warnings due to use of unguqrded SDL_USE_LIBUDEV
* Use SDL alloc functions in libusb/hid.c
* Fix -Wundef warnings due to use of unguarded HAVE_LIBUDEV_H
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_VULKAN
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_OFFSCREEN
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_OGL
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_GLX
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_ES
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_ES2
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_RENDER_OGL_ES2
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_OSS
* Remove SDL_AUDIO_DRIVER_SUNAUDIO reference since it is never set
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_PIPEWIRE
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_PULSEAUDIO
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_XCURSOR
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_XDBE
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_XFIXES
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_XINPUT2
* Fix -Wundef warnings due to use of unguarded #if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH
* Fix -Wundef warnings due to use of unguarded #if SDL_VIDEO_DRIVER_X11_XRANDR
* Fix -Wundef warnings due to use of unguarded #if SDL_VIDEO_DRIVER_X11_XSCRNSAVER
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_XSHAPE
* Don't call XShape functions when XShape is diabled
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_WAYLAND
* Fix -Wundef warnings due to use of unuarded SDL_VIDEO_DRIVER_X11
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_RISCOS
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_EGL
* Disable array when compiled with SDL_EVENTS=OFF
* Fix -Wundef warnings due to use of unguarded SDL_INPUT_LINUXEV
* Fix -Wundef warnings due to use of unguarded SDL_THREAD_PTHREAD
* Fix -Wundef warnings due to use of unguarded SDL_THREAD_WINDOWS
* Fix -Wundef warnings due to use of unguarded SDL_THREAD_PS2
* Fix -Wundef warnings due to use of unguarded SDL_THREAD_PSP
* Fix -Wundef warnings due to use of unguarded SDL_THREAD_VITA
* Fix -Wundef warnings due to use of unguarded SDL_THREAD_N3DS
* Fix -Wundef warnings due to use of unguarded SDL_THREAD_STDCPP
* Fix -Wundef warnings due to use of unguarded SDL_THREAD_NGAGE
* Fix -Wundef warnings due to use of unguarded __WINDOWS__
* Fix -Wundef warnings due to use of unguarded __WINGDK__
* Fix -Wundef warnings due to use of unguarded __ANDROID__
* Fix -Wundef warnings due to use of unguarded SDL_THREAD_GENERIC_COND_SUFFIX
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_VITA_PIB
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_VITA_PVR
* Fix -Wundef warnings due to use of unguarded SDL_FILE_DISABLED
* Fix -Wundef warnings due to use of unguarded __XBOXONE__
* Fix -Wundef warnings due to use of unguarded __XBOXSERIES__
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_WGL
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_QNX
* Fix -Wundef warnings due to use of unguarded SDL_AUDIO_DRIVER_DISK
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_QNX
* Fix -Wundef warnings due to use of unguarded DEBUG_RAZOR
* Fix -Wundef warnings due to use of unguarded WINAPI_FAMILY_PHONE_APP
* Fix -Wundef warnings due to use of unguarded SDL_MAC_NO_SANDBOX
* Fix -Wundef warnings due to use of unguarded __(IPHONE|APPLETV|MAC)_OS_VERSION_MAX_ALLOWED
* Fix C4090 warning ('function': different 'const' qualifiers)
* ci: use -isystem for include dirs of pspdev toolchain
* cmake: add -Wundef option
* Fix remaining -Wundef warnings due to use of unguarded SDL_VIDEO_VULKAN and SDL_VIDEO_METAL
* Fix -Wundef warnings due to use of unguarded __MACOS__
* DEBUG_CONVERT is guaranteed to be defined in src/audio/SDL_audiocvt.c
* Fix -Wundef warnings due to use of unguarded HAVE_NANOSLEEP
* Fix -Wundef warnings due to use of unguarded HAVE_DXGI_H
* Fix -Wundef warnings due to use of unguarded HAVE_LINUX_INPUT_H
* fix SDL_VIDEO_DRIVER_WAYLAND
* fix SDL_VIDEO_DRIVER_X11
* Fix -Wundef warnings due to use of unguarded HAVE_MMDEVICEAPI_H
* Fix -Wundef warnings due to use of unguarded HAVE_PTHREAD_SETNAME_NP
* Fix -Wundef warnings due to use of unguarded HAVE_PTHREAD_SET_NAME_NP
* Fix -Wundef warnings due to use of unguarded HAVE_SETJMP
* Fix -Wundef warnings due to use of unguarded HAVE_SIGNAL_H
* Fix -Wundef warnings due to use of unguarded HAVE_TPCSHRD_H
* Fix -Wundef warnings due to use of unguarded MACOSX_COREAUDIO
* Fix -Wundef warnings due to use of unguarded SDL_HAPTIC_DINPUT
* Fix -Wundef warnings due to use of unguarded SDL_HAPTIC_IOKIT
* Fix -Wundef warnings due to use of unguarded SDL_HAPTIC_XINPUT
* Fix -Wundef warnings due to use of unguarded SDL_IPHONE_KEYBOARD
* Fix -Wundef warnings due to use of unguarded SDL_JOYSTICK_RAWINPUT
* Fix -Wundef warnings due to use of unguarded SDL_POWER_ANDROID
* Fix -Wundef warnings due to use of unguarded SDL_POWER_EMSCRIPTEN
* Fix -Wundef warnings due to use of unguarded SDL_POWER_HAIKU
* Fix -Wundef warnings due to use of unguarded SDL_POWER_LINUX
* Fix -Wundef warnings due to use of unguarded SDL_POWER_MACOSX
* Fix -Wundef warnings due to use of unguarded SDL_POWER_PSP
* Fix -Wundef warnings due to use of unguarded SDL_POWER_UIKIT
* Fix -Wundef warnings due to use of unguarded SDL_POWER_VITA
* Fix -Wundef warnings due to use of unguarded SDL_POWER_WINDOWS
* Fix -Wundef warnings due to use of unguarded SDL_THREAD_PTHREAD_RECURSIVE_MUTEX
* Fix -Wundef warnings due to use of unguarded SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_VIVANTE_VDK
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_WAYLAND
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_CGL
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_EGL
* Fix -Wundef warnings due to use of unguarded __MACOS__
* Fix -Wundef warnings due to use of unguarded __OpenBSD__
* Fix -Wundef warnings due to use of unguarded __FreeBSD__
* Fix -Wundef warnings due to use of unguarded __MWERKS__
* Fix -Wundef warnings due to use of unguarded __WIN32__
* Fix -Wundef warnings due to use of unguarded SDL_IPHONE_LAUNCHSCREEN
* Fix -Wundef warnings due to use of unguarded SDL_VIDEO_OPENGL_ES2
* Remove unused HAVE_CONST, HAVE_INLINE and HAVE_VOLATILE
* Revert "Use SDL alloc functions in libusb/hid.c"
This reverts commit 847c64b00d
.
* Handle FAKE_RECURSIVE_MUTEX in similar way as SDL2
* Don't use defined in macro
This commit is contained in:

committed by
GitHub

parent
c3d3c2c672
commit
3472dc11d6
@@ -31,7 +31,7 @@
|
||||
|
||||
#include "SDL_hidapi_c.h"
|
||||
|
||||
#if !SDL_HIDAPI_DISABLED
|
||||
#ifndef SDL_HIDAPI_DISABLED
|
||||
|
||||
#if defined(__WIN32__) || defined(__WINGDK__)
|
||||
#include "../core/windows/SDL_windows.h"
|
||||
@@ -557,9 +557,9 @@ HIDAPI_ShutdownDiscovery()
|
||||
#define read_thread PLATFORM_read_thread
|
||||
|
||||
#undef HIDAPI_H__
|
||||
#if __LINUX__
|
||||
#ifdef __LINUX__
|
||||
|
||||
#if SDL_USE_LIBUDEV
|
||||
#ifdef SDL_USE_LIBUDEV
|
||||
static const SDL_UDEV_Symbols *udev_ctx = NULL;
|
||||
|
||||
#define udev_device_get_sysattr_value udev_ctx->udev_device_get_sysattr_value
|
||||
@@ -582,20 +582,20 @@ static const SDL_UDEV_Symbols *udev_ctx = NULL;
|
||||
#define HAVE_PLATFORM_BACKEND 1
|
||||
#endif /* SDL_USE_LIBUDEV */
|
||||
|
||||
#elif __MACOS__
|
||||
#elif defined(__MACOS__)
|
||||
#include "mac/hid.c"
|
||||
#define HAVE_PLATFORM_BACKEND 1
|
||||
#define udev_ctx 1
|
||||
#elif __WINDOWS__ || __WINGDK__
|
||||
#elif defined(__WINDOWS__) || defined(__WINGDK__)
|
||||
#include "windows/hid.c"
|
||||
#define HAVE_PLATFORM_BACKEND 1
|
||||
#define udev_ctx 1
|
||||
#elif __ANDROID__
|
||||
#elif defined(__ANDROID__)
|
||||
/* The implementation for Android is in a separate .cpp file */
|
||||
#include "hidapi/hidapi.h"
|
||||
#define HAVE_PLATFORM_BACKEND 1
|
||||
#define udev_ctx 1
|
||||
#elif __IOS__ || __TVOS__
|
||||
#elif defined(__IOS__) || defined(__TVOS__)
|
||||
/* The implementation for iOS and tvOS is in a separate .m file */
|
||||
#include "hidapi/hidapi.h"
|
||||
#define HAVE_PLATFORM_BACKEND 1
|
||||
@@ -899,7 +899,7 @@ struct hidapi_backend
|
||||
const wchar_t *(*hid_error)(void *device);
|
||||
};
|
||||
|
||||
#if HAVE_PLATFORM_BACKEND
|
||||
#ifdef HAVE_PLATFORM_BACKEND
|
||||
static const struct hidapi_backend PLATFORM_Backend = {
|
||||
(void *)PLATFORM_hid_write,
|
||||
(void *)PLATFORM_hid_read_timeout,
|
||||
@@ -916,7 +916,7 @@ static const struct hidapi_backend PLATFORM_Backend = {
|
||||
};
|
||||
#endif /* HAVE_PLATFORM_BACKEND */
|
||||
|
||||
#if HAVE_DRIVER_BACKEND
|
||||
#ifdef HAVE_DRIVER_BACKEND
|
||||
static const struct hidapi_backend DRIVER_Backend = {
|
||||
(void *)DRIVER_hid_write,
|
||||
(void *)DRIVER_hid_read_timeout,
|
||||
@@ -958,7 +958,7 @@ struct SDL_hid_device_
|
||||
};
|
||||
static char device_magic;
|
||||
|
||||
#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
|
||||
#if defined(HAVE_PLATFORM_BACKEND) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB)
|
||||
|
||||
static SDL_hid_device *
|
||||
CreateHIDDeviceWrapper(void *device, const struct hidapi_backend *backend)
|
||||
@@ -985,8 +985,8 @@ DeleteHIDDeviceWrapper(SDL_hid_device *device)
|
||||
return retval; \
|
||||
}
|
||||
|
||||
#if !SDL_HIDAPI_DISABLED
|
||||
#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
|
||||
#ifndef SDL_HIDAPI_DISABLED
|
||||
#if defined(HAVE_PLATFORM_BACKEND) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB)
|
||||
|
||||
#define COPY_IF_EXISTS(var) \
|
||||
if (pSrc->var != NULL) { \
|
||||
@@ -1134,9 +1134,9 @@ int SDL_hid_init(void)
|
||||
}
|
||||
#endif /* HAVE_LIBUSB */
|
||||
|
||||
#if HAVE_PLATFORM_BACKEND
|
||||
#ifdef HAVE_PLATFORM_BACKEND
|
||||
++attempts;
|
||||
#if __LINUX__
|
||||
#ifdef __LINUX__
|
||||
udev_ctx = SDL_UDEV_GetUdevSyms();
|
||||
#endif /* __LINUX __ */
|
||||
if (udev_ctx && PLATFORM_hid_init() == 0) {
|
||||
@@ -1165,15 +1165,15 @@ int SDL_hid_exit(void)
|
||||
}
|
||||
SDL_hidapi_refcount = 0;
|
||||
|
||||
#if !SDL_HIDAPI_DISABLED
|
||||
#ifndef SDL_HIDAPI_DISABLED
|
||||
HIDAPI_ShutdownDiscovery();
|
||||
#endif
|
||||
|
||||
#if HAVE_PLATFORM_BACKEND
|
||||
#ifdef HAVE_PLATFORM_BACKEND
|
||||
if (udev_ctx) {
|
||||
result |= PLATFORM_hid_exit();
|
||||
}
|
||||
#if __LINUX__
|
||||
#ifdef __LINUX__
|
||||
SDL_UDEV_ReleaseUdevSyms();
|
||||
#endif /* __LINUX __ */
|
||||
#endif /* HAVE_PLATFORM_BACKEND */
|
||||
@@ -1195,7 +1195,7 @@ Uint32 SDL_hid_device_change_count(void)
|
||||
{
|
||||
Uint32 counter = 0;
|
||||
|
||||
#if !SDL_HIDAPI_DISABLED
|
||||
#ifndef SDL_HIDAPI_DISABLED
|
||||
if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 0) {
|
||||
return 0;
|
||||
}
|
||||
@@ -1215,16 +1215,16 @@ Uint32 SDL_hid_device_change_count(void)
|
||||
|
||||
struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned short product_id)
|
||||
{
|
||||
#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
|
||||
#if defined(HAVE_PLATFORM_BACKEND) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB)
|
||||
#ifdef HAVE_LIBUSB
|
||||
struct SDL_hid_device_info *usb_devs = NULL;
|
||||
struct SDL_hid_device_info *usb_dev;
|
||||
#endif
|
||||
#if HAVE_DRIVER_BACKEND
|
||||
#ifdef HAVE_DRIVER_BACKEND
|
||||
struct SDL_hid_device_info *driver_devs = NULL;
|
||||
struct SDL_hid_device_info *driver_dev;
|
||||
#endif
|
||||
#if HAVE_PLATFORM_BACKEND
|
||||
#ifdef HAVE_PLATFORM_BACKEND
|
||||
struct SDL_hid_device_info *raw_devs = NULL;
|
||||
struct SDL_hid_device_info *raw_dev;
|
||||
#endif
|
||||
@@ -1280,7 +1280,7 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned
|
||||
}
|
||||
#endif /* HAVE_DRIVER_BACKEND */
|
||||
|
||||
#if HAVE_PLATFORM_BACKEND
|
||||
#ifdef HAVE_PLATFORM_BACKEND
|
||||
if (udev_ctx) {
|
||||
raw_devs = PLATFORM_hid_enumerate(vendor_id, product_id);
|
||||
#ifdef DEBUG_HIDAPI
|
||||
@@ -1368,14 +1368,14 @@ void SDL_hid_free_enumeration(struct SDL_hid_device_info *devs)
|
||||
|
||||
SDL_hid_device *SDL_hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number)
|
||||
{
|
||||
#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
|
||||
#if defined(HAVE_PLATFORM_BACKEND) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB)
|
||||
void *pDevice = NULL;
|
||||
|
||||
if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if HAVE_PLATFORM_BACKEND
|
||||
#if defined(HAVE_PLATFORM_BACKEND)
|
||||
if (udev_ctx) {
|
||||
pDevice = PLATFORM_hid_open(vendor_id, product_id, serial_number);
|
||||
if (pDevice != NULL) {
|
||||
@@ -1384,7 +1384,7 @@ SDL_hid_device *SDL_hid_open(unsigned short vendor_id, unsigned short product_id
|
||||
}
|
||||
#endif /* HAVE_PLATFORM_BACKEND */
|
||||
|
||||
#if HAVE_DRIVER_BACKEND
|
||||
#ifdef HAVE_DRIVER_BACKEND
|
||||
pDevice = DRIVER_hid_open(vendor_id, product_id, serial_number);
|
||||
if (pDevice != NULL) {
|
||||
return CreateHIDDeviceWrapper(pDevice, &DRIVER_Backend);
|
||||
@@ -1407,14 +1407,14 @@ SDL_hid_device *SDL_hid_open(unsigned short vendor_id, unsigned short product_id
|
||||
|
||||
SDL_hid_device *SDL_hid_open_path(const char *path, int bExclusive /* = false */)
|
||||
{
|
||||
#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB)
|
||||
#if defined(HAVE_PLATFORM_BACKEND) || defined(HAVE_DRIVER_BACKEND) || defined(HAVE_LIBUSB)
|
||||
void *pDevice = NULL;
|
||||
|
||||
if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if HAVE_PLATFORM_BACKEND
|
||||
#if defined(HAVE_PLATFORM_BACKEND)
|
||||
if (udev_ctx) {
|
||||
pDevice = PLATFORM_hid_open_path(path, bExclusive);
|
||||
if (pDevice != NULL) {
|
||||
@@ -1423,7 +1423,7 @@ SDL_hid_device *SDL_hid_open_path(const char *path, int bExclusive /* = false */
|
||||
}
|
||||
#endif /* HAVE_PLATFORM_BACKEND */
|
||||
|
||||
#if HAVE_DRIVER_BACKEND
|
||||
#ifdef HAVE_DRIVER_BACKEND
|
||||
pDevice = DRIVER_hid_open_path(path, bExclusive);
|
||||
if (pDevice != NULL) {
|
||||
return CreateHIDDeviceWrapper(pDevice, &DRIVER_Backend);
|
||||
@@ -1585,7 +1585,7 @@ int SDL_hid_get_indexed_string(SDL_hid_device *device, int string_index, wchar_t
|
||||
|
||||
void SDL_hid_ble_scan(SDL_bool active)
|
||||
{
|
||||
#if !SDL_HIDAPI_DISABLED && (__IOS__ || __TVOS__)
|
||||
#if !defined(SDL_HIDAPI_DISABLED) && (defined(__IOS__) || defined(__TVOS__))
|
||||
hid_ble_scan(active);
|
||||
#endif
|
||||
}
|
||||
|
@@ -49,7 +49,7 @@
|
||||
#define HID_DEVICE_MANAGER_JAVA_INTERFACE(function) CONCAT1(SDL_JAVA_PREFIX, HIDDeviceManager, function)
|
||||
|
||||
|
||||
#if !SDL_HIDAPI_DISABLED
|
||||
#ifndef SDL_HIDAPI_DISABLED
|
||||
|
||||
#include "../../core/android/SDL_android.h"
|
||||
|
||||
@@ -744,7 +744,7 @@ public:
|
||||
env->CallVoidMethod( g_HIDDeviceManagerCallbackHandler, g_midHIDDeviceManagerClose, m_nId );
|
||||
ExceptionCheck( env, "Close" );
|
||||
}
|
||||
|
||||
|
||||
hid_mutex_guard dataLock( &m_dataLock );
|
||||
m_vecData.clear();
|
||||
|
||||
@@ -1139,7 +1139,7 @@ HID_API_EXPORT hid_device * HID_API_CALL hid_open_path(const char *path, int bEx
|
||||
hid_mutex_guard l( &g_DevicesMutex );
|
||||
for ( hid_device_ref<CHIDDevice> pCurr = g_Devices; pCurr; pCurr = pCurr->next )
|
||||
{
|
||||
if ( SDL_strcmp( pCurr->GetDeviceInfo()->path, path ) == 0 )
|
||||
if ( SDL_strcmp( pCurr->GetDeviceInfo()->path, path ) == 0 )
|
||||
{
|
||||
hid_device *pValue = pCurr->GetDevice();
|
||||
if ( pValue )
|
||||
|
@@ -406,7 +406,7 @@ namespace NAMESPACE {
|
||||
*/
|
||||
HID_API_EXPORT const wchar_t* HID_API_CALL hid_error(hid_device *dev);
|
||||
|
||||
#if __IOS__ || __TVOS__
|
||||
#if defined(__IOS__) || defined(__TVOS__)
|
||||
HID_API_EXPORT void HID_API_CALL hid_ble_scan(int active);
|
||||
#endif
|
||||
|
||||
|
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
#include "SDL_internal.h"
|
||||
|
||||
#if !SDL_HIDAPI_DISABLED
|
||||
#ifndef SDL_HIDAPI_DISABLED
|
||||
|
||||
|
||||
#define hid_init PLATFORM_hid_init
|
||||
@@ -130,7 +130,7 @@ static void RingBuffer_init( RingBuffer *this )
|
||||
this->_last = 0;
|
||||
pthread_mutex_init( &this->accessLock, 0 );
|
||||
}
|
||||
|
||||
|
||||
static bool RingBuffer_write( RingBuffer *this, const uint8_t *src )
|
||||
{
|
||||
pthread_mutex_lock( &this->accessLock );
|
||||
@@ -289,7 +289,7 @@ typedef enum
|
||||
{
|
||||
static uint64_t s_unLastUpdateTick = 0;
|
||||
static mach_timebase_info_data_t s_timebase_info;
|
||||
|
||||
|
||||
if ( self.centralManager == nil )
|
||||
{
|
||||
return 0;
|
||||
@@ -299,11 +299,11 @@ typedef enum
|
||||
{
|
||||
mach_timebase_info( &s_timebase_info );
|
||||
}
|
||||
|
||||
|
||||
uint64_t ticksNow = mach_approximate_time();
|
||||
if ( !bForce && ( ( (ticksNow - s_unLastUpdateTick) * s_timebase_info.numer ) / s_timebase_info.denom ) < (5ull * NSEC_PER_SEC) )
|
||||
return (int)self.deviceMap.count;
|
||||
|
||||
|
||||
// we can see previously connected BLE peripherals but can't connect until the CBCentralManager
|
||||
// is fully powered up - only do work when we are in that state
|
||||
if ( self.centralManager.state != CBManagerStatePoweredOn )
|
||||
@@ -311,7 +311,7 @@ typedef enum
|
||||
|
||||
// only update our last-check-time if we actually did work, otherwise there can be a long delay during initial power-up
|
||||
s_unLastUpdateTick = mach_approximate_time();
|
||||
|
||||
|
||||
// if a pair is in-flight, the central manager may still give it back via retrieveConnected... and
|
||||
// cause the SDL layer to attempt to initialize it while some of its endpoints haven't yet been established
|
||||
if ( self.nPendingPairs > 0 )
|
||||
@@ -323,7 +323,7 @@ typedef enum
|
||||
// we already know this peripheral
|
||||
if ( [self.deviceMap objectForKey: peripheral] != nil )
|
||||
continue;
|
||||
|
||||
|
||||
NSLog( @"connected peripheral: %@", peripheral );
|
||||
if ( [peripheral.name isEqualToString:@"SteamController"] )
|
||||
{
|
||||
@@ -391,7 +391,7 @@ typedef enum
|
||||
case CBCentralManagerStatePoweredOn:
|
||||
{
|
||||
NSLog( @"CoreBluetooth BLE hardware is powered on and ready" );
|
||||
|
||||
|
||||
// at startup, if we have no already attached peripherals, do a 20s scan for new unpaired devices,
|
||||
// otherwise callers should occaisionally do additional scans. we don't want to continuously be
|
||||
// scanning because it drains battery, causes other nearby people to have a hard time pairing their
|
||||
@@ -407,23 +407,23 @@ typedef enum
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case CBCentralManagerStatePoweredOff:
|
||||
NSLog( @"CoreBluetooth BLE hardware is powered off" );
|
||||
break;
|
||||
|
||||
|
||||
case CBCentralManagerStateUnauthorized:
|
||||
NSLog( @"CoreBluetooth BLE state is unauthorized" );
|
||||
break;
|
||||
|
||||
|
||||
case CBCentralManagerStateUnknown:
|
||||
NSLog( @"CoreBluetooth BLE state is unknown" );
|
||||
break;
|
||||
|
||||
|
||||
case CBCentralManagerStateUnsupported:
|
||||
NSLog( @"CoreBluetooth BLE hardware is unsupported on this platform" );
|
||||
break;
|
||||
|
||||
|
||||
case CBCentralManagerStateResetting:
|
||||
NSLog( @"CoreBluetooth BLE manager is resetting" );
|
||||
break;
|
||||
@@ -448,7 +448,7 @@ typedef enum
|
||||
{
|
||||
NSString *localName = [advertisementData objectForKey:CBAdvertisementDataLocalNameKey];
|
||||
NSString *log = [NSString stringWithFormat:@"Found '%@'", localName];
|
||||
|
||||
|
||||
if ( [localName isEqualToString:@"SteamController"] )
|
||||
{
|
||||
NSLog( @"%@ : %@ - %@", log, peripheral, advertisementData );
|
||||
@@ -551,7 +551,7 @@ static void process_pending_events()
|
||||
{
|
||||
#if FEATURE_REPORT_LOGGING
|
||||
uint8_t *reportBytes = (uint8_t *)report;
|
||||
|
||||
|
||||
NSLog( @"HIDBLE:send_feature_report (%02zu/19) [%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x]", GetBluetoothSegmentSize( report->segment ),
|
||||
reportBytes[1], reportBytes[2], reportBytes[3], reportBytes[4], reportBytes[5], reportBytes[6],
|
||||
reportBytes[7], reportBytes[8], reportBytes[9], reportBytes[10], reportBytes[11], reportBytes[12],
|
||||
@@ -567,7 +567,7 @@ static void process_pending_events()
|
||||
// fire-and-forget - we are going to not wait for the response here because all Steam Controller BLE send_feature_report's are ignored,
|
||||
// except errors.
|
||||
[_bleSteamController writeValue:[NSData dataWithBytes:&report->segment length:sendSize] forCharacteristic:_bleCharacteristicReport type:CBCharacteristicWriteWithResponse];
|
||||
|
||||
|
||||
// pretend we received a result anybody cares about
|
||||
return 19;
|
||||
|
||||
@@ -577,18 +577,18 @@ static void process_pending_events()
|
||||
_waitStateForWriteFeatureReport = BLEDeviceWaitState_Waiting;
|
||||
[_bleSteamController writeValue:[NSData dataWithBytes:&report->segment length:sendSize
|
||||
] forCharacteristic:_bleCharacteristicReport type:CBCharacteristicWriteWithResponse];
|
||||
|
||||
|
||||
while ( _waitStateForWriteFeatureReport == BLEDeviceWaitState_Waiting )
|
||||
{
|
||||
process_pending_events();
|
||||
}
|
||||
|
||||
|
||||
if ( _waitStateForWriteFeatureReport == BLEDeviceWaitState_Error )
|
||||
{
|
||||
_waitStateForWriteFeatureReport = BLEDeviceWaitState_None;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
_waitStateForWriteFeatureReport = BLEDeviceWaitState_None;
|
||||
return 19;
|
||||
#endif
|
||||
@@ -598,20 +598,20 @@ static void process_pending_events()
|
||||
{
|
||||
_waitStateForReadFeatureReport = BLEDeviceWaitState_Waiting;
|
||||
[_bleSteamController readValueForCharacteristic:_bleCharacteristicReport];
|
||||
|
||||
|
||||
while ( _waitStateForReadFeatureReport == BLEDeviceWaitState_Waiting )
|
||||
process_pending_events();
|
||||
|
||||
|
||||
if ( _waitStateForReadFeatureReport == BLEDeviceWaitState_Error )
|
||||
{
|
||||
_waitStateForReadFeatureReport = BLEDeviceWaitState_None;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
memcpy( buffer, _featureReport, sizeof(_featureReport) );
|
||||
|
||||
|
||||
_waitStateForReadFeatureReport = BLEDeviceWaitState_None;
|
||||
|
||||
|
||||
#if FEATURE_REPORT_LOGGING
|
||||
NSLog( @"HIDBLE:get_feature_report (19) [%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x]",
|
||||
buffer[1], buffer[2], buffer[3], buffer[4], buffer[5], buffer[6],
|
||||
@@ -656,7 +656,7 @@ static void process_pending_events()
|
||||
for (CBCharacteristic *aChar in service.characteristics)
|
||||
{
|
||||
NSLog( @"Found Characteristic %@", aChar );
|
||||
|
||||
|
||||
if ( [aChar.UUID isEqual:[CBUUID UUIDWithString:VALVE_INPUT_CHAR]] )
|
||||
{
|
||||
self.bleCharacteristicInput = aChar;
|
||||
@@ -703,7 +703,7 @@ static void process_pending_events()
|
||||
else if ( [characteristic.UUID isEqual:_bleCharacteristicReport.UUID] )
|
||||
{
|
||||
memset( _featureReport, 0, sizeof(_featureReport) );
|
||||
|
||||
|
||||
if ( error != nil )
|
||||
{
|
||||
NSLog( @"HIDBLE: get_feature_report error: %@", error );
|
||||
@@ -788,13 +788,13 @@ HID_API_EXPORT hid_device * HID_API_CALL hid_open_path( const char *path, int bE
|
||||
NSString *nssPath = [NSString stringWithUTF8String:path];
|
||||
HIDBLEManager *bleManager = HIDBLEManager.sharedInstance;
|
||||
NSEnumerator<HIDBLEDevice *> *devices = [bleManager.deviceMap objectEnumerator];
|
||||
|
||||
|
||||
for ( HIDBLEDevice *device in devices )
|
||||
{
|
||||
// we have the device but it hasn't found its service or characteristics until it is connected
|
||||
if ( !device.ready || !device.connected || !device.bleCharacteristicInput )
|
||||
continue;
|
||||
|
||||
|
||||
if ( [device.bleSteamController.identifier.UUIDString isEqualToString:nssPath] )
|
||||
{
|
||||
result = (hid_device *)malloc( sizeof( hid_device ) );
|
||||
@@ -828,7 +828,7 @@ int HID_API_EXPORT hid_set_nonblocking(hid_device *dev, int nonblock)
|
||||
{
|
||||
/* All Nonblocking operation is handled by the library. */
|
||||
dev->blocking = !nonblock;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -952,7 +952,7 @@ int HID_API_EXPORT hid_get_feature_report(hid_device *dev, unsigned char *data,
|
||||
return -1;
|
||||
|
||||
size_t written = [device_handle get_feature_report:data[0] into:data];
|
||||
|
||||
|
||||
return written == length-1 ? (int)length : (int)written;
|
||||
}
|
||||
|
||||
@@ -972,7 +972,7 @@ int HID_API_EXPORT hid_read_timeout(hid_device *dev, unsigned char *data, size_t
|
||||
|
||||
if ( !device_handle.connected )
|
||||
return -1;
|
||||
|
||||
|
||||
if ( milliseconds != 0 )
|
||||
{
|
||||
NSLog( @"hid_read_timeout with non-zero wait" );
|
||||
|
Reference in New Issue
Block a user