mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-08 12:28:14 +00:00
Avoid conflicts with multiple versions of udev by first trying the library that is linked with the executable, if any, and then picking the one that is in the build environment.
This fixes joystick detection for applications using the Steam Linux Runtime
This commit is contained in:
@@ -33,7 +33,14 @@
|
||||
|
||||
#include "SDL.h"
|
||||
|
||||
static const char* SDL_UDEV_LIBS[] = { "libudev.so.1", "libudev.so.0" };
|
||||
static const char *SDL_UDEV_LIBS[] = {
|
||||
#ifdef SDL_UDEV_DYNAMIC
|
||||
SDL_UDEV_DYNAMIC
|
||||
#else
|
||||
"libudev.so.1",
|
||||
"libudev.so.0"
|
||||
#endif
|
||||
};
|
||||
|
||||
#define _THIS SDL_UDEV_PrivateData *_this
|
||||
static _THIS = NULL;
|
||||
@@ -252,8 +259,12 @@ SDL_UDEV_LoadLibrary(void)
|
||||
if (_this == NULL) {
|
||||
return SDL_SetError("UDEV not initialized");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* See if there is a udev library already loaded */
|
||||
if (SDL_UDEV_load_syms() == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (_this->udev_handle == NULL) {
|
||||
for( i = 0 ; i < SDL_arraysize(SDL_UDEV_LIBS); i++) {
|
||||
_this->udev_handle = SDL_LoadObject(SDL_UDEV_LIBS[i]);
|
||||
@@ -536,3 +547,5 @@ SDL_UDEV_DelCallback(SDL_UDEV_Callback cb)
|
||||
|
||||
|
||||
#endif /* SDL_USE_LIBUDEV */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
Reference in New Issue
Block a user