Added SDL_HIDAPI_DISABLED so it can be disabled like other SDL subsystems
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
diff --git a/include/SDL_config.h.cmake b/include/SDL_config.h.cmake
index 4e63379..0bf1421 100644
--- a/include/SDL_config.h.cmake
+++ b/include/SDL_config.h.cmake
@@ -266,6 +266,7 @@
#cmakedefine SDL_FILE_DISABLED @SDL_FILE_DISABLED@
#cmakedefine SDL_JOYSTICK_DISABLED @SDL_JOYSTICK_DISABLED@
#cmakedefine SDL_HAPTIC_DISABLED @SDL_HAPTIC_DISABLED@
+#cmakedefine SDL_HIDAPI_DISABLED @SDL_HIDAPI_DISABLED@
#cmakedefine SDL_SENSOR_DISABLED @SDL_SENSOR_DISABLED@
#cmakedefine SDL_LOADSO_DISABLED @SDL_LOADSO_DISABLED@
#cmakedefine SDL_RENDER_DISABLED @SDL_RENDER_DISABLED@
diff --git a/include/SDL_config.h.in b/include/SDL_config.h.in
index 51731b4..5c5cb29 100644
--- a/include/SDL_config.h.in
+++ b/include/SDL_config.h.in
@@ -253,6 +253,7 @@
#undef SDL_FILE_DISABLED
#undef SDL_JOYSTICK_DISABLED
#undef SDL_HAPTIC_DISABLED
+#undef SDL_HIDAPI_DISABLED
#undef SDL_SENSOR_DISABLED
#undef SDL_LOADSO_DISABLED
#undef SDL_RENDER_DISABLED
diff --git a/include/SDL_config_emscripten.h b/include/SDL_config_emscripten.h
index 5e624d3..a57e5c6 100644
--- a/include/SDL_config_emscripten.h
+++ b/include/SDL_config_emscripten.h
@@ -134,6 +134,7 @@
#define SDL_CPUINFO_DISABLED 1
#define SDL_HAPTIC_DISABLED 1
+#define SDL_HIDAPI_DISABLED 1
#ifndef __EMSCRIPTEN_PTHREADS__
#define SDL_THREADS_DISABLED 1
#endif
diff --git a/include/SDL_config_minimal.h b/include/SDL_config_minimal.h
index fe0ced8..8d9ce16 100644
--- a/include/SDL_config_minimal.h
+++ b/include/SDL_config_minimal.h
@@ -64,6 +64,9 @@ typedef unsigned long uintptr_t;
/* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
#define SDL_HAPTIC_DISABLED 1
+/* Enable the stub HIDAPI */
+#define SDL_HIDAPI_DISABLED 1
+
/* Enable the stub sensor driver (src/sensor/dummy/\*.c) */
#define SDL_SENSOR_DISABLED 1
diff --git a/include/SDL_config_os2.h b/include/SDL_config_os2.h
index 516ab6d..56025fe 100644
--- a/include/SDL_config_os2.h
+++ b/include/SDL_config_os2.h
@@ -33,14 +33,12 @@
#define SDL_POWER_DISABLED 1
#define SDL_HAPTIC_DISABLED 1
+#define SDL_HIDAPI_DISABLED 1
#define SDL_SENSOR_DUMMY 1
#define SDL_VIDEO_DRIVER_DUMMY 1
#define SDL_VIDEO_DRIVER_OS2 1
#define SDL_JOYSTICK_OS2 1
-#define SDL_DISABLE_HIDAPI 1
-/*#undef SDL_JOYSTICK_HIDAPI */
-/*#undef SDL_JOYSTICK_VIRTUAL */
/* Enable OpenGL support */
/* #undef SDL_VIDEO_OPENGL */
diff --git a/include/SDL_config_psp.h b/include/SDL_config_psp.h
index 53d4ca6..56d1ad6 100644
--- a/include/SDL_config_psp.h
+++ b/include/SDL_config_psp.h
@@ -158,6 +158,9 @@
/* PSP doesn't have haptic device (src/haptic/dummy/\*.c) */
#define SDL_HAPTIC_DISABLED 1
+/* PSP doesn't have HIDAPI available */
+#define SDL_HIDAPI_DISABLED 1
+
/* PSP can't load shared object (src/loadso/dummy/\*.c) */
#define SDL_LOADSO_DISABLED 1
diff --git a/include/SDL_config_winrt.h b/include/SDL_config_winrt.h
index c6d5c13..2f23baf 100644
--- a/include/SDL_config_winrt.h
+++ b/include/SDL_config_winrt.h
@@ -205,6 +205,9 @@ typedef unsigned int uintptr_t;
#define SDL_HAPTIC_XINPUT 1
#endif
+/* WinRT doesn't have HIDAPI available */
+#define SDL_HIDAPI_DISABLED 1
+
/* Enable the dummy sensor driver */
#define SDL_SENSOR_DUMMY 1
diff --git a/include/SDL_hidapi.h b/include/SDL_hidapi.h
index 374eb58..a440f98 100644
--- a/include/SDL_hidapi.h
+++ b/include/SDL_hidapi.h
@@ -55,8 +55,8 @@
POSSIBILITY OF SUCH DAMAGE.
*
* If you would like a version of SDL without this code, you can build SDL
- * with SDL_DISABLE_HIDAPI defined. You might want to do this for example on
- * iOS or tvOS to avoid a dependency on the CoreBluetooth framework.
+ * with SDL_HIDAPI_DISABLED defined to 1. You might want to do this for example
+ * on iOS or tvOS to avoid a dependency on the CoreBluetooth framework.
*/
#ifndef SDL_hidapi_h_
diff --git a/src/hidapi/SDL_hidapi.c b/src/hidapi/SDL_hidapi.c
index 70a53f2..c4466b8 100644
--- a/src/hidapi/SDL_hidapi.c
+++ b/src/hidapi/SDL_hidapi.c
@@ -33,7 +33,7 @@
#include "SDL_hidapi.h"
#include "SDL_hidapi_c.h"
-#ifndef SDL_DISABLE_HIDAPI
+#if !SDL_HIDAPI_DISABLED
/* Platform HIDAPI Implementation */
@@ -350,7 +350,7 @@ SDL_libusb_get_string_descriptor(libusb_device_handle *dev,
#endif /* SDL_LIBUSB_DYNAMIC */
-#endif /* !SDL_DISABLE_HIDAPI */
+#endif /* !SDL_HIDAPI_DISABLED */
/* Shared HIDAPI Implementation */
@@ -469,7 +469,7 @@ DeleteHIDDeviceWrapper(HIDDeviceWrapper *device)
return retval; \
}
-#ifndef SDL_DISABLE_HIDAPI
+#if !SDL_HIDAPI_DISABLED
#define COPY_IF_EXISTS(var) \
if (pSrc->var != NULL) { \
@@ -506,7 +506,7 @@ CopyHIDDeviceInfo(struct SDL_hid_device_info *pSrc, struct SDL_hid_device_info *
#undef COPY_IF_EXISTS
#undef WCOPY_IF_EXISTS
-#endif /* SDL_DISABLE_HIDAPI */
+#endif /* !SDL_HIDAPI_DISABLED */
static SDL_bool SDL_hidapi_wasinit = SDL_FALSE;
diff --git a/src/hidapi/android/hid.cpp b/src/hidapi/android/hid.cpp
index bed8867..9bfb1a7 100644
--- a/src/hidapi/android/hid.cpp
+++ b/src/hidapi/android/hid.cpp
@@ -22,7 +22,7 @@
//
// This layer glues the hidapi API to Android's USB and BLE stack.
-#ifndef SDL_DISABLE_HIDAPI
+#if !SDL_HIDAPI_DISABLED
#define hid_init PLATFORM_hid_init
#define hid_exit PLATFORM_hid_exit
@@ -1286,4 +1286,4 @@ int hid_exit(void)
}
-#endif /* SDL_DISABLE_HIDAPI */
+#endif /* SDL_HIDAPI_DISABLED */
diff --git a/src/hidapi/ios/hid.m b/src/hidapi/ios/hid.m
index ba1aaa9..d8abfd3 100644
--- a/src/hidapi/ios/hid.m
+++ b/src/hidapi/ios/hid.m
@@ -20,7 +20,7 @@
*/
#include "../../SDL_internal.h"
-#ifndef SDL_DISABLE_HIDAPI
+#if !SDL_HIDAPI_DISABLED
#define hid_init PLATFORM_hid_init
#define hid_exit PLATFORM_hid_exit
@@ -961,4 +961,4 @@ HID_API_EXPORT const wchar_t* HID_API_CALL hid_error(hid_device *dev)
return NULL;
}
-#endif /* !SDL_DISABLE_HIDAPI */
+#endif /* !SDL_HIDAPI_DISABLED */