switch2: Read out serial number

This commit is contained in:
Vicki Pfau authored and Sam Lantinga committed 2025-10-18 07:57:30 -07:00
1 parent e4b763f9f8
commit d635a064aa
1 file changed
+9
+9
View File
@@ -425,6 +425,15 @@ static bool HIDAPI_DriverSwitch2_InitUSB(SDL_HIDAPI_Device *device)
unsigned char calibration_data[0x40] = {0};
res = ReadFlashBlock(ctx, 0x13000, calibration_data);
if (res < 0) {
SDL_LogWarn(SDL_LOG_CATEGORY_INPUT, "Couldn't read serial number: %d", res);
} else {
char serial[0x11] = {0};
SDL_strlcpy(serial, (char*)&calibration_data[2], sizeof(serial));
HIDAPI_SetDeviceSerial(device, serial);
}
res = ReadFlashBlock(ctx, 0x13080, calibration_data);
if (res < 0) {
SDL_LogWarn(SDL_LOG_CATEGORY_INPUT, "Couldn't read factory calibration data: %d", res);