|
@@ -80,7 +80,7 @@ void substr(char *dest, const char* src, unsigned int start, unsigned int cnt);
|
|
|
|
|
|
char *portName[3] = {"/dev/ttyUSB2", "/dev/ttyUSB2", "/dev/ttyACM2"};
|
|
|
char *valid_Internet[2] = {"8.8.8.8", "180.76.76.76"};
|
|
|
-char *Version_And_Date[2] = {"V0.08","2021-02-23"};
|
|
|
+char *Version_And_Date[2] = {"V0.09","2021-03-11"};
|
|
|
pid_t pid;
|
|
|
|
|
|
struct dongle_info
|
|
@@ -227,11 +227,11 @@ int Check4GModem(void)
|
|
|
|
|
|
if(result == DONGLE_QUECTEL)
|
|
|
{
|
|
|
- DEBUG_WARN("Quectel 4G modem be found\n");
|
|
|
+ DEBUG_INFO("Quectel 4G modem be found\n");
|
|
|
}
|
|
|
else if(result == DONGLE_UBLOX)
|
|
|
{
|
|
|
- DEBUG_WARN("Ublox 4G modem be found\n");
|
|
|
+ DEBUG_INFO("Ublox 4G modem be found\n");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -879,7 +879,8 @@ int isReachableInternet(void)
|
|
|
FILE *fp;
|
|
|
char cmd[256];
|
|
|
char buf[512];
|
|
|
- //char tmp[512];
|
|
|
+ char tmp[256];
|
|
|
+ char isPppGetGw = FALSE;
|
|
|
|
|
|
for(int idx=0;idx<ARRAY_SIZE(valid_Internet);idx++)
|
|
|
{
|
|
@@ -894,9 +895,7 @@ int isReachableInternet(void)
|
|
|
//sscanf(buf, "%*s%*s%*s%*s%*s%s", tmp);
|
|
|
|
|
|
if(strstr(buf,"100%") != NULL)
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
+ {}
|
|
|
else
|
|
|
{
|
|
|
result = PASS;
|
|
@@ -906,10 +905,44 @@ int isReachableInternet(void)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
pclose(fp);
|
|
|
}
|
|
|
|
|
|
+ // Check ppp0 gateway
|
|
|
+ if(result == TRUE)
|
|
|
+ {
|
|
|
+ fp = popen("ip route", "r");
|
|
|
+ if(fp == NULL)
|
|
|
+ result = FAIL;
|
|
|
+ else
|
|
|
+ {
|
|
|
+ while(fgets(buf, sizeof(buf), fp) != NULL)
|
|
|
+ {
|
|
|
+ if((strstr(buf, "default") != NULL) && (strstr(buf, "ppp0") != NULL))
|
|
|
+ {
|
|
|
+ isPppGetGw = TRUE;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(strstr(buf, "ppp0") != NULL)
|
|
|
+ {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if((isPppGetGw == FALSE) && (strstr(buf, "ppp0") != NULL))
|
|
|
+ {
|
|
|
+ sscanf(buf, "%s", tmp);
|
|
|
+ DEBUG_INFO("ppp0 does not get default route gateway force assign to %s\n", tmp);
|
|
|
+
|
|
|
+ sprintf(cmd,"route add default gw %s ppp0 &", tmp);
|
|
|
+ system(cmd);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ pclose(fp);
|
|
|
+ memset(buf, 0x00, sizeof(buf));
|
|
|
+ }
|
|
|
+
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -1171,8 +1204,7 @@ int main(void)
|
|
|
|
|
|
for(;;)
|
|
|
{
|
|
|
- TOP:
|
|
|
-
|
|
|
+TOP:
|
|
|
switch(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomEnabled)
|
|
|
{
|
|
|
case ENABLE_4G:
|
|
@@ -1475,7 +1507,6 @@ int main(void)
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
- //sleep(SystemInterval);
|
|
|
}
|
|
|
|
|
|
return 0;
|