mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-21 23:05:49 +00:00
Initialize udev before joystick manual scan so class lookup works
LINUX_JoystickInit does a manual scan first so devices are sorted. If SDL_UDEV_Init hasn't run by then, then the product info cannot be looked up by SDL_UDEV_GetProductInfo and the initial-plugged- in-device classification falls back to heuristic guessing.
This commit is contained in:
committed by
Sam Lantinga
parent
863d4a0f2a
commit
0963c11af8
@@ -986,6 +986,9 @@ static void LINUX_JoystickDetect(void)
|
||||
static int LINUX_JoystickInit(void)
|
||||
{
|
||||
const char *devices = SDL_GetHint(SDL_HINT_JOYSTICK_DEVICE);
|
||||
#ifdef SDL_USE_LIBUDEV
|
||||
int udev_status = SDL_UDEV_Init();
|
||||
#endif
|
||||
|
||||
SDL_classic_joysticks = SDL_GetHintBoolean(SDL_HINT_LINUX_JOYSTICK_CLASSIC, SDL_FALSE);
|
||||
|
||||
@@ -1036,7 +1039,7 @@ static int LINUX_JoystickInit(void)
|
||||
}
|
||||
|
||||
if (enumeration_method == ENUMERATION_LIBUDEV) {
|
||||
if (SDL_UDEV_Init() == 0) {
|
||||
if (udev_status == 0) {
|
||||
/* Set up the udev callback */
|
||||
if (SDL_UDEV_AddCallback(joystick_udev_callback) < 0) {
|
||||
SDL_UDEV_Quit();
|
||||
|
||||
Reference in New Issue
Block a user