Skip to content

Commit 79b6e00

Browse files
committed
sdl joypad: log if sensors are available
1 parent d6e3777 commit 79b6e00

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

input/drivers_joypad/sdl_joypad.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,18 @@ static void sdl_pad_connect(unsigned id)
222222
RARCH_LOG("[SDL] Falling back to joystick rumble.\n");
223223
}
224224
#endif
225+
#if SDL_SUPPORTS_SENSORS
226+
if (pad->controller)
227+
{
228+
bool has_accel = SDL_GameControllerHasSensor(pad->controller, SDL_SENSOR_ACCEL);
229+
bool has_gyro = SDL_GameControllerHasSensor(pad->controller, SDL_SENSOR_GYRO);
230+
if (has_accel || has_gyro)
231+
RARCH_LOG("[SDL] Pad #%u: found sensors (accel=%s, gyro=%s).\n",
232+
id,
233+
has_accel ? "yes" : "no",
234+
has_gyro ? "yes" : "no");
235+
}
236+
#endif
225237
#else
226238
pad->num_axes = SDL_JoystickNumAxes(pad->joypad);
227239
pad->num_buttons = SDL_JoystickNumButtons(pad->joypad);

0 commit comments

Comments
 (0)