Fixed Linux build
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
diff --git a/src/hidapi/SDL_hidapi.c b/src/hidapi/SDL_hidapi.c
index 67decce..e7dfd1a 100644
--- a/src/hidapi/SDL_hidapi.c
+++ b/src/hidapi/SDL_hidapi.c
@@ -492,18 +492,28 @@ HIDAPI_ShutdownDiscovery()
#endif
#if defined(SDL_USE_LIBUDEV)
- if (linux_enumeration_method == ENUMERATION_LIBUDEV &&
- usyms) {
- if (SDL_HIDAPI_discovery.m_pUdevMonitor) {
- usyms->udev_monitor_unref(SDL_HIDAPI_discovery.m_pUdevMonitor);
- }
- if (SDL_HIDAPI_discovery.m_pUdev) {
- usyms->udev_unref(SDL_HIDAPI_discovery.m_pUdev);
+ if (linux_enumeration_method == ENUMERATION_LIBUDEV) {
+ if (usyms) {
+ if (SDL_HIDAPI_discovery.m_pUdevMonitor) {
+ usyms->udev_monitor_unref(SDL_HIDAPI_discovery.m_pUdevMonitor);
+ }
+ if (SDL_HIDAPI_discovery.m_pUdev) {
+ usyms->udev_unref(SDL_HIDAPI_discovery.m_pUdev);
+ }
+ SDL_UDEV_ReleaseUdevSyms();
+ usyms = NULL;
}
- SDL_UDEV_ReleaseUdevSyms();
- usyms = NULL;
}
+ else
+#endif /* SDL_USE_LIBUDEV */
+ {
+#if defined(HAVE_INOTIFY)
+ if (inotify_fd >= 0) {
+ close(inotify_fd);
+ inotify_fd = -1;
+ }
#endif
+ }
SDL_HIDAPI_discovery.m_bInitialized = SDL_FALSE;
}
diff --git a/src/joystick/hidapi/SDL_hidapijoystick.c b/src/joystick/hidapi/SDL_hidapijoystick.c
index 0f4e46a..91865ad 100644
--- a/src/joystick/hidapi/SDL_hidapijoystick.c
+++ b/src/joystick/hidapi/SDL_hidapijoystick.c
@@ -1003,13 +1003,6 @@ HIDAPI_JoystickQuit(void)
SDL_HIDAPI_QuitRumble();
-#if defined(HAVE_INOTIFY)
- if (inotify_fd >= 0) {
- close(inotify_fd);
- inotify_fd = -1;
- }
-#endif
-
while (SDL_HIDAPI_devices) {
HIDAPI_DelDevice(SDL_HIDAPI_devices);
}