Manually scan for Linux joysticks before udev scan runs

This allows us to have joysticks sorted by insert time at startup, fixing https://github.com/libsdl-org/SDL/issues/4688
This commit is contained in:
Sam Lantinga 2021-08-24 17:01:34 -07:00
parent cbccf5bb50
commit 130b6bebae
1 changed files with 3 additions and 3 deletions

View File

@ -676,6 +676,9 @@ LINUX_JoystickInit(void)
last_joy_detect_time = 0;
last_input_dir_mtime = 0;
/* Manually scan first, since we sort by device number and udev doesn't */
LINUX_JoystickDetect();
#if SDL_USE_LIBUDEV
if (enumeration_method == ENUMERATION_LIBUDEV) {
if (SDL_UDEV_Init() < 0) {
@ -717,9 +720,6 @@ LINUX_JoystickInit(void)
}
}
#endif /* HAVE_INOTIFY */
/* Report all devices currently present */
LINUX_JoystickDetect();
}
return 0;