Skip to content

Commit

Permalink
fix(legacy): convert storage ui enum to text
Browse files Browse the repository at this point in the history
[no changelog]
  • Loading branch information
matejcik committed Mar 15, 2024
1 parent 2733c28 commit 0d546c4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
24 changes: 22 additions & 2 deletions legacy/firmware/protect.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ const char *requestPin(PinMatrixRequestType type, const char *text) {
}

secbool protectPinUiCallback(uint32_t wait, uint32_t progress,
const char *message) {
enum storage_ui_message_t message) {
// Convert wait to secstr string.
char secstrbuf[] = _("________0 seconds");
char *secstr = secstrbuf + 9;
Expand All @@ -165,7 +165,27 @@ secbool protectPinUiCallback(uint32_t wait, uint32_t progress,
secstrbuf[16] = 0;
}
oledClear();
oledDrawStringCenter(OLED_WIDTH / 2, 0 * 9, message, FONT_STANDARD);

const char *message_str = NULL;
switch (message) {
case VERIFYING_PIN_MSG:
message_str = _("Verifying PIN");
break;
case PROCESSING_MSG:
message_str = _("Processing");
break;
case STARTING_MSG:
message_str = _("Starting up");
break;
case WRONG_PIN_MSG:
message_str = _("Wrong PIN");
break;
default:
message_str = _("");
break;
}

oledDrawStringCenter(OLED_WIDTH / 2, 0 * 9, message_str, FONT_STANDARD);
oledDrawStringCenter(OLED_WIDTH / 2, 2 * 9, _("Please wait"), FONT_STANDARD);
oledDrawStringCenter(OLED_WIDTH / 2, 3 * 9, secstr, FONT_STANDARD);
oledDrawStringCenter(OLED_WIDTH / 2, 4 * 9, _("to continue ..."),
Expand Down
3 changes: 2 additions & 1 deletion legacy/firmware/protect.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@
#include <stdbool.h>
#include "messages-common.pb.h"
#include "secbool.h"
#include "storage.h"

#define MAX_PASSPHRASE_LEN 50

bool protectButton(ButtonRequestType type, bool confirm_only);
secbool protectPinUiCallback(uint32_t wait, uint32_t progress,
const char* message);
enum storage_ui_message_t message);
bool protectPin(bool use_cached);
bool protectChangePin(bool removal);
bool protectChangeWipeCode(bool removal);
Expand Down

0 comments on commit 0d546c4

Please sign in to comment.