20190725_jeffrey - silenceuncrio/diary GitHub Wiki

0915

M300[feature/hinet_evaluate] 這案子八月底前我們會給出一版 firmwmare

由 CTCU upgrade 到 ICR-4103 上面

我想我該修一下 profile 18_HINET_EVALUATE 裡的內容

讓 ICR-4103 能夠 upgrade 成這一版的軟體

commit 62e13157c1cb412367ec1ec6c66d1c27705d7117
Refs: [feature/hinet_evaluate], {origin/feature/hinet_evaluate}
Author: jeffrey <[email protected]>
Date:   Thu Jul 25 09:27:40 2019 +0800

    copy the content of the profile from 4_CTCU to 18_HINET_EVALUATE
    - then the device ICR-4103 can upgrade to the firmware generated by the profile 18_HINET_EVALUATE

 .../configs/M300/18_HINET_EVALUATE/defconfig       | 34 +++++++++++-----------
 1 file changed, 17 insertions(+), 17 deletions(-)

試著 build 一版看看


mfgtool 燒錄

開機確認一下 web ui

不能 login

跟昨天 M330 問題一樣

修一下 login 順便讓它轉一下好了


commit e0b7ec06358cf97bd7eb78702f6ef4ea3f797507
Refs: [feature/hinet_evaluate], {origin/feature/hinet_evaluate}
Author: jeffrey <[email protected]>
Date:   Thu Jul 25 10:18:27 2019 +0800

    correct the `api/login` handler because some profile with user/pass = admin/<empty>

    correct the spinner at the 'Login' button

 proscend/prosrc/webcgi/jweb.c            | 6 ++++++
 proscend/prosrc/www/app/feature/login.js | 3 +++
 2 files changed, 9 insertions(+)

1035

臨時開會後多了一些工作

  • M330 要做 multi-user
  • M300[feature/hinet_evaluate] 併回 M300[develop]

➜  M300 git:(feature/hinet_evaluate) ✗ git flow feature finish
Switched to branch 'develop'
Your branch is up-to-date with 'origin/develop'.
Merge made by the 'recursive' strategy.
 proscend/base_fs/default/rootfs/home/factory/icos/gre_2g/gre_2g.json |  25 ++++++++
 proscend/mconfig/Config.in                                           |   1 +
 proscend/mconfig/configs/M300/18_HINET_EVALUATE/defconfig            | 162 ++++++++++++++++++++++++++++++++++++++++++++++++
 proscend/prosrc/icos/icoslib/Makefile                                |   4 ++
 proscend/prosrc/icos/icoslib/entry.c                                 |   7 +++
 proscend/prosrc/icos/icoslib/gre_2g/Makefile                         |  14 +++++
 proscend/prosrc/icos/icoslib/gre_2g/gre_2g.c                         | 457 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 proscend/prosrc/icos/include/icos_common.h                           |   1 +
 proscend/prosrc/icos/include/icos_module.h                           |   1 +
 proscend/prosrc/icos/include/module_gre_2g.h                         |  36 +++++++++++
 proscend/prosrc/webcgi/Makefile                                      |   4 ++
 proscend/prosrc/webcgi/gre_2g.c                                      | 105 +++++++++++++++++++++++++++++++
 proscend/prosrc/www/app/feature/gre_2g.html                          | 221 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 proscend/prosrc/www/app/feature/gre_2g.js                            |  63 +++++++++++++++++++
 proscend/prosrc/www/app/feature/login.js                             |   3 +
 proscend/prosrc/www/app/locale-en.json                               |  17 +++++
 proscend/prosrc/www/app/locale-fr.json                               |  17 +++++
 proscend/prosrc/www/app/locale-zh-tw.json                            |  17 +++++
 proscend/prosrc/www/app/services/icos.service.js                     |   9 +++
 proscend/prosrc/www/src/index.html.src                               |   1 +
 proscend/prosrc/www/src/menu.html.src                                |   3 +
 21 files changed, 1168 insertions(+)
 create mode 100644 proscend/base_fs/default/rootfs/home/factory/icos/gre_2g/gre_2g.json
 create mode 100644 proscend/mconfig/configs/M300/18_HINET_EVALUATE/defconfig
 create mode 100644 proscend/prosrc/icos/icoslib/gre_2g/Makefile
 create mode 100644 proscend/prosrc/icos/icoslib/gre_2g/gre_2g.c
 create mode 100644 proscend/prosrc/icos/include/module_gre_2g.h
 create mode 100644 proscend/prosrc/webcgi/gre_2g.c
 create mode 100644 proscend/prosrc/www/app/feature/gre_2g.html
 create mode 100644 proscend/prosrc/www/app/feature/gre_2g.js
