[FL-3377] Update error code descriptions (#2875)

* updater: added update error code descriptions
* updater: separate ram/flash messages
* updater: extra pre-update checks
* updater: fixed string comparison
* updater: Additional logging

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
hedger
2023-07-14 16:45:16 +03:00
committed by GitHub
parent af64ae0e40
commit f2324e4d1c
8 changed files with 238 additions and 36 deletions

View File

@@ -20,7 +20,8 @@ static const char* update_prepare_result_descr[] = {
[UpdatePrepareResultManifestInvalid] = "Invalid manifest data",
[UpdatePrepareResultStageMissing] = "Missing Stage2 loader",
[UpdatePrepareResultStageIntegrityError] = "Corrupted Stage2 loader",
[UpdatePrepareResultManifestPointerError] = "Failed to create update pointer file",
[UpdatePrepareResultManifestPointerCreateError] = "Failed to create update pointer file",
[UpdatePrepareResultManifestPointerCheckError] = "Update pointer file error (corrupted FS?)",
[UpdatePrepareResultTargetMismatch] = "Hardware target mismatch",
[UpdatePrepareResultOutdatedManifestVersion] = "Update package is too old",
[UpdatePrepareResultIntFull] = "Need more free space in internal storage",
@@ -142,8 +143,8 @@ UpdatePrepareResult update_operation_prepare(const char* manifest_file_path) {
File* file = storage_file_alloc(storage);
uint64_t free_int_space;
FuriString* stage_path;
stage_path = furi_string_alloc();
FuriString* stage_path = furi_string_alloc();
FuriString* manifest_path_check = furi_string_alloc();
do {
if((storage_common_fs_info(storage, STORAGE_INT_PATH_PREFIX, NULL, &free_int_space) !=
FSE_OK) ||
@@ -188,7 +189,18 @@ UpdatePrepareResult update_operation_prepare(const char* manifest_file_path) {
}
if(!update_operation_persist_manifest_path(storage, manifest_file_path)) {
result = UpdatePrepareResultManifestPointerError;
result = UpdatePrepareResultManifestPointerCreateError;
break;
}
if(!update_operation_get_current_package_manifest_path(storage, manifest_path_check) ||
(furi_string_cmpi_str(manifest_path_check, manifest_file_path) != 0)) {
FURI_LOG_E(
"update",
"Manifest pointer check failed: '%s' != '%s'",
furi_string_get_cstr(manifest_path_check),
manifest_file_path);
result = UpdatePrepareResultManifestPointerCheckError;
break;
}
@@ -197,6 +209,7 @@ UpdatePrepareResult update_operation_prepare(const char* manifest_file_path) {
} while(false);
furi_string_free(stage_path);
furi_string_free(manifest_path_check);
storage_file_free(file);
update_manifest_free(manifest);