Wait a bit for devices to initialize before trying to enumerate and open them.

This works around udev event nodes arriving before hidraw nodes and the controller being opened twice - once using the Linux driver and once by the HIDAPI driver.

This also fixes a kernel panic on Steam Link hardware due to trying to open the hidraw device node too early.

A delay of 10 ms seems to be a good value, tested on Steam Link hardware.
This commit is contained in:
Sam Lantinga 2022-11-03 12:37:54 -07:00
parent 084fa4c3fa
commit c70e675900
2 changed files with 10 additions and 10 deletions

View file

@ -267,6 +267,10 @@ static void joystick_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_clas
return;
}
}
/* Wait a bit for the hidraw udev node to initialize */
SDL_Delay(10);
MaybeAddDevice(devpath);
break;