To [email protected]:RD/M300.git
 - [deleted]         feature/hinet_evaluate
Deleted branch feature/hinet_evaluate (was e0b7ec0).

Summary of actions:
- The feature branch 'feature/hinet_evaluate' was merged into 'develop'
- Feature branch 'feature/hinet_evaluate' has been locally deleted; it has been remotely deleted from 'origin'
- You are now on branch 'develop'

M300[develop] - Merge branch 'feature/hinet_evaluate' into develop

commit 98d7ac11b217321802584fffd926dc03aa33bd96
Refs: [develop]
Merge: 5762c6b e0b7ec0
Author: jeffrey <[email protected]>
Date:   Thu Jul 25 10:36:46 2019 +0800

    Merge branch 'feature/hinet_evaluate' into develop

 .../rootfs/home/factory/icos/gre_2g/gre_2g.json    |  25 ++
 proscend/mconfig/Config.in                         |   1 +
 .../configs/M300/18_HINET_EVALUATE/defconfig       | 162 ++++++++
 proscend/prosrc/icos/icoslib/Makefile              |   4 +
 proscend/prosrc/icos/icoslib/entry.c               |   7 +
 proscend/prosrc/icos/icoslib/gre_2g/Makefile       |  14 +
 proscend/prosrc/icos/icoslib/gre_2g/gre_2g.c       | 457 +++++++++++++++++++++
 proscend/prosrc/icos/include/icos_common.h         |   1 +
 proscend/prosrc/icos/include/icos_module.h         |   1 +
 proscend/prosrc/icos/include/module_gre_2g.h       |  36 ++
 proscend/prosrc/webcgi/Makefile                    |   4 +
 proscend/prosrc/webcgi/gre_2g.c                    | 105 +++++
 proscend/prosrc/www/app/feature/gre_2g.html        | 221 ++++++++++
 proscend/prosrc/www/app/feature/gre_2g.js          |  63 +++
 proscend/prosrc/www/app/feature/login.js           |   3 +
 proscend/prosrc/www/app/locale-en.json             |  17 +
 proscend/prosrc/www/app/locale-fr.json             |  17 +
 proscend/prosrc/www/app/locale-zh-tw.json          |  17 +
 proscend/prosrc/www/app/services/icos.service.js   |   9 +
 proscend/prosrc/www/src/index.html.src             |   1 +
 proscend/prosrc/www/src/menu.html.src              |   3 +
 21 files changed, 1168 insertions(+)

1040

M300[develop]

這樣就可以把 profile 18_HINET_EVALUATE 刪掉

並修正每個 profile

  • turn off PROSRC_GRE
  • turn on PROSRC_GRE_2G

M300[develop] - at all profiles: for GRE

commit b16e0fadc7763235a041614429271835e169d42b
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Thu Jul 25 10:54:36 2019 +0800

    at all profiles: for GRE
    - turn off PROSRC_GRE
    - turn on PROSRC_GRE_2G

    remove profile M300/18_HINET_EVALUATE/defconfig

 .../mconfig/configs/Azuretec/0_OLTRG100/defconfig  |   3 +-
 .../mconfig/configs/Azuretec/1_OLTRG101/defconfig  |   3 +-
 .../mconfig/configs/Azuretec/2_OLTRG100X/defconfig |   3 +-
 .../mconfig/configs/LITE/0_GPS_XENTINO/defconfig   |   3 +-
 proscend/mconfig/configs/LITE/1_GPS/defconfig      |   3 +-
 proscend/mconfig/configs/M300/0_GENERIC/defconfig  |   3 +-
 .../mconfig/configs/M300/10_GPS_HYTEC/defconfig    |   3 +-
 proscend/mconfig/configs/M300/11_SIERRA/defconfig  |   3 +-
 proscend/mconfig/configs/M300/12_XENTINO/defconfig |   3 +-
 .../mconfig/configs/M300/13_XENTINO_GPS/defconfig  |   3 +-
 .../mconfig/configs/M300/14_NAUTILUS/defconfig     |   3 +-
 .../configs/M300/15_SIERRA_TELWELL/defconfig       |   3 +-
 .../mconfig/configs/M300/16_MTK_WIFI/defconfig     |   3 +-
 .../mconfig/configs/M300/17_LAN_ADVICE/defconfig   |   3 +-
 .../configs/M300/18_HINET_EVALUATE/defconfig       | 162 ---------------------
 proscend/mconfig/configs/M300/1_GPS/defconfig      |   3 +-
 proscend/mconfig/configs/M300/2_PLANET/defconfig   |   3 +-
 .../mconfig/configs/M300/3_GPS_PLANET/defconfig    |   3 +-
 proscend/mconfig/configs/M300/4_CTCU/defconfig     |   3 +-
 .../configs/M300/5_XENTINO_MR401G/defconfig        |   3 +-
 proscend/mconfig/configs/M300/6_CXR/defconfig      |   3 +-
 proscend/mconfig/configs/M300/7_GPS_CXR/defconfig  |   3 +-
 .../mconfig/configs/M300/8_GPS_ADVICE/defconfig    |   3 +-
 .../mconfig/configs/M300/9_GPS_TELEWELL/defconfig  |   3 +-
 proscend/mconfig/configs/M300E/1_GPS/defconfig     |   3 +-
 .../configs/M300E/2_AZURETEC_LTRG101/defconfig     |   3 +-
 .../mconfig/configs/M300E/3_GPS_XENTINO/defconfig  |   3 +-
 .../mconfig/configs/M300E/4_MTK_WIFI/defconfig     |   3 +-
 28 files changed, 54 insertions(+), 189 deletions(-)

