mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-27 01:48:17 +00:00
storage: implement unfinished_backup flag
This commit is contained in:
parent
27443a06c8
commit
399706ae22
@ -313,6 +313,7 @@ void fsm_msgGetFeatures(GetFeatures *msg)
|
||||
resp->has_pin_cached = true; resp->pin_cached = session_isPinCached();
|
||||
resp->has_passphrase_cached = true; resp->passphrase_cached = session_isPassphraseCached();
|
||||
resp->has_needs_backup = true; resp->needs_backup = storage_needsBackup();
|
||||
resp->unfinished_backup = true; resp->unfinished_backup = storage_unfinishedBackup();
|
||||
resp->has_flags = true; resp->flags = storage_getFlags();
|
||||
resp->has_model = true; strlcpy(resp->model, "1", sizeof(resp->model));
|
||||
|
||||
|
@ -230,6 +230,10 @@ void layoutHome(void)
|
||||
oledDrawBitmap(40, 0, &bmp_logo64);
|
||||
}
|
||||
}
|
||||
if (storage_unfinishedBackup()) {
|
||||
oledBox(0, 0, 127, 8, false);
|
||||
oledDrawStringCenter(0, "BACKUP FAILED!", FONT_STANDARD);
|
||||
} else
|
||||
if (storage_needsBackup()) {
|
||||
oledBox(0, 0, 127, 8, false);
|
||||
oledDrawStringCenter(0, "NEEDS BACKUP!", FONT_STANDARD);
|
||||
|
@ -113,6 +113,7 @@ void reset_backup(bool separated)
|
||||
return;
|
||||
}
|
||||
|
||||
storage_setUnfinishedBackup(true);
|
||||
storage_setNeedsBackup(false);
|
||||
|
||||
if (separated) {
|
||||
@ -148,6 +149,8 @@ void reset_backup(bool separated)
|
||||
}
|
||||
}
|
||||
|
||||
storage_setUnfinishedBackup(false);
|
||||
|
||||
if (separated) {
|
||||
fsm_sendSuccess(_("Seed successfully backed up"));
|
||||
} else {
|
||||
|
@ -173,7 +173,7 @@ bool storage_from_flash(void)
|
||||
// added flags and needsBackup
|
||||
old_storage_size = OLD_STORAGE_SIZE(flags);
|
||||
} else if (version <= 9) {
|
||||
// added u2froot and auto_lock_delay_ms
|
||||
// added u2froot, unfinished_backup and auto_lock_delay_ms
|
||||
old_storage_size = OLD_STORAGE_SIZE(auto_lock_delay_ms);
|
||||
}
|
||||
|
||||
@ -830,6 +830,18 @@ void storage_setNeedsBackup(bool needs_backup)
|
||||
storageUpdate.needs_backup = needs_backup;
|
||||
}
|
||||
|
||||
bool storage_unfinishedBackup(void)
|
||||
{
|
||||
return storageUpdate.has_unfinished_backup ? storageUpdate.unfinished_backup
|
||||
: storageRom->has_unfinished_backup && storageRom->unfinished_backup;
|
||||
}
|
||||
|
||||
void storage_setUnfinishedBackup(bool unfinished_backup)
|
||||
{
|
||||
storageUpdate.has_unfinished_backup = true;
|
||||
storageUpdate.unfinished_backup = unfinished_backup;
|
||||
}
|
||||
|
||||
void storage_applyFlags(uint32_t flags)
|
||||
{
|
||||
if ((storageRom->flags | flags) == storageRom->flags) {
|
||||
|
@ -72,6 +72,7 @@ typedef struct _Storage {
|
||||
STORAGE_BOOL (needs_backup)
|
||||
STORAGE_UINT32 (flags)
|
||||
STORAGE_NODE (u2froot)
|
||||
STORAGE_BOOL (unfinished_backup)
|
||||
STORAGE_UINT32 (auto_lock_delay_ms)
|
||||
} Storage;
|
||||
|
||||
@ -139,6 +140,9 @@ void storage_setImported(bool imported);
|
||||
bool storage_needsBackup(void);
|
||||
void storage_setNeedsBackup(bool needs_backup);
|
||||
|
||||
bool storage_unfinishedBackup(void);
|
||||
void storage_setUnfinishedBackup(bool unfinished_backup);
|
||||
|
||||
void storage_applyFlags(uint32_t flags);
|
||||
uint32_t storage_getFlags(void);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user