Log gamepad error

Call `SDL_GetError()` to know why opening a gamepad failed.

Refs #6843 <https://github.com/Genymobile/scrcpy/issues/6843>
PR #6853 <https://github.com/Genymobile/scrcpy/pull/6853>
This commit is contained in:
Romain Vimont
2026-05-19 19:43:18 +02:00
parent 610eff3414
commit 2c1f036b60

View File

@@ -1048,13 +1048,13 @@ sc_input_manager_process_gamepad_device(struct sc_input_manager *im,
if (event->type == SDL_EVENT_GAMEPAD_ADDED) {
SDL_Gamepad *sdl_gamepad = SDL_OpenGamepad(event->which);
if (!sdl_gamepad) {
LOGW("Could not open gamepad");
LOGW("Could not open gamepad: %s", SDL_GetError());
return;
}
SDL_Joystick *joystick = SDL_GetGamepadJoystick(sdl_gamepad);
if (!joystick) {
LOGW("Could not get gamepad joystick");
LOGW("Could not get gamepad joystick: %s", SDL_GetError());
SDL_CloseGamepad(sdl_gamepad);
return;
}