一樣先 base on profile M300/4_CTCU/defconfig build 個 image 試試

1140

GRE 的連線狀況需要呼叫 ICOS_shm_status_update(SHM_GRE_CONN_NUM, conn_num , NULL) 更新目前的連線數目

diff --git a/proscend/prosrc/icos/icoslib/gre_2g/gre_2g.c b/proscend/prosrc/icos/icoslib/gre_2g/gre_2g.c
index 59c9cdd..0cf7e13 100644
--- a/proscend/prosrc/icos/icoslib/gre_2g/gre_2g.c
+++ b/proscend/prosrc/icos/icoslib/gre_2g/gre_2g.c
@@ -253,7 +253,7 @@ static int _apply(int flag, int index, void* pStruct, int structSize)
         IPTF_I("%s -p %d -j ACCEPT", GRE_2G_IPT_INPUT_CHAIN, 47);

         char cmd_buf[128];
-        int one_tunnel_on = 0;
+        int conn_num = 0;

         // tear down the GRE tunnels - gre1 and gre2
         system("ip link set gre1 down 1>/dev/null 2>&1");
@@ -265,7 +265,7 @@ static int _apply(int flag, int index, void* pStruct, int structSize)
         {
             if (setting->tunnels[i].mode == ATTVAL_MODE_ON)
             {
-                one_tunnel_on = 1;
+                conn_num ++;

                 // create gre tunnel
                 if (setting->tunnels[i].key_mode == ATTVAL_MODE_ON)
@@ -304,9 +304,11 @@ static int _apply(int flag, int index, void* pStruct, int structSize)
             }
         }

-        if (one_tunnel_on == 1)
+        if (conn_num != 0)
         {
             ICOS_broadcast(MODULE_GRE, NULL, 0, ICOS_GRE_MODE_ON);
+            ICOS_shm_status_update(SHM_GRE_CONN_NUM, conn_num , NULL);
+
         }
     }
     else

build 個 image 試一下

1315

M330[release/v0.05] 從台灣透過 lte 對遠在北海道的 M330 做 firmware upgrade 時

因為上傳檔案的時間要很久

導致 session timeout 了

login 之後又要重做 firmware upgrade


拉一版最新的 M330[release/v0.05]

  • profile = (HYTEC/0_HYTEC) Vendor/Products

build image

upgrade from uboot

開機

1415

照著自己的想法改了一版

diff --git a/proscend/prosrc/webcgi/api.c b/proscend/prosrc/webcgi/api.c
index 789dfd6..e1b32eb 100644
--- a/proscend/prosrc/webcgi/api.c
+++ b/proscend/prosrc/webcgi/api.c
@@ -31,6 +31,14 @@ int main(void)
     {
         jweb.api.upload_file(UPLOAD_PATH_FIRMWARE);
     }
