MOD aaa-12 解决LTE模块关闭问题

SOL
修改人:tongyebin
检视人:
This commit is contained in:
tongyebin 2019-10-11 10:30:15 +08:00
parent c39f0aa3e5
commit b542df0675
3 changed files with 10 additions and 9 deletions

View File

@ -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);

View File

@ -11,6 +11,8 @@
#include <arpa/inet.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <unistd.h>
#define INIT_CMD "/etc/ppp/ppp-4G init"
#define START_CMD "/etc/ppp/ppp-4G start"

View File

@ -40,10 +40,6 @@
DHCP_CONFIG_MODULE, \
dhcp_config_init \
}, \
{ \
LTE_CONFIG_MODULE, \
LTE_config_init \
}, \
{ \
OBJECT_MANAGER_CONFIG_MODULE, \
object_config_init \