From 10c1715a998a86d31cd710c8aef36fde23c14c9c Mon Sep 17 00:00:00 2001 From: Renze Nicolai Date: Wed, 15 Jun 2022 21:54:36 +0200 Subject: [PATCH 1/2] Initial changes to support extended appfs metadata --- main/appfs_wrapper.c | 4 ++-- main/file_browser.c | 2 +- main/include/appfs_wrapper.h | 2 +- main/menus/launcher.c | 14 ++++++++++++-- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/main/appfs_wrapper.c b/main/appfs_wrapper.c index c4c022d..5cfad2c 100644 --- a/main/appfs_wrapper.c +++ b/main/appfs_wrapper.c @@ -48,7 +48,7 @@ void appfs_boot_app(int fd) { esp_deep_sleep_start(); } -void appfs_store_app(pax_buf_t* pax_buffer, ILI9341* ili9341, char* path, char* label) { +void appfs_store_app(pax_buf_t* pax_buffer, ILI9341* ili9341, char* path, const char* name, const char* title, uint16_t version) { display_boot_screen(pax_buffer, ili9341, "Installing app..."); esp_err_t res; appfs_handle_t handle; @@ -70,7 +70,7 @@ void appfs_store_app(pax_buf_t* pax_buffer, ILI9341* ili9341, char* path, char* ESP_LOGI(TAG, "Application size %d", app_size); - res = appfsCreateFile(label, app_size, &handle); + res = appfsCreateFileExt(name, title, version, app_size, &handle); if (res != ESP_OK) { display_boot_screen(pax_buffer, ili9341, "Failed to create file"); ESP_LOGE(TAG, "Failed to create file on AppFS (%d)", res); diff --git a/main/file_browser.c b/main/file_browser.c index 5adf658..76f3eec 100644 --- a/main/file_browser.c +++ b/main/file_browser.c @@ -206,7 +206,7 @@ void file_browser(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili9 break; } else { printf("File selected: %s\n", menuArgs->path); - appfs_store_app(pax_buffer, ili9341, menuArgs->path, menuArgs->label); + appfs_store_app(pax_buffer, ili9341, menuArgs->path, menuArgs->label, menuArgs->label, 0); } menuArgs = NULL; render = true; diff --git a/main/include/appfs_wrapper.h b/main/include/appfs_wrapper.h index e9f4c48..da9607f 100644 --- a/main/include/appfs_wrapper.h +++ b/main/include/appfs_wrapper.h @@ -14,4 +14,4 @@ esp_err_t appfs_init(void); uint8_t* load_file_to_ram(FILE* fd, size_t* fsize); void appfs_boot_app(int fd); -void appfs_store_app(pax_buf_t* pax_buffer, ILI9341* ili9341, char* path, char* label); +void appfs_store_app(pax_buf_t* pax_buffer, ILI9341* ili9341, char* path, const char* name, const char* title, uint16_t version); diff --git a/main/menus/launcher.c b/main/menus/launcher.c index b9f204e..4ab1be1 100644 --- a/main/menus/launcher.c +++ b/main/menus/launcher.c @@ -54,11 +54,21 @@ void menu_launcher(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili appfs_fd = appfsNextEntry(appfs_fd); if (appfs_fd == APPFS_INVALID_FD) break; const char* name = NULL; - appfsEntryInfo(appfs_fd, &name, NULL); + const char* title = NULL; + uint16_t version = 0xFFFF; + appfsEntryInfoExt(appfs_fd, &name, &title, &version, NULL); menu_launcher_args_t* args = malloc(sizeof(menu_launcher_args_t)); args->fd = appfs_fd; args->action = ACTION_APPFS; - menu_insert_item(menu, name, NULL, (void*) args, -1); + + char label[64]; + if (version < 0xFFFF) { + snprintf(label, sizeof(label), "%s (r%u)", title, version); + } else { + snprintf(label, sizeof(label), "%s (dev)", title); + } + + menu_insert_item(menu, label, NULL, (void*) args, -1); } bool render = true; From 38e2475c3dfaf2103b9778599e07722fe6af227a Mon Sep 17 00:00:00 2001 From: Renze Nicolai Date: Wed, 15 Jun 2022 22:35:00 +0200 Subject: [PATCH 2/2] Update appfs component --- components/appfs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/appfs b/components/appfs index 3311e97..99865f3 160000 --- a/components/appfs +++ b/components/appfs @@ -1 +1 @@ -Subproject commit 3311e975db898f5177e6b88026489a40972a7f1f +Subproject commit 99865f35f865bbe40e2755fa71859fa479078e31