Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/thirdparty/sdl/patches/0005-fix-libudev-dbus.patch
9898 views
1
diff --git a/thirdparty/sdl/core/linux/SDL_dbus.c b/thirdparty/sdl/core/linux/SDL_dbus.c
2
index 9a2fc1ea531..9dc5c266732 100644
3
--- a/thirdparty/sdl/core/linux/SDL_dbus.c
4
+++ b/thirdparty/sdl/core/linux/SDL_dbus.c
5
@@ -97,15 +97,18 @@ static bool LoadDBUSSyms(void)
6
7
static void UnloadDBUSLibrary(void)
8
{
9
+#ifdef SOWRAP_ENABLED // Godot build system constant
10
if (dbus_handle) {
11
SDL_UnloadObject(dbus_handle);
12
dbus_handle = NULL;
13
}
14
+#endif
15
}
16
17
static bool LoadDBUSLibrary(void)
18
{
19
bool result = true;
20
+#ifdef SOWRAP_ENABLED // Godot build system constant
21
if (!dbus_handle) {
22
dbus_handle = SDL_LoadObject(dbus_library);
23
if (!dbus_handle) {
24
@@ -118,6 +121,9 @@ static bool LoadDBUSLibrary(void)
25
}
26
}
27
}
28
+#else
29
+ result = LoadDBUSSyms();
30
+#endif
31
return result;
32
}
33
34
diff --git a/thirdparty/sdl/core/linux/SDL_udev.c b/thirdparty/sdl/core/linux/SDL_udev.c
35
index 907c34c7f66..fbf2ff04440 100644
36
--- a/thirdparty/sdl/core/linux/SDL_udev.c
37
+++ b/thirdparty/sdl/core/linux/SDL_udev.c
38
@@ -38,7 +38,8 @@
39
40
static const char *SDL_UDEV_LIBS[] = { "libudev.so.1", "libudev.so.0" };
41
42
-static SDL_UDEV_PrivateData *_this = NULL;
43
+SDL_UDEV_PrivateData *SDL_UDEV_PrivateData_this = NULL;
44
+#define _this SDL_UDEV_PrivateData_this
45
46
static bool SDL_UDEV_load_sym(const char *fn, void **addr);
47
static bool SDL_UDEV_load_syms(void);
48
diff --git a/thirdparty/sdl/core/linux/SDL_udev.h b/thirdparty/sdl/core/linux/SDL_udev.h
49
index 738f4bafe3f..50bed36248e 100644
50
--- a/thirdparty/sdl/core/linux/SDL_udev.h
51
+++ b/thirdparty/sdl/core/linux/SDL_udev.h
52
@@ -30,7 +30,8 @@
53
#define SDL_USE_LIBUDEV 1
54
#endif
55
56
-#include <libudev.h>
57
+//#include <libudev.h>
58
+#include "thirdparty/linuxbsd_headers/udev/libudev.h"
59
#include <sys/time.h>
60
#include <sys/types.h>
61
62
diff --git a/thirdparty/sdl/hidapi/linux/hid.c b/thirdparty/sdl/hidapi/linux/hid.c
63
index dbbb3277854..51a32ef892f 100644
64
--- a/thirdparty/sdl/hidapi/linux/hid.c
65
+++ b/thirdparty/sdl/hidapi/linux/hid.c
66
@@ -40,7 +40,37 @@
67
#include <linux/hidraw.h>
68
#include <linux/version.h>
69
#include <linux/input.h>
70
-#include <libudev.h>
71
+//#include <libudev.h>
72
+#include "SDL_udev.h"
73
+extern SDL_UDEV_PrivateData *SDL_UDEV_PrivateData_this;
74
+#define udev_device_get_action (SDL_UDEV_PrivateData_this->syms.udev_device_get_action)
75
+#define udev_device_get_devnode (SDL_UDEV_PrivateData_this->syms.udev_device_get_devnode)
76
+#define udev_device_get_syspath (SDL_UDEV_PrivateData_this->syms.udev_device_get_syspath)
77
+#define udev_device_get_subsystem (SDL_UDEV_PrivateData_this->syms.udev_device_get_subsystem)
78
+#define udev_device_get_parent_with_subsystem_devtype (SDL_UDEV_PrivateData_this->syms.udev_device_get_parent_with_subsystem_devtype)
79
+#define udev_device_get_property_value (SDL_UDEV_PrivateData_this->syms.udev_device_get_property_value)
80
+#define udev_device_get_sysattr_value (SDL_UDEV_PrivateData_this->syms.udev_device_get_sysattr_value)
81
+#define udev_device_new_from_syspath (SDL_UDEV_PrivateData_this->syms.udev_device_new_from_syspath)
82
+#define udev_device_unref (SDL_UDEV_PrivateData_this->syms.udev_device_unref)
83
+#define udev_enumerate_add_match_property (SDL_UDEV_PrivateData_this->syms.udev_enumerate_add_match_property)
84
+#define udev_enumerate_add_match_subsystem (SDL_UDEV_PrivateData_this->syms.udev_enumerate_add_match_subsystem)
85
+#define udev_enumerate_get_list_entry (SDL_UDEV_PrivateData_this->syms.udev_enumerate_get_list_entry)
86
+#define udev_enumerate_new (SDL_UDEV_PrivateData_this->syms.udev_enumerate_new)
87
+#define udev_enumerate_scan_devices (SDL_UDEV_PrivateData_this->syms.udev_enumerate_scan_devices)
88
+#define udev_enumerate_unref (SDL_UDEV_PrivateData_this->syms.udev_enumerate_unref)
89
+#define udev_list_entry_get_name (SDL_UDEV_PrivateData_this->syms.udev_list_entry_get_name)
90
+#define udev_list_entry_get_next (SDL_UDEV_PrivateData_this->syms.udev_list_entry_get_next)
91
+#define udev_monitor_enable_receiving (SDL_UDEV_PrivateData_this->syms.udev_monitor_enable_receiving)
92
+#define udev_monitor_filter_add_match_subsystem_devtype (SDL_UDEV_PrivateData_this->syms.udev_monitor_filter_add_match_subsystem_devtype)
93
+#define udev_monitor_get_fd (SDL_UDEV_PrivateData_this->syms.udev_monitor_get_fd)
94
+#define udev_monitor_new_from_netlink (SDL_UDEV_PrivateData_this->syms.udev_monitor_new_from_netlink)
95
+#define udev_monitor_receive_device (SDL_UDEV_PrivateData_this->syms.udev_monitor_receive_device)
96
+#define udev_monitor_unref (SDL_UDEV_PrivateData_this->syms.udev_monitor_unref)
97
+#define udev_new (SDL_UDEV_PrivateData_this->syms.udev_new)
98
+#define udev_unref (SDL_UDEV_PrivateData_this->syms.udev_unref)
99
+#define udev_device_new_from_devnum (SDL_UDEV_PrivateData_this->syms.udev_device_new_from_devnum)
100
+#define udev_device_get_devnum (SDL_UDEV_PrivateData_this->syms.udev_device_get_devnum)
101
+#undef SDL_UDEV_SYM
102
103
#include "../hidapi/hidapi.h"
104
105
diff --git a/thirdparty/sdl/loadso/dlopen/SDL_sysloadso.c b/thirdparty/sdl/loadso/dlopen/SDL_sysloadso.c
106
index c84d1a1b5f9..e09c09080cd 100644
107
--- a/thirdparty/sdl/loadso/dlopen/SDL_sysloadso.c
108
+++ b/thirdparty/sdl/loadso/dlopen/SDL_sysloadso.c
109
@@ -65,8 +65,8 @@ SDL_FunctionPointer SDL_LoadFunction(SDL_SharedObject *handle, const char *name)
110
symbol = dlsym(handle, _name);
111
SDL_small_free(_name, isstack);
112
if (!symbol) {
113
- SDL_SetError("Failed loading %s: %s", name,
114
- (const char *)dlerror());
115
+ //SDL_SetError("Failed loading %s: %s", name,
116
+ // (const char *)dlerror());
117
}
118
}
119
return symbol;
120
121