Save fallback to linuxraw driver in case of first boot.

When no devices can be detected and it is the initial boot, make
sure the driver is set to linuxraw, if supported.
This commit is contained in:
zoltanvb 2025-03-30 12:55:41 +02:00
parent 1b3973edbc
commit 3bbbeca957
1 changed files with 21 additions and 0 deletions

View File

@ -4126,7 +4126,28 @@ static void *udev_input_init(const char *joypad_driver)
/* If using KMS and we forgot this,
* we could lock ourselves out completely. */
if (!udev->num_devices)
{
settings_t *settings = config_get_ptr();
RARCH_WARN("[udev]: Couldn't open any keyboard, mouse or touchpad. Are permissions set correctly for /dev/input/event* and /run/udev/?\n");
/* Start screen is not used nowadays, but it still gets true value only
* on first startup without config file, so it should be good to catch
* initial boots without udev devices available. */
#if defined(__linux__) && !defined(ANDROID)
if (settings->bools.menu_show_start_screen)
{
/* Force fallback to linuxraw. Driver reselection would happen even
* without overwriting input_driver setting, but that would not be saved
* as input driver auto-changes are not stored (due to interlock with
* video context driver), and on next boot user would be stuck with a
* possibly nonworking configuration.
*/
strlcpy(settings->arrays.input_driver, "linuxraw",
sizeof(settings->arrays.input_driver));
RARCH_WARN("[udev]: First boot and without input devices, forcing fallback to linuxraw.\n");
goto error;
}
#endif
}
input_keymaps_init_keyboard_lut(rarch_key_map_linux);