Commit 30cf26e089e59596f5cc94b65935fab20b7b27df

Sam Lantinga 2022-06-06T06:48:54

Show the firmware version in testgamecontroller

diff --git a/test/testgamecontroller.c b/test/testgamecontroller.c
index 011e5cd..bd22810 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));