From 30cf26e089e59596f5cc94b65935fab20b7b27df Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 6 Jun 2022 06:48:54 -0700 Subject: [PATCH] Show the firmware version in testgamecontroller --- test/testgamecontroller.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/testgamecontroller.c b/test/testgamecontroller.c index 011e5cd6d..bd2281077 100644 --- a/test/testgamecontroller.c +++ b/test/testgamecontroller.c @@ -133,6 +133,7 @@ static void AddController(int device_index, SDL_bool verbose) SDL_JoystickID controller_id = SDL_JoystickGetDeviceInstanceID(device_index); SDL_GameController *controller; SDL_GameController **controllers; + Uint16 firmware_version; controller_id = SDL_JoystickGetDeviceInstanceID(device_index); if (controller_id < 0) { @@ -168,6 +169,13 @@ static void AddController(int device_index, SDL_bool verbose) SDL_Log("Opened game controller %s%s%s\n", name, path ? ", " : "", path ? path : ""); } + firmware_version = SDL_GameControllerGetFirmwareVersion(gamecontroller); + if (firmware_version) { + if (verbose) { + SDL_Log("Firmware version: 0x%x (%d)\n", firmware_version, firmware_version); + } + } + if (SDL_GameControllerHasSensor(gamecontroller, SDL_SENSOR_ACCEL)) { if (verbose) { SDL_Log("Enabling accelerometer at %.2f Hz\n", SDL_GameControllerGetSensorDataRate(gamecontroller, SDL_SENSOR_ACCEL));