Log gamepad added/removed

Add a log when a gamepad is added or removed.

PR #5623 <https://github.com/Genymobile/scrcpy/pull/5623>
This commit is contained in:
Romain Vimont 2024-12-08 17:07:03 +01:00
parent 7418fd0662
commit 328bb74f80

View File

@ -69,6 +69,12 @@ sc_gamepad_processor_process_gamepad_added(struct sc_gamepad_processor *gp,
return; return;
} }
SDL_GameController* game_controller =
SDL_GameControllerFromInstanceID(event->gamepad_id);
assert(game_controller);
const char *name = SDL_GameControllerName(game_controller);
LOGI("Gamepad added: [%" PRIu32 "] %s", event->gamepad_id, name);
sc_gamepad_uhid_send_open(gamepad, &hid_open); sc_gamepad_uhid_send_open(gamepad, &hid_open);
} }
@ -83,6 +89,8 @@ sc_gamepad_processor_process_gamepad_removed(struct sc_gamepad_processor *gp,
return; return;
} }
LOGI("Gamepad removed: [%" PRIu32 "]", event->gamepad_id);
sc_gamepad_uhid_send_close(gamepad, &hid_close); sc_gamepad_uhid_send_close(gamepad, &hid_close);
} }