소스 검색

1、修复电源历史记录英文翻译错误;2、添加T113i及T113s表头固件保留数据和配置升级模式

liyuezong 1 년 전
부모
커밋
de4cdde4f9

+ 65 - 0
output/t113i/push2/push_retain.bat

@@ -0,0 +1,65 @@
+@ECHO OFF
+
+SET IP=192.168.1.132
+
+SET BAT=0
+IF "%~1" NEQ "" (
+    SET IP=%1
+    SET BAT=1
+)
+
+SET CURDIR=%~dp0
+SET CURDIR=%CURDIR:~0,-1%
+
+SET  TMPDIR=tmp
+SET  DEVDIR=/root
+
+SET PSCP=%CURDIR%\tools\pscp 
+SET PLINK=%CURDIR%\tools\plink
+
+SET USR=root
+SET FBAT=%CURDIR%\tools\script_retain.sh
+SET PWD=gowone123
+SET FILES=pdutar logo.png smartPDU.ini
+
+::enterin current directory
+CD %CURDIR%
+
+::copy files
+MKDIR  %TMPDIR% 2>NUL
+FOR %%x IN (%FILES%) DO (
+    XCOPY /DQY %%x  %TMPDIR%\  > NUL
+)
+
+::test ip
+ECHO ping %IP% ...
+PING -n 3 -w 500 %IP%  >NUL
+IF %ERRORLEVEL% NEQ 0 (
+    IF %BAT% EQU 0 (
+    ECHO %IP% can't reached!
+        TIMEOUT /T 2 > NUL
+    )
+    EXIT /B 1
+)
+
+::send files
+ECHO send %TMPDIR% to device ...
+ECHO  y  | %PSCP% -pw %PWD% -r %TMPDIR% %USR%@%IP%:%DEVDIR%
+IF %ERRORLEVEL% NEQ 0 (
+    ECHO send failed!
+    EXIT /B 2
+)
+
+ECHO send finished, release files now ...
+ECHO  y  | %PLINK%  -ssh -t  -pw %PWD% %USR%@%IP% -m %FBAT%
+IF %ERRORLEVEL% NEQ 0 (
+    ECHO upgrade failed!
+    EXIT /B 3
+)
+
+IF %BAT% EQU 0 (
+    ECHO quit now ...
+    TIMEOUT /T 2 > NUL
+)
+
+EXIT /B 0

+ 88 - 0
output/t113i/push2/tools/script_retain.sh

@@ -0,0 +1,88 @@
+#!/bin/sh
+
+tmpdir=tmp
+
+function is_ipv6()
+{
+    var="$1"
+    regex='^([0-9a-fA-F]{0,4}:){1,7}[0-9a-fA-F]{0,4}$'
+
+    if [[ $var =~ $regex ]]; then
+        return 1
+    else
+        return 0
+    fi
+}
+function kill_all()
+{
+    killall  RestartApp.sh smartMornitor.sh smartMonitor.sh main  snmpd  Qt_Test  smartPDU  smartUPG
+    echo V /dev/watchdog
+}
+function rm_old()
+{
+    echo rm old files ...
+    rm -f  /etc/init.d/S90PDUStart
+    rm -rf /usr/local/snmpd
+    rm -f  /usr/lib/libnetsnmp*
+    rm -f  /usr/sbin/smartMornitor.sh
+    rm -f  /usr/libmpr.so /usr/libhttp.so /usr/lib/libesp.o /usr/lib/libmodbus*
+
+    rm -rf /root/bak
+	find /root/run -type f \( -not -name "*.db" -and -not -name "*.ini" \) -exec rm -f {} +
+}
+function set_net()
+{
+   netfile=/etc/network/interfaces
+   content=$(cat $netfile)
+   
+   if [[ $content == *"address"* ]]; then
+      return
+   fi
+
+   ip4=192.168.1.132
+   mask4=255.255.255.0
+   gw4=192.168.1.1
+
+   str_lo="auto lo\niface lo inet loopback\n\n"
+   str_e0="auto eth0\niface eth0 inet static\naddress $ip4\nnetmask $mask4\ngateway $gw4\n\n"
+   str_e1="auto eth1\niface eth1 inet dhcp\npre-up /etc/network/nfs_check\nwait-delay 5\nhostname $(hostname)\n"
+   
+   echo -e $str_lo > $netfile
+   echo -e $str_e0 >> $netfile
+   echo -e $str_e1 >> $netfile
+
+   ifconfig eth0 $ip4
+}
+
+kill_all
+rm_old
+
+echo release $obj ... 
+tar -xpkf  $tmpdir/pdutar  -C  /  >/dev/null  2>&1
+if [ -e $tmpdir/logo.png ]; then
+    cp -f $tmpdir/logo.png /root/run/app/image/
+fi
+if [ -e $tmpdir/smartPDU.ini ]; then
+    cp -f $tmpdir/smartPDU.ini /root/run/app/
+    cp -f $tmpdir/smartPDU.ini /root/run/app/smartPDU_bak.ini
+    chmod 777 /root/run/app/*
+    rm -rf /root/bak/*
+fi
+rm -rf $tmpdir
+
+set_net
+
+echo +++++++ upgrade ok! +++++++
+echo  reboot device
+
+reboot -d 1
+exit 0
+
+
+
+
+
+
+
+
+

+ 46 - 0
output/t113s/push/push_retain.bat

@@ -0,0 +1,46 @@
+@ECHO OFF
+
+SET IP=192.168.1.132
+
+SET BAT=0
+IF "%~1" NEQ "" (
+    SET IP=%1
+    SET BAT=1
+)
+
+SET TARGET=pdutar
+SET CURDIR=%~dp0
+SET CURDIR=%CURDIR:~0,-1%
+
+SET  OUTDIR=%CURDIR%
+SET  DEVDIR=/mnt/UDISK
+
+SET PSCP=%CURDIR%\tools\pscp 
+SET PLINK=%CURDIR%\tools\plink
+
+SET USR=root
+SET FBAT=%CURDIR%\tools\script_retain.sh
+SET PWD=tina
+
+::send file
+ECHO send %TARGET% to device ...
+ECHO  y  | %PSCP%  -pw %PWD% %OUTDIR%\%TARGET% root@%IP%:%DEVDIR%
+IF %ERRORLEVEL% NEQ 0 (
+    ECHO send failed!
+    EXIT /B 1
+)
+
+ECHO release %TARGET%
+ECHO  y  | %PLINK%  -ssh -t  -pw %PWD% %USR%@%IP% -m %FBAT%
+IF %ERRORLEVEL% NEQ 0 (
+    ECHO upgrade failed!
+    EXIT /B 2
+)
+
+IF %BAT% EQU 0  (
+    ECHO quit now ...
+    TIMEOUT /T 2 > NUL
+)
+
+EXIT /B 0
+

+ 70 - 0
output/t113s/push/tools/script_retain.sh

@@ -0,0 +1,70 @@
+#!/bin/sh
+
+obj=pdutar
+
+function kill_proc()
+{
+    proc=$1
+    kill -9 $(ps | grep $proc | grep -v grep | awk '{print $1}')
+}
+
+function kill_all()
+{
+    kill_proc smartMonitor.sh
+    killall  RestartApp.sh smartMornitor.sh smartMonitor.sh snmpd  Qt_Test  smartPDU
+    sleep 1
+    echo V > /dev/watchdog
+    sleep 1
+    echo V > /dev/watchdog
+}
+function rm_old()
+{
+    rm -f  /etc/init.d/S90PDUStart
+    rm -rf /usr/local/snmpd
+    rm -f  /usr/lib/libnetsnmp*
+    rm -f  /usr/sbin/smartMornitor.sh
+    rm -f  /usr/libmpr.so /usr/libhttp.so /usr/lib/libesp.o /usr/lib/libmodbus*
+}
+function chg_net()
+{
+   curIP=`ifconfig eth0 |sed -n '/inet addr/s/^[^:]*:\([0-9.]\{7,15\}\) .*/\1/p'`
+   text="# interface file auto-generated by buildroot\n\
+\n\
+auto lo\n\
+iface lo inet loopback\n\
+\n\
+auto eth0\n\
+iface eth0 inet static\n\
+  address $curIP\n\
+  netmask 255.255.255.0\n\
+  gateway 192.168.1.1\n\
+\n"
+
+  echo -e $text > /etc/network/interfaces
+  ifconfig eth0 $curIP
+}
+
+
+kill_all
+#rm_old
+
+cd /mnt/UDISK
+rm -rf web fw
+find app -type f \( -not -name "*.db" -and -not -name "*.ini" \) -exec rm -f {} +
+
+echo release $obj
+tar -zxkf  $obj  -C  /  >/dev/null  2>&1
+rm -f  $obj
+
+#chg_net
+
+echo ++++ upgrade ok! ++++
+echo ++++ reboot now! ++++
+
+reboot  -d 1
+
+exit 0
+
+
+
+

