瀏覽代碼

关键参数已分离,重新实现恢复出厂设置接口

guohui 2 年之前
父節點
當前提交
5e2e0cbc37

二進制
04-源码/03-核心板/output/out/web_temp/upgd


+ 2 - 2
04-源码/03-核心板/smart_pdu/sys/sys.c

@@ -108,10 +108,10 @@ int sys_reboot(void)
 
 
 #include "upgrade.h"
-extern int upg_send(int evt);
 int sys_set_factory(void)
 {
-    return upg_send(UPGRADE_EVT_SET_FACTORY);
+    paras_reset();
+    return system("reboot -f");
 }
 
 

+ 0 - 26
04-源码/03-核心板/upgd/upgrade.c

@@ -533,27 +533,6 @@ static int app_restart(void)
 {
     return system("/etc/init.d/S90PDUApp restart");
 }
-static int set_factory(void)
-{
-    int r=0;
-    char tmp[200];
-    char *dbPath="./run/app/pdu_dat.db";
-
-    app_stop();
-    //使用tar从压缩包提取数据库并覆盖正在使用的数据库文件
-    snprintf(tmp, sizeof(tmp), "cd %s && tar -xf %s %s && cp %s %s/ && rm -r %s", BAK_FOLDER, UPG_TAR_NAME, dbPath, RUN_FOLDER, dbPath);
-    r = system(tmp);
-    
-    snprintf(tmp, sizeof(tmp), "cp -f %s/pdu_dat.db %s/", BAK_FOLDER, RUN_FOLDER);
-    r = system(tmp);
-    if(r) {
-        LOG("sys_set_factory failed!\n");
-        return -1;
-    }
-    app_start();
-    
-    return r;
-}
 
 //////////////////////////////////////////////////
 static void* upg_thread(void *arg)
@@ -590,11 +569,6 @@ static void* upg_thread(void *arg)
             }
             break;
 
-            case UPGRADE_EVT_SET_FACTORY:
-            {
-                set_factory();
-            }
-            break;
         }
     }
 

+ 0 - 1
04-源码/03-核心板/upgd/upgrade.h

@@ -24,7 +24,6 @@
 enum {  //升级状态state
 	UPGRADE_EVT_APP_RUNNING=0x12,
 	UPGRADE_EVT_UPG_RUNNING,
-	UPGRADE_EVT_SET_FACTORY,
 	UPGRADE_EVT_UPLOAD_FINISH,