+    else if (STRCMP(jweb.in.act, "firmwareUploadingStart"))
+    {
+        jweb.api.firmware_uploading_start();
+    }
+    else if (STRCMP(jweb.in.act, "firmwareUploadingFinish"))
+    {
+        jweb.api.firmware_uploading_finish();
+    }
     else if (STRCMP(jweb.in.act, "configurationUpload"))
     {
         jweb.api.upload_file(UPLOAD_PATH_CONFIGURATION);
diff --git a/proscend/prosrc/webcgi/jweb.c b/proscend/prosrc/webcgi/jweb.c
index af1c900..2da0d9f 100644
--- a/proscend/prosrc/webcgi/jweb.c
+++ b/proscend/prosrc/webcgi/jweb.c
@@ -21,6 +21,8 @@
 static void api_login(void);
 static void api_logout(void);
 static void api_upload_file(const char *path);
+static void api_firmware_uploading_start(void);
+static void api_firmware_uploading_finish(void);



@@ -176,6 +178,20 @@ static void api_upload_file(const char *path)



+static void api_firmware_uploading_start(void)
+{
+    mkdir(FIRMWARE_UPLOADING_INDICATOR, 0755);
+}
+
+
+
+static void api_firmware_uploading_finish(void)
+{
+    rmdir(FIRMWARE_UPLOADING_INDICATOR);
+}
+
+
+



@@ -369,6 +385,21 @@ static session_t *get_session(void)
 /* Cleans up sessions that have been idle for too long. */
 static void check_sessions(void)
 {
+    struct stat st;
+
+    if (stat(FIRMWARE_UPLOADING_INDICATOR, &st) < 0)
+    {
+        // the fimeware is not uploading currently
+    }
+    else
+    {
+        /*
+        ** since we has no idea the firmware uploading rate(lan or wan, slow or fast)
+        ** so in this moment, the device should not to check sessions if that have been idle for too long
+        */
+        return;
+    }
+
     // The session checking will be disalbed when the TTL be zero.
     if (Icos_users.session_ttl == 0)
     {
@@ -866,6 +897,8 @@ jweb_t jweb =
     .api.login = api_login,
     .api.logout = api_logout,
     .api.upload_file = api_upload_file,
+    .api.firmware_uploading_start = api_firmware_uploading_start,
+    .api.firmware_uploading_finish = api_firmware_uploading_finish,

 };

diff --git a/proscend/prosrc/webcgi/jweb.h b/proscend/prosrc/webcgi/jweb.h
index 25bfd1e..a996fc8 100644
--- a/proscend/prosrc/webcgi/jweb.h
+++ b/proscend/prosrc/webcgi/jweb.h
@@ -50,6 +50,15 @@



+/*
+** use this dir to indicate that fimeware is uploading currently
+** since we has no idea the uploading rate(lan or wan, slow or fast)
+** so in this moment, the device should not to check sessions if that have been idle for too long
+*/
+#define FIRMWARE_UPLOADING_INDICATOR "/tmp/firmware_uploading_indicator"
+
+
+



@@ -155,6 +164,8 @@ typedef struct
         void    (*login)(void);
         void    (*logout)(void);
         void    (*upload_file)(const char *path);
+        void    (*firmware_uploading_start)(void);
+        void    (*firmware_uploading_finish)(void);
     } api;


diff --git a/proscend/prosrc/www/app/feature/firmware.js b/proscend/prosrc/www/app/feature/firmware.js
index 22086fa..5eb3a63 100644
--- a/proscend/prosrc/www/app/feature/firmware.js
+++ b/proscend/prosrc/www/app/feature/firmware.js
@@ -26,7 +26,7 @@ function config($routeProvider) {

 angular.module('app').controller('firmwareController', firmwareController);

-function firmwareController($scope, $timeout, $route, $location, icos, Upload, progress) {
+function firmwareController($http, $scope, $timeout, $route, $location, icos, Upload, progress) {
     var vm = this;

     vm.progress = progress;
@@ -39,9 +39,14 @@ function firmwareController($scope, $timeout, $route, $location, icos, Upload, p
     ** total 28 + 56 = 84 seconds = 100%
     ** 1% = 0.84 seconds
     ** 1 second = 1.2%
+    **
+    ** since we has no idea the uploading rate(lan or wan, slow or fast)
+    ** so 1% = 0.84 seconds is the fast one
+    ** we suppose the slow one is 1% = 3 seconds
+    ** but total part of the upload is the same 33%
     */
     vm.timeout_uploading = function () {
-        timer_uploading = $timeout(840);
+        timer_uploading = $timeout(3000);
         timer_uploading.then(function () {
             if (vm.progress_valuenow < 33) {
                 vm.progress_valuenow += 1;
@@ -66,8 +71,23 @@ function firmwareController($scope, $timeout, $route, $location, icos, Upload, p

             vm.timeout_uploading();

+            /*
+            ** since we has no idea the uploading rate(lan or wan, slow or fast)
+            ** so in this moment, the device should not to check sessions if that have been idle for too long
+            ** use this api to indicate the firmware uploading start
+            */
+            $http.get('/api/firmwareUploadingStart');
+
             Upload.upload({ url: 'api/firmwareUpload', data: data })
             .then(function(resp) {
+
+                /*
+                ** since we has no idea the uploading rate(lan or wan, slow or fast)
+                ** so in this moment, the device should not to check sessions if that have been idle for too long
+                ** use this api to indicate the firmware uploading finish
+                */
+                $http.get('/api/firmwareUploadingFinish');
+
                 vm.progress = resp.data.info;
                 return icos.firmware.upgrade();
             })

build 個 image 試試


走 wan ethernet 利用 HTTPS 試試

透過 HTTPS upload firmware 花了 50 秒

第一次成功

而且在這 50 秒鐘也發現到 /tmp/firmware_uploading_indicator 這個 indicator

多試個幾次再 commit

第二次 一樣是走 wan ethernet 透過 HTTPS 做 firmware upgrade


M330[release/v0.05] - improve the firmware upgrade via HTTP/HTTPS

commit 44d4299de568459931e2f6f26e47bd27ab1e1263
Refs: [release/v0.05], {origin/release/v0.05}
Author: jeffrey <[email protected]>
Date:   Thu Jul 25 14:33:33 2019 +0800

    improve the firmware upgrade via HTTP/HTTPS
    - since we has no idea the uploading rate(lan or wan, slow or fast)
    - so in this moment, the device should not to check sessions if that have been idle for too long
    - slow the progress speed while uploading but total uploading par is the same at progress bar

 proscend/prosrc/webcgi/api.c                |  8 +++++++
 proscend/prosrc/webcgi/jweb.c               | 33 +++++++++++++++++++++++++++++
 proscend/prosrc/webcgi/jweb.h               | 11 ++++++++++
 proscend/prosrc/www/app/feature/firmware.js | 24 +++++++++++++++++++--
 4 files changed, 74 insertions(+), 2 deletions(-)

1445

回到 M300[develop]

GRE 建兩個 tunnel 後的確有反應在 status page


M300[develop] - update the GRE connection number at 'Status' page

commit f741dd7079b5c28557614e94e4f2385b4682f1cc
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Thu Jul 25 14:48:24 2019 +0800

    update the GRE connection number at 'Status' page

 proscend/prosrc/icos/icoslib/gre_2g/gre_2g.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

1540

實際觀察 M330[release/v0.05] 從台灣透過 lte 對遠在北海道的 M330 做 firmware upgrade

上傳檔案的時間要 8 ~ 10 分鐘


M330[release/v0.05] - improve the firmware upgrade via HTTP/HTTPS again

commit 64a8d89013787e828d4a053805b1daa21f241fb3
Refs: [release/v0.05], {origin/release/v0.05}
Author: jeffrey <[email protected]>
Date:   Thu Jul 25 17:06:12 2019 +0800

    improve the firmware upgrade via HTTP/HTTPS again
    - use very slow speed(1% per 10 seconds) to show the progress until uploading finished(40%)

 proscend/prosrc/www/app/feature/firmware.js | 68 +++++++++++++++--------------
 1 file changed, 36 insertions(+), 32 deletions(-)

1740

M300 收到需求

之前為了某客戶做的可自行換 logo 的功能 - PROSRC_CUSTOMIZE

希望全部開放

不過像 planet 和 CTCU 都有特別為了他們 logo 去調 CSS

有些 profile 真的適合換圖嗎

明天來盤一下

1820

M330[release/v0.05] - add 'active-image' field at cli path 'mgmt info list'

commit 2a9b9b59f98387775d0df0edfceba4104cee4ec0
Refs: [release/v0.05], {origin/release/v0.05}
Author: jeffrey <[email protected]>
Date:   Thu Jul 25 18:19:22 2019 +0800

    add 'active-image' field at cli path 'mgmt info list'

 proscend/prosrc/icos/clishell/cli_mgmt_identification.c | 7 +++++++
 1 file changed, 7 insertions(+)
⚠️ **GitHub.com Fallback** ⚠️