From b542df0675a8c9cf25652bf0897dbe788157ce81 Mon Sep 17 00:00:00 2001 From: tongyebin Date: Fri, 11 Oct 2019 10:30:15 +0800 Subject: [PATCH] =?UTF-8?q?MOD=20aaa-12=20=E8=A7=A3=E5=86=B3LTE=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E5=85=B3=E9=97=AD=E9=97=AE=E9=A2=98=20SOL=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=BA=BA=EF=BC=9Atongyebin=20=E6=A3=80=E8=A7=86?= =?UTF-8?q?=E4=BA=BA=EF=BC=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../configm/config-server/LTE_config/LTE_config.c | 13 ++++++++----- .../user/configm/config-server/include/LTE_config.h | 2 ++ .../user/configm/config-server/include/configm.h | 4 ---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Platform/user/configm/config-server/LTE_config/LTE_config.c b/Platform/user/configm/config-server/LTE_config/LTE_config.c index c87647873..0d7bf8719 100644 --- a/Platform/user/configm/config-server/LTE_config/LTE_config.c +++ b/Platform/user/configm/config-server/LTE_config/LTE_config.c @@ -3,6 +3,7 @@ #include "parsefile.h" #include "LTE_config.h" + int g_action = 0; ret_code compare(char *result) @@ -207,7 +208,7 @@ ret_code start_lte() { while(i < 120) { - if(access(file_path,0) != 0) + if(access(file_path,0) != -1) { sleep(1000); i ++; @@ -257,7 +258,7 @@ ret_code stop_lte() return RET_ALREADY_STOP_ERR; } - else if((strstr(result,"stop pppd ppp0") != NULL) && access(file_path,0) != 0) + else if((strstr(result,"stop pppd ppp0") != NULL) && access(file_path,0) != -1) { pclose(f); return RET_OK; @@ -307,7 +308,7 @@ ret_code restart_lte() { while(i < 120) { - if(access(file_path,0) != 0) + if(access(file_path,0) != -1) { sleep(1000); i ++; @@ -386,8 +387,9 @@ ret_code status_lte(pointer output, int *output_len) rpc_log_info("execuate cmd fail\n"); return RET_EXEC_SHELL_ERR; } - + fgets(result,sizeof(result),f); + rpc_log_info("%s\n",result); if(strstr(result,"off") != NULL) { strcpy(status,"off"); @@ -399,8 +401,9 @@ ret_code status_lte(pointer output, int *output_len) else if(strstr(result,"on") != NULL) { strcpy(status,"on"); - memcpy(result,0,sizeof(result)); + memset(result,0,sizeof(result)); fgets(result,sizeof(result),f); + rpc_log_info("%s\n",result); sscanf(result,"ppp_keep_time=%d",&connect_time); ret = lte_to_json(status,connect_time,output,output_len); pclose(f); diff --git a/Platform/user/configm/config-server/include/LTE_config.h b/Platform/user/configm/config-server/include/LTE_config.h index f49c83bbe..f5a972701 100644 --- a/Platform/user/configm/config-server/include/LTE_config.h +++ b/Platform/user/configm/config-server/include/LTE_config.h @@ -11,6 +11,8 @@ #include #include #include +#include + #define INIT_CMD "/etc/ppp/ppp-4G init" #define START_CMD "/etc/ppp/ppp-4G start" diff --git a/Platform/user/configm/config-server/include/configm.h b/Platform/user/configm/config-server/include/configm.h index 29432780e..20c71e8b2 100755 --- a/Platform/user/configm/config-server/include/configm.h +++ b/Platform/user/configm/config-server/include/configm.h @@ -40,10 +40,6 @@ DHCP_CONFIG_MODULE, \ dhcp_config_init \ }, \ - { \ - LTE_CONFIG_MODULE, \ - LTE_config_init \ - }, \ { \ OBJECT_MANAGER_CONFIG_MODULE, \ object_config_init \