Browse Source

2020.05.20 / TC Hsu

Actions: Add client hostname parameter with system id to udhcpc command in InitEthernet() function of main.c

Image version    : N/A
Image checksum   : N/A

Hardware PWB P/N : N/A
Hardware Version : N/A

Files:

	modified:   EVSE/Projects/DM30/Apps/main.c
TC_Hsu 4 years ago
parent
commit
ed2e91dace
1 changed files with 6 additions and 1 deletions
  1. 6 1
      EVSE/Projects/DM30/Apps/main.c

+ 6 - 1
EVSE/Projects/DM30/Apps/main.c

@@ -873,9 +873,14 @@ void InitEthernet()
     system("echo nameserver 180.76.76.76 > /etc/resolv.conf");  //Baidu DNS server
 
     if(ShmSysConfigAndInfo->SysConfig.Eth1Interface.EthDhcpClient == 0)
-        system("/sbin/udhcpc -i eth0 -s /root/dhcp_script/eth0.script > /dev/null &");
+    {
+        memset(tmpbuf,0,256);
+        sprintf(tmpbuf, "/sbin/udhcpc -i eth0 -x hostname:CSU3_%s -s /root/dhcp_script/eth0.script > /dev/null &", ShmSysConfigAndInfo->SysConfig.SystemId);
+        system(tmpbuf);
+    }
 
     //Upgrade system id to /etc/hostname
+    memset(tmpbuf,0,256);
     sprintf(tmpbuf, "echo %s > /etc/hostname", ShmSysConfigAndInfo->SysConfig.SystemId);
     system(tmpbuf);