[FL-2517, FL-2518, FL-2523] Updater UI overhaul (#1196)
* Updater: UI rework initial * Updater: further updates to UI, added a temporary parrot * Updater: additional checks on radio stack type before update * Second iteration of updater UI: additional handling of resource unpacking errors * updater: removed extra logging, renamed some stages * Updater: Changed "back" button icon on error screen * Archive: signed/unsigned fix * Updater: cancelling update also cancels LFS+resources processing; restored /ext/update/ folder magic to 0 * Updater: root dir fix Co-authored-by: nminaylov <nm29719@gmail.com>
This commit is contained in:
@@ -12,7 +12,6 @@ extern "C" {
|
||||
/* Paths don't include /ext -- because at startup SD card is mounted as root */
|
||||
#define UPDATE_DIR_DEFAULT_REL_PATH "/update"
|
||||
#define UPDATE_MANIFEST_DEFAULT_NAME "update.fuf"
|
||||
#define UPDATE_MAINFEST_DEFAULT_PATH UPDATE_DIR_DEFAULT_REL_PATH "/" UPDATE_MANIFEST_DEFAULT_NAME
|
||||
|
||||
typedef union {
|
||||
uint8_t raw[6];
|
||||
|
@@ -9,10 +9,10 @@
|
||||
#include <lib/toolbox/path.h>
|
||||
#include <lib/toolbox/crc32_calc.h>
|
||||
|
||||
static const char* UPDATE_ROOT_DIR = "/ext" UPDATE_DIR_DEFAULT_REL_PATH;
|
||||
static const char* UPDATE_PREFIX = "/ext" UPDATE_DIR_DEFAULT_REL_PATH "/";
|
||||
static const char* UPDATE_SUFFIX = "/" UPDATE_MANIFEST_DEFAULT_NAME;
|
||||
static const uint32_t MAX_DIR_NAME_LEN = 250;
|
||||
#define UPDATE_ROOT_DIR "/ext" UPDATE_DIR_DEFAULT_REL_PATH
|
||||
#define UPDATE_PREFIX "/ext" UPDATE_DIR_DEFAULT_REL_PATH "/"
|
||||
#define UPDATE_SUFFIX "/" UPDATE_MANIFEST_DEFAULT_NAME
|
||||
#define MAX_DIR_NAME_LEN 250
|
||||
|
||||
static const char* update_prepare_result_descr[] = {
|
||||
[UpdatePrepareResultOK] = "OK",
|
||||
@@ -59,7 +59,7 @@ int32_t update_operation_get_package_index(Storage* storage, const char* update_
|
||||
furi_assert(update_package_dir);
|
||||
|
||||
if(strlen(update_package_dir) == 0) {
|
||||
return 0;
|
||||
return UPDATE_OPERATION_ROOT_DIR_PACKAGE_MAGIC;
|
||||
}
|
||||
|
||||
bool found = false;
|
||||
@@ -90,9 +90,9 @@ int32_t update_operation_get_package_index(Storage* storage, const char* update_
|
||||
}
|
||||
|
||||
bool update_operation_get_current_package_path(Storage* storage, string_t out_path) {
|
||||
uint32_t update_index = furi_hal_rtc_get_register(FuriHalRtcRegisterUpdateFolderFSIndex);
|
||||
const uint32_t update_index = furi_hal_rtc_get_register(FuriHalRtcRegisterUpdateFolderFSIndex);
|
||||
string_set_str(out_path, UPDATE_ROOT_DIR);
|
||||
if(update_index == 0) {
|
||||
if(update_index == UPDATE_OPERATION_ROOT_DIR_PACKAGE_MAGIC) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -184,14 +184,19 @@ UpdatePrepareResult update_operation_prepare(const char* manifest_file_path) {
|
||||
}
|
||||
|
||||
bool update_operation_is_armed() {
|
||||
return furi_hal_rtc_get_boot_mode() == FuriHalRtcBootModePreUpdate;
|
||||
FuriHalRtcBootMode boot_mode = furi_hal_rtc_get_boot_mode();
|
||||
return (boot_mode >= FuriHalRtcBootModePreUpdate) &&
|
||||
(boot_mode <= FuriHalRtcBootModePostUpdate) &&
|
||||
(furi_hal_rtc_get_register(FuriHalRtcRegisterUpdateFolderFSIndex) > 0);
|
||||
}
|
||||
|
||||
void update_operation_disarm() {
|
||||
furi_hal_rtc_set_boot_mode(FuriHalRtcBootModeNormal);
|
||||
furi_hal_rtc_set_register(FuriHalRtcRegisterUpdateFolderFSIndex, 0);
|
||||
furi_hal_rtc_set_register(
|
||||
FuriHalRtcRegisterUpdateFolderFSIndex, INT_MAX);
|
||||
}
|
||||
|
||||
void update_operation_persist_package_index(uint32_t index) {
|
||||
void update_operation_persist_package_index(int32_t index) {
|
||||
furi_check(index >= 0);
|
||||
furi_hal_rtc_set_register(FuriHalRtcRegisterUpdateFolderFSIndex, index);
|
||||
}
|
||||
|
@@ -8,6 +8,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define UPDATE_OPERATION_ROOT_DIR_PACKAGE_MAGIC 0
|
||||
|
||||
/*
|
||||
* Checks if supplied full manifest path is valid
|
||||
* @param full_path Full path to manifest file. Must be named UPDATE_MANIFEST_DEFAULT_NAME
|
||||
@@ -39,7 +41,7 @@ UpdatePrepareResult update_operation_prepare(const char* manifest_file_path);
|
||||
* Gets update package index to pass in RTC registers
|
||||
* @param storage Storage API
|
||||
* @param update_package_dir Package directory name
|
||||
* @return int32_t <0 - error, >= 0 - update index value
|
||||
* @return int32_t <=0 - error, >0 - update index value
|
||||
*/
|
||||
int32_t update_operation_get_package_index(Storage* storage, const char* update_package_dir);
|
||||
|
||||
@@ -55,10 +57,10 @@ bool update_operation_get_current_package_path(Storage* storage, string_t out_pa
|
||||
* Stores given update index in RTC registers
|
||||
* @param index Value to store
|
||||
*/
|
||||
void update_operation_persist_package_index(uint32_t index);
|
||||
void update_operation_persist_package_index(int32_t index);
|
||||
|
||||
/*
|
||||
* Sets up update operation to be performed on reset
|
||||
* Checks if an update operation step is pending after reset
|
||||
*/
|
||||
bool update_operation_is_armed();
|
||||
|
||||
|
Reference in New Issue
Block a user