+ 1 - 1
pro/src/language_common.c

@@ -120,7 +120,7 @@ const char* language_power_switch_sts_monitor[LANG_MAX] =
 const char* language_power_history_search[LANG_MAX] =
 const char* language_power_history_search[LANG_MAX] =
 {
 {
     "历史记录查询",
     "历史记录查询",
-    "Sensor status history",
+    "Power status history",
     "График энергопотребления",
     "График энергопотребления",
     "Consulta de historial",
     "Consulta de historial",
     "Consulta de histórico",
     "Consulta de histórico",

+ 4 - 0
pro/src/websocket_handle.c

@@ -17,7 +17,11 @@
 
 
 
 
 #define USE_WS2
 #define USE_WS2
+#if (CHIP_TYPE == CHIP_T113i)
 #define WS_SEND_TLEN_MAX  (1024*1024*10)
 #define WS_SEND_TLEN_MAX  (1024*1024*10)
+#else
+#define WS_SEND_TLEN_MAX  (1024*1024*5)
+#endif
 
 
 #define WS_MAX    10
 #define WS_MAX    10
 #define USE_ONE_CONN
 #define USE_ONE_CONN

+ 2 - 2
pub

@@ -259,13 +259,13 @@ function do_zip()
     if [[ "$1" == "PRJ_IP_"* ]];then
     if [[ "$1" == "PRJ_IP_"* ]];then
         zname="upgrade_"$ztm"_$name"
         zname="upgrade_"$ztm"_$name"
         zdir=$curdir/output/t113s/push
         zdir=$curdir/output/t113s/push
-        files="push.bat pdutar tools/*"
+        files="push.bat push_retain.bat pdutar tools/*"
         cd $zdir; zip -q $zname.zip $files
         cd $zdir; zip -q $zname.zip $files
         mv $zname.zip $curdir/output/t113s/
         mv $zname.zip $curdir/output/t113s/
     else
     else
         zname="upgrade_"$ztm"_$name"
         zname="upgrade_"$ztm"_$name"
         zdir=$curdir/output/t113i/push2
         zdir=$curdir/output/t113i/push2
-        files="push.bat pdutar tools/*"
+        files="push.bat push_retain.bat pdutar tools/*"
         cd $zdir; zip -q $zname.zip $files
         cd $zdir; zip -q $zname.zip $files
         mv $zname.zip $curdir/output/t113i/
         mv $zname.zip $curdir/output/t113i/
     fi
     fi