[FL-2578] Updater fixes related to /int handling (#1359)

* Updater fixes related to /int handling
  updater: performing factory reset on update, checking for LFS free space before updating, fixed improper error handling on backup/restore operations, rebalanced update stage weights for better progress visuals
  scripts: added CLI output validation for selfupdate.py
  storage: added pointer validation in storage_int_common_fs_info
  desktop: fixed crash on rendering invalid slideshows
* Typo fix
* rpc: Updated protobuf to 0.9
* rpc: removed updater status conversion

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
hedger
2022-07-04 16:36:12 +03:00
committed by GitHub
parent 4a1695ba1c
commit b95cd2df14
13 changed files with 76 additions and 38 deletions

View File

@@ -12,6 +12,7 @@
struct Slideshow {
Icon icon;
uint32_t current_frame;
bool loaded;
};
#pragma pack(push, 1)
@@ -34,6 +35,7 @@ _Static_assert(sizeof(SlideshowFrameHeader) == 2, "Incorrect SlideshowFrameHeade
Slideshow* slideshow_alloc() {
Slideshow* ret = malloc(sizeof(Slideshow));
ret->loaded = false;
return ret;
}
@@ -52,7 +54,7 @@ void slideshow_free(Slideshow* slideshow) {
bool slideshow_load(Slideshow* slideshow, const char* fspath) {
Storage* storage = furi_record_open("storage");
File* slideshow_file = storage_file_alloc(storage);
bool load_success = false;
slideshow->loaded = false;
do {
if(!storage_file_open(slideshow_file, fspath, FSAM_READ, FSOM_OPEN_EXISTING)) {
break;
@@ -80,12 +82,16 @@ bool slideshow_load(Slideshow* slideshow, const char* fspath) {
frame_header.size) {
break;
}
load_success = (frame_idx + 1) == header.frame_count;
slideshow->loaded = (frame_idx + 1) == header.frame_count;
}
} while(false);
storage_file_free(slideshow_file);
furi_record_close("storage");
return load_success;
return slideshow->loaded;
}
bool slideshow_is_loaded(Slideshow* slideshow) {
return slideshow->loaded;
}
bool slideshow_advance(Slideshow* slideshow) {

View File

@@ -8,6 +8,7 @@ Slideshow* slideshow_alloc();
void slideshow_free(Slideshow* slideshow);
bool slideshow_load(Slideshow* slideshow, const char* fspath);
bool slideshow_is_loaded(Slideshow* slideshow);
void slideshow_goback(Slideshow* slideshow);
bool slideshow_advance(Slideshow* slideshow);
void slideshow_draw(Slideshow* slideshow, Canvas* canvas, uint8_t x, uint8_t y);