Show the firmware version in testgamecontroller

This commit is contained in:
Sam Lantinga 2022-06-06 06:48:54 -07:00
parent 5f25a6ea78
commit 30cf26e089

View File

@ -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));