data write failed between older project and newer firmware #6595

only:uaefi
This commit is contained in:
Andrey 2024-06-11 12:06:06 -04:00
parent be17496d53
commit 478cfe7c0d
4 changed files with 14 additions and 11 deletions

View File

@ -156,13 +156,15 @@ static void sendOkResponse(TsChannelBase *tsChannel) {
tsChannel->sendResponse(TS_CRC, nullptr, 0);
}
void sendErrorCode(TsChannelBase *tsChannel, uint8_t code) {
efiPrintf("TS <- Err: %d", code);
void sendErrorCode(TsChannelBase *tsChannel, uint8_t code, const char *msg) {
if (msg != DO_NOT_LOG) {
efiPrintf("TS <- Err: %d [%s]", code, msg);
}
tsChannel->writeCrcResponse(code);
}
void TunerStudio::sendErrorCode(TsChannelBase* tsChannel, uint8_t code) {
void TunerStudio::sendErrorCode(TsChannelBase* tsChannel, uint8_t code, const char *msg) {
::sendErrorCode(tsChannel, code);
}
@ -780,7 +782,7 @@ int TunerStudio::handleCrcCommand(TsChannelBase* tsChannel, char *data, int inco
ReturnToothLoggerBuffer(toothBuffer);
} else {
// TS asked for a tooth logger buffer, but we don't have one to give it.
sendErrorCode(tsChannel, TS_RESPONSE_OUT_OF_RANGE);
sendErrorCode(tsChannel, TS_RESPONSE_OUT_OF_RANGE, DO_NOT_LOG);
}
}
break;
@ -799,7 +801,7 @@ int TunerStudio::handleCrcCommand(TsChannelBase* tsChannel, char *data, int inco
tsChannel->sendResponse(TS_CRC, buffer.get<uint8_t>(), buffer.size(), true);
} else {
// TS asked for a tooth logger buffer, but we don't have one to give it.
sendErrorCode(tsChannel, TS_RESPONSE_OUT_OF_RANGE);
sendErrorCode(tsChannel, TS_RESPONSE_OUT_OF_RANGE, DO_NOT_LOG);
}
}
break;
@ -824,14 +826,14 @@ int TunerStudio::handleCrcCommand(TsChannelBase* tsChannel, char *data, int inco
ReturnToothLoggerBuffer(toothBuffer);
} else {
// TS asked for a tooth logger buffer, but we don't have one to give it.
sendErrorCode(tsChannel, TS_RESPONSE_OUT_OF_RANGE);
sendErrorCode(tsChannel, TS_RESPONSE_OUT_OF_RANGE, DO_NOT_LOG);
}
}
break;
#else // EFI_TOOTH_LOGGER
case TS_GET_COMPOSITE_BUFFER_DONE_DIFFERENTLY:
sendErrorCode(tsChannel, TS_RESPONSE_OUT_OF_RANGE);
sendErrorCode(tsChannel, TS_RESPONSE_OUT_OF_RANGE, DO_NOT_LOG);
break;
#endif /* EFI_TOOTH_LOGGER */
#ifdef KNOCK_SPECTROGRAM

View File

@ -28,7 +28,8 @@ extern tunerstudio_counters_s tsState;
void tunerStudioDebug(TsChannelBase* tsChannel, const char *msg);
void tunerStudioError(TsChannelBase* tsChannel, const char *msg);
void sendErrorCode(TsChannelBase *tsChannel, uint8_t code);
#define DO_NOT_LOG nullptr
void sendErrorCode(TsChannelBase *tsChannel, uint8_t code, /*empty line by default, use nullptr not to log*/const char *msg="");
uint8_t* getWorkingPageAddr();

View File

@ -20,7 +20,7 @@ bool validateOffsetCount(size_t offset, size_t count, TsChannelBase* tsChannel)
if (offset + count > getTunerStudioPageSize()) {
efiPrintf("TS: Project mismatch? Too much configuration requested %d/%d", offset, count);
tunerStudioError(tsChannel, "ERROR: out of range");
sendErrorCode(tsChannel, TS_RESPONSE_OUT_OF_RANGE);
sendErrorCode(tsChannel, TS_RESPONSE_OUT_OF_RANGE, "bad_offset");
return true;
}
@ -47,7 +47,7 @@ void TunerStudio::cmdOutputChannels(TsChannelBase* tsChannel, uint16_t offset, u
if (offset + count > TS_TOTAL_OUTPUT_SIZE) {
efiPrintf("TS: Version Mismatch? Too much outputs requested offset=%d + count=%d/total=%d", offset, count,
sizeof(TunerStudioOutputChannels));
sendErrorCode(tsChannel, TS_RESPONSE_OUT_OF_RANGE);
sendErrorCode(tsChannel, TS_RESPONSE_OUT_OF_RANGE, "cmd_size");
return;
}

View File

@ -41,5 +41,5 @@ public:
void handleScatteredReadCommand(TsChannelBase* tsChannel);
private:
void sendErrorCode(TsChannelBase* tsChannel, uint8_t code);
void sendErrorCode(TsChannelBase* tsChannel, uint8_t code, /*empty line by default, use nullptr not to log*/const char *msg="");
};