From: cheng Date: Sun, 21 Sep 2025 10:24:44 +0000 (+0800) Subject: ota文件路径采用统一宏 X-Git-Tag: leiniao_debug_1.0.0_20250922_020716~9 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=61a50362104b5800f5d39b6de369266d5529a4aa;p=mirrors%2FFD230.git ota文件路径采用统一宏 --- diff --git a/code/sdk/zhihui/leiniao/imsl_ln/ln_api_ota.c b/code/sdk/zhihui/leiniao/imsl_ln/ln_api_ota.c index c26defe67..9afb1cda1 100644 --- a/code/sdk/zhihui/leiniao/imsl_ln/ln_api_ota.c +++ b/code/sdk/zhihui/leiniao/imsl_ln/ln_api_ota.c @@ -1,6 +1,7 @@ #include "ln_api.h" #include #include +#include "upg_common_porting.h" /* 使用统一的 UPG_FILE_NAME 路径宏 */ #include #include @@ -153,7 +154,7 @@ static int ln_download_file_to_path(const char *full_url, const char *save_path, } // 打开文件准备写入 - FILE *fd = fopen(save_path, "wb"); + FILE *fd = fopen(save_path, "wb+"); if (!fd) { printf("[OTA] fopen failed for %s:\n", save_path); @@ -194,7 +195,7 @@ static int ln_download_file_to_path(const char *full_url, const char *save_path, do { ret = HttpClientRecvResponse(&client, &client_data); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ln_ota_download_flow_http", "ret = %d", ret); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ln_ota_download_flow_http:%d", ret); if (ret == HTTP_SUCCESS || ret == HTTP_EAGAIN) { // 处理接收到的数据块 @@ -293,13 +294,15 @@ uint32_t ln_ota_download_flow_http(const char *device_id, printf("[OTA] no cached task to download, please GET_TASK first\n"); return ERRCODE_FAIL; } - size_t sp_cap = strlen(LN_OTA_SAVE_DIR) + 1 + strlen(g_ln_last_target_version) + strlen(".fwpkg") + 1; + /* 固定保存到统一升级包路径 */ + size_t sp_cap = strlen(UPG_FILE_NAME) + 1; + printf("UPG_FILE_NAME:%s\n",UPG_FILE_NAME); char *save_path = (char *)malloc(sp_cap); if (!save_path) { return ERRCODE_FAIL; } - snprintf(save_path, sp_cap, LN_OTA_SAVE_DIR "/%s.fwpkg", g_ln_last_target_version); + (void)snprintf(save_path, sp_cap, "%s", UPG_FILE_NAME); if (g_ln_last_saved_path) { free(g_ln_last_saved_path);