mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 07:28:10 +00:00
fsm: Include file and line in fsm_sendFailure for DEBUG_LINK
This commit is contained in:
parent
8fceb961e4
commit
b92a0d24b0
@ -106,7 +106,11 @@ void fsm_sendSuccess(const char *text)
|
|||||||
msg_write(MessageType_MessageType_Success, resp);
|
msg_write(MessageType_MessageType_Success, resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if DEBUG_LINK
|
||||||
|
void fsm_sendFailureDebug(FailureType code, const char *text, const char *source)
|
||||||
|
#else
|
||||||
void fsm_sendFailure(FailureType code, const char *text)
|
void fsm_sendFailure(FailureType code, const char *text)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
if (protectAbortedByInitialize) {
|
if (protectAbortedByInitialize) {
|
||||||
fsm_msgInitialize((Initialize *)0);
|
fsm_msgInitialize((Initialize *)0);
|
||||||
@ -156,10 +160,18 @@ void fsm_sendFailure(FailureType code, const char *text)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if DEBUG_LINK
|
||||||
|
resp->has_message = true;
|
||||||
|
strlcpy(resp->message, source, sizeof(resp->message));
|
||||||
|
if (text) {
|
||||||
|
strlcat(resp->message, text, sizeof(resp->message));
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (text) {
|
if (text) {
|
||||||
resp->has_message = true;
|
resp->has_message = true;
|
||||||
strlcpy(resp->message, text, sizeof(resp->message));
|
strlcpy(resp->message, text, sizeof(resp->message));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
msg_write(MessageType_MessageType_Failure, resp);
|
msg_write(MessageType_MessageType_Failure, resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,14 @@
|
|||||||
// message functions
|
// message functions
|
||||||
|
|
||||||
void fsm_sendSuccess(const char *text);
|
void fsm_sendSuccess(const char *text);
|
||||||
|
|
||||||
|
#if DEBUG_LINK
|
||||||
|
void fsm_sendFailureDebug(FailureType code, const char *text, const char *source);
|
||||||
|
|
||||||
|
#define fsm_sendFailure(code, text) fsm_sendFailureDebug((code), (text), __FILE__ ":" VERSTR(__LINE__) ":")
|
||||||
|
#else
|
||||||
void fsm_sendFailure(FailureType code, const char *text);
|
void fsm_sendFailure(FailureType code, const char *text);
|
||||||
|
#endif
|
||||||
|
|
||||||
void fsm_msgInitialize(Initialize *msg);
|
void fsm_msgInitialize(Initialize *msg);
|
||||||
void fsm_msgGetFeatures(GetFeatures *msg);
|
void fsm_msgGetFeatures(GetFeatures *msg);
|
||||||
|
Loading…
Reference in New Issue
Block a user