解决lnppp 因进入到睡眠状态ota下载失败问题 2558/1 2558/head 2559/target/1
authorluozheng <1732036298@qq.com>
Sun, 19 Oct 2025 09:51:47 +0000 (17:51 +0800)
committerluozheng <1732036298@qq.com>
Sun, 19 Oct 2025 09:51:47 +0000 (17:51 +0800)
code/sdk/zhihui/leiniao/imsl_ln/ln_api.c
code/sdk/zhihui/leiniao/imsl_ln/ln_api_ota.c

index f3e1142..013cc24 100644 (file)
@@ -404,9 +404,7 @@ int uapi_ln_download_file(const char *url, const char *save_path)
     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[DOWNLOAD] 开始下载: %s -> %s", url, save_path);
     g_ln_is_file_downloading = 1;
 
-    #ifdef SUPPORT_CAT1_SERVICE
     uapi_pm_add_sleep_veto(PM_ID_DEBUG);
-    #endif
 
     HttpClient client = {0};
     HttpClientData client_data = {0};
@@ -418,9 +416,7 @@ int uapi_ln_download_file(const char *url, const char *save_path)
     {
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[DOWNLOAD] fopen failed for %s", save_path);
         g_ln_is_file_downloading = 0;
-        #ifdef SUPPORT_CAT1_SERVICE
         uapi_pm_remove_sleep_veto(PM_ID_DEBUG);
-        #endif
         return ERRCODE_FAIL;
     }
 
@@ -430,9 +426,7 @@ int uapi_ln_download_file(const char *url, const char *save_path)
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[DOWNLOAD] prepare failed: %d", prep);
         fclose(fd);
         g_ln_is_file_downloading = 0;
-        #ifdef SUPPORT_CAT1_SERVICE
         uapi_pm_remove_sleep_veto(PM_ID_DEBUG);
-        #endif
         return ERRCODE_FAIL;
     }
 
@@ -444,9 +438,7 @@ int uapi_ln_download_file(const char *url, const char *save_path)
         fclose(fd);
         HttpClientUnprepare(&client_data);
         g_ln_is_file_downloading = 0;
-        #ifdef SUPPORT_CAT1_SERVICE
         uapi_pm_remove_sleep_veto(PM_ID_DEBUG);
-        #endif
         return ERRCODE_FAIL;
     }
 
@@ -459,9 +451,7 @@ int uapi_ln_download_file(const char *url, const char *save_path)
         HttpClientClse(&client);
         HttpClientUnprepare(&client_data);
         g_ln_is_file_downloading = 0;
-        #ifdef SUPPORT_CAT1_SERVICE
         uapi_pm_remove_sleep_veto(PM_ID_DEBUG);
-        #endif
         return ERRCODE_FAIL;
     }
 
@@ -483,9 +473,7 @@ int uapi_ln_download_file(const char *url, const char *save_path)
                     fclose(fd);
                     HttpClientClse(&client);
                     HttpClientUnprepare(&client_data);
-                    #ifdef SUPPORT_CAT1_SERVICE
                     uapi_pm_remove_sleep_veto(PM_ID_DEBUG);
-                    #endif
                     return ERRCODE_FAIL;
                 }
                 total_written += written;
@@ -522,9 +510,7 @@ int uapi_ln_download_file(const char *url, const char *save_path)
         {
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "删除不完整文件成功\r\n");
         }
-        #ifdef SUPPORT_CAT1_SERVICE
         uapi_pm_remove_sleep_veto(PM_ID_DEBUG);
-        #endif
     }
 
     HttpClientUnprepare(&client_data);
@@ -532,9 +518,7 @@ int uapi_ln_download_file(const char *url, const char *save_path)
     fclose(fd);
     g_ln_is_file_downloading = 0;
     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[DOWNLOAD] 下载过程结束,ret=%d", ret);
-    #ifdef SUPPORT_CAT1_SERVICE
     uapi_pm_remove_sleep_veto(PM_ID_DEBUG);
-    #endif
     return ret;
 }
 
index c0fb390..ce867d0 100644 (file)
@@ -366,9 +366,9 @@ static int ln_download_file_to_path(const char *full_url, const char *save_path,
     /* CAT1 网络保活处理 */
     cat1_api_add_cat1_vote();
     cat1_api_disable_cat1_cmd(0);
-    uapi_pm_add_sleep_veto(PM_ID_DEBUG);
     LOS_Msleep(500); // 等待模块就绪
 #endif
+    uapi_pm_add_sleep_veto(PM_ID_DEBUG);
 
     /* 初始化HTTP客户端(与http_download风格一致) */
     HttpClient client = {0};