From 1fa80ea3a35a4086c627228b834c0e17c4aa3cc1 Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Wed, 27 Dec 2017 07:27:12 +0100 Subject: SDL: Add debug traces for joystick hotplug --- backends/events/sdl/sdl-events.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'backends/events') diff --git a/backends/events/sdl/sdl-events.cpp b/backends/events/sdl/sdl-events.cpp index 8a59aeb1a8..258f51a310 100644 --- a/backends/events/sdl/sdl-events.cpp +++ b/backends/events/sdl/sdl-events.cpp @@ -924,8 +924,12 @@ bool SdlEventSource::handleJoyAxisMotion(SDL_Event &ev, Common::Event &event) { #if SDL_VERSION_ATLEAST(2, 0, 0) bool SdlEventSource::handleJoystickAdded(const SDL_JoyDeviceEvent &device) { + debug(5, "SdlEventSource: Received joystick added event for index '%d'", device.which); + int joystick_num = ConfMan.getInt("joystick_num"); if (joystick_num == device.which) { + debug(5, "SdlEventSource: Newly added joystick with index '%d' matches 'joysticky_num', trying to use it", device.which); + closeJoystick(); openJoystick(joystick_num); } @@ -934,6 +938,8 @@ bool SdlEventSource::handleJoystickAdded(const SDL_JoyDeviceEvent &device) { } bool SdlEventSource::handleJoystickRemoved(const SDL_JoyDeviceEvent &device) { + debug(5, "SdlEventSource: Received joystick removed event for instance id '%d'", device.which); + SDL_Joystick *joystick; if (_controller) { joystick = SDL_GameControllerGetJoystick(_controller); @@ -946,6 +952,8 @@ bool SdlEventSource::handleJoystickRemoved(const SDL_JoyDeviceEvent &device) { } if (SDL_JoystickInstanceID(joystick) == device.which) { + debug(5, "SdlEventSource: Newly removed joystick with instance id '%d' matches currently used joystick, closing current joystick", device.which); + closeJoystick(); } -- cgit v1.2.3