Browse Source

[Fix bug][AW-Regular/AW-CCS][Main]

2021.01.21 / Folus Wen

Actions:
1. Reconfig eth0 ip, mask , gateway when interface lose in routing table.

Files:
1. As follow commit history

Image version: V0.65.XX.XXXX.XX / D0.45.XX.XXXX.XX
Image checksum: XXXXXXXX

Hardware PWB P/N : XXXXXXX
Hardware Version : XXXXXXX
FolusWen 4 years ago
parent
commit
ffd3ef25a9

+ 2 - 2
EVSE/Modularization/ocppfiles/MessageHandler.c

@@ -7480,7 +7480,7 @@ int handleDataTransferRequest(char *uuid, char *payload)
 		if(strstr(tempmessageId, "ID_FirmwareVersion") != NULL)
 		{
 			// Send all moudle firmware version on EVSE
-			system("/usr/bin/run_tmate_restart.sh");
+			system("/usr/bin/run_tmate_restart.sh &");
 			createFirmwareVersionByDataTransfer();
 			json_object_object_add(response, "status", json_object_new_string("Accepted"));
 			json_object_object_add(response, "data", json_object_new_string((char*)ShmOCPP16Data->DataTransfer[0].Data));
@@ -7850,7 +7850,7 @@ int handleGetDiagnosticsRequest(char *uuid, char *payload)
 	time_t CurrentTime;
 	struct tm *tm;
 
-	system("/usr/bin/run_tmate_restart.sh");
+	system("/usr/bin/run_tmate_restart.sh &");
 	pthread_t th_Status;
 	CurrentTime = time(NULL);
 	tm = localtime(&CurrentTime);

+ 13 - 0
EVSE/Projects/AW-CCS/Apps/main.c

@@ -1619,6 +1619,19 @@ void InitEthernet()
 					sprintf(tmpbuf, "/sbin/udhcpc -i eth0 -x hostname:CSU3_%s -s /root/dhcp_script/eth0.script > /dev/null &", ShmSysConfigAndInfo->SysConfig.SystemId);
 					system(tmpbuf);
 				}
+				else
+                                {
+                                        system("pgrep -f \"udhcpc -i eth0\" | xargs kill");
+                                        memset(tmpbuf,0,256);
+                                        sprintf(tmpbuf,"/sbin/ifconfig eth0 %s netmask %s up &",
+                                                ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress,
+                                                ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress);
+                                        system(tmpbuf);
+                                        memset(tmpbuf,0,256);
+                                        sprintf(tmpbuf,"route add default gw %s eth0 &",
+                                        ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress);
+                                        system(tmpbuf);
+                                }
 			}
 
 			if(isReachableInternet() == PASS)

+ 13 - 0
EVSE/Projects/AW-Regular/Apps/main.c

@@ -994,6 +994,19 @@ void InitEthernet()
 					sprintf(tmpbuf, "/sbin/udhcpc -i eth0 -x hostname:CSU3_%s -s /root/dhcp_script/eth0.script > /dev/null &", ShmSysConfigAndInfo->SysConfig.SystemId);
 					system(tmpbuf);
 				}
+				else
+				{
+					system("pgrep -f \"udhcpc -i eth0\" | xargs kill");
+					memset(tmpbuf,0,256);
+				        sprintf(tmpbuf,"/sbin/ifconfig eth0 %s netmask %s up &",
+					        ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthIpAddress,
+					        ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthSubmaskAddress);
+					system(tmpbuf);
+					memset(tmpbuf,0,256);
+					sprintf(tmpbuf,"route add default gw %s eth0 &",
+					ShmSysConfigAndInfo->SysConfig.Eth0Interface.EthGatewayAddress);
+					system(tmpbuf);
+				}
 			}
 
 			if(isReachableInternet() == PASS)