|
@@ -46,6 +46,7 @@ void substr(char *dest, const char* src, unsigned int start, unsigned int cnt);
|
|
|
void split(char **arr, char *str, const char *del);
|
|
|
|
|
|
int isReachableInternet();
|
|
|
+int isRouteFail();
|
|
|
int InitRfidPort(void);
|
|
|
int GetCardSerialNumber();
|
|
|
void setLedMotion(unsigned char gun_index,unsigned char led_mode);
|
|
@@ -969,6 +970,19 @@ void InitEthernet()
|
|
|
{
|
|
|
for(;;)
|
|
|
{
|
|
|
+ if(isRouteFail())
|
|
|
+ {
|
|
|
+ DEBUG_ERROR("eth0 not in route, restart eth0.\n");
|
|
|
+ system("/sbin/ifconfig eth0 down;/sbin/ifconfig eth0 up");
|
|
|
+
|
|
|
+ if((ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient==0))
|
|
|
+ {
|
|
|
+ system("pgrep -f \"udhcpc -i eth0\" | xargs kill");
|
|
|
+ sprintf(tmpbuf, "/sbin/udhcpc -i eth0 -x hostname:CSU3_%s -s /root/dhcp_script/eth0.script > /dev/null &", ShmSysConfigAndInfo->SysConfig.SystemId);
|
|
|
+ system(tmpbuf);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if(isReachableInternet() == PASS)
|
|
|
{
|
|
|
ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaEthernet=OFF;
|
|
@@ -978,15 +992,7 @@ void InitEthernet()
|
|
|
{
|
|
|
if(cnt_pingDNS_Fail >= 3)
|
|
|
{
|
|
|
- ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaEthernet=ON;
|
|
|
-
|
|
|
- if((ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthDhcpClient==0) && (cnt_pingDNS_Fail == 3))
|
|
|
- {
|
|
|
- cnt_pingDNS_Fail++;
|
|
|
- system("pgrep -f \"udhcpc -i eth0\" | xargs kill");
|
|
|
- sprintf(tmpbuf, "/sbin/udhcpc -i eth0 -x hostname:CSU3_%s -s /root/dhcp_script/eth0.script > /dev/null &", ShmSysConfigAndInfo->SysConfig.SystemId);
|
|
|
- system(tmpbuf);
|
|
|
- }
|
|
|
+ ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaEthernet=ON;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -1249,7 +1255,7 @@ void get_firmware_version(unsigned char gun_index)
|
|
|
strcpy((char*)ShmSysConfigAndInfo->SysInfo.CsuPrimFwRev, ShmCharger->gun_info[gun_index].ver.Version_FW);
|
|
|
|
|
|
// Get CSU root file system version
|
|
|
- sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "V0.55.00.0000.00");
|
|
|
+ sprintf((char*)ShmSysConfigAndInfo->SysInfo.CsuRootFsFwRev, "V0.56.00.0000.00");
|
|
|
|
|
|
// Get AC connector type from model name
|
|
|
for(uint8_t idx=0;idx<3;idx++)
|
|
@@ -1760,6 +1766,29 @@ int isReachableInternet()
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+//===============================================
|
|
|
+// Check route for eth0
|
|
|
+//===============================================
|
|
|
+int isRouteFail()
|
|
|
+{
|
|
|
+ int result = YES;
|
|
|
+ FILE *fp;
|
|
|
+ char buf[512];
|
|
|
+
|
|
|
+ fp = popen("route -n", "r");
|
|
|
+ if(fp != NULL)
|
|
|
+ {
|
|
|
+ while(fgets(buf, sizeof(buf), fp) != NULL)
|
|
|
+ {
|
|
|
+ if(strstr(buf, "eth0") != NULL)
|
|
|
+ result = NO;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ pclose(fp);
|
|
|
+
|
|
|
+ return result;
|
|
|
+}
|
|
|
+
|
|
|
//===============================================
|
|
|
// Check reservation date is expired
|
|
|
//===============================================
|