Implemented SDL_GameControllerGetFirmwareVersion() for HIDAPI PS5 controllers
diff --git a/src/joystick/hidapi/SDL_hidapi_ps5.c b/src/joystick/hidapi/SDL_hidapi_ps5.c
index 2549c2a..3f1b62c 100644
--- a/src/joystick/hidapi/SDL_hidapi_ps5.c
+++ b/src/joystick/hidapi/SDL_hidapi_ps5.c
@@ -59,6 +59,7 @@ typedef enum
{
k_EPS5FeatureReportIdCalibration = 0x05,
k_EPS5FeatureReportIdSerialNumber = 0x09,
+ k_EPS5FeatureReportIdFirmwareInfo = 0x20,
} EPS5FeatureReportId;
typedef struct
@@ -601,6 +602,13 @@ HIDAPI_DriverPS5_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joystick)
data[6], data[5], data[4], data[3], data[2], data[1]);
joystick->serial = SDL_strdup(serial);
}
+
+ /* Read the firmware version
+ This will also enable enhanced reports over Bluetooth
+ */
+ if (ReadFeatureReport(device->dev, k_EPS5FeatureReportIdFirmwareInfo, data, USB_PACKET_LENGTH) >= 46) {
+ joystick->firmware_version = (Uint16)data[44] | ((Uint16)data[45] << 8);
+ }
}
if (!joystick->serial && device->serial && SDL_strlen(device->serial) == 12) {