20170815_jeffrey - silenceuncrio/diary GitHub Wiki

0910

繼續來寫 ripd icos module

0930

commit 2459321acfda3a82ab3cc8ced2dadfbcb3f2eb12
Author: jeffrey <[email protected]>
Date:   Tue Aug 15 09:33:46 2017 +0800

    'RIP' ICOS Module implementing
    - let the proscend 'make menuconfig' recognize it

 proscend/mconfig/Config.in                           | 2 +-
 proscend/mconfig/configs/M300/0_GENERIC/defconfig    | 2 +-
 proscend/mconfig/configs/M300/1_GPS/defconfig        | 2 +-
 proscend/mconfig/configs/M300/2_PLANET/defconfig     | 2 +-
 proscend/mconfig/configs/M300/3_GPS_PLANET/defconfig | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

1055

因應 ariel 把

typedef struct
{
    unsigned int quota_limit; //unit MB
    char recount_mday; //1~31
    unsigned int action_limit;  //1: action; 0: no action
    char recount_hours; // 0~23
    char recount_minutes; // 0~59
    char recount_seconds; //0~59
}  NETMOND_CONFIG;

修改成

typedef struct
{
    unsigned int quota_limit; //unit MB
    unsigned char recount_mday; //1~31
    unsigned int action_limit;  //1: action; 0: no action
    unsigned char recount_hours; // 0~23
    unsigned char recount_minutes; // 0~59
    unsigned char recount_seconds; //0~59
}  NETMOND_CONFIG;

netmon.cgi 需要做以下的修改

diff --git a/proscend/prosrc/webcgi/netmon.c b/proscend/prosrc/webcgi/netmon.c
index 63b97bc..1cb4c7a 100644
--- a/proscend/prosrc/webcgi/netmon.c
+++ b/proscend/prosrc/webcgi/netmon.c
@@ -27,6 +27,10 @@ static void _apply()

     json_object *conf;
     jweb.in.to_raw("conf", &conf);
+
+
+
+#if 0
     for (int i = 0; i < NSDB_NWT_TOTAL; i ++)
     {
         NETMOND_CONFIG *e = &(Netmon.conf[i]);
@@ -38,6 +42,33 @@ static void _apply()
         jweb.j.to_int(o, "recount_minutes", &e->recount_minutes);
         jweb.j.to_int(o, "recount_seconds", &e->recount_seconds);
     }
+#else
+    int _recount_mday[NSDB_NWT_TOTAL];
+    int _recount_hours[NSDB_NWT_TOTAL];
+    int _recount_minutes[NSDB_NWT_TOTAL];
+    int _recount_seconds[NSDB_NWT_TOTAL];
+
+    for (int i = 0; i < NSDB_NWT_TOTAL; i ++)
+    {
+        json_object *o = json_object_array_get_idx(conf, i);
+        jweb.j.to_int(o, "quota_limit", &Netmon.conf[i].quota_limit);
+        jweb.j.to_int(o, "recount_mday", &_recount_mday[i]);
+        jweb.j.to_int(o, "action_limit", &Netmon.conf[i].action_limit);
+        jweb.j.to_int(o, "recount_hours", &_recount_hours[i]);
+        jweb.j.to_int(o, "recount_minutes", &_recount_minutes[i]);
+        jweb.j.to_int(o, "recount_seconds", &_recount_seconds[i]);
+    }
+
+    for (int i = 0; i < NSDB_NWT_TOTAL; i ++)
+    {
+        Netmon.conf[i].recount_mday    = (unsigned char)_recount_mday[i];
+        Netmon.conf[i].recount_hours   = (unsigned char)_recount_hours[i];
+        Netmon.conf[i].recount_minutes = (unsigned char)_recount_minutes[i];
+        Netmon.conf[i].recount_seconds = (unsigned char)_recount_seconds[i];
+    }
+#endif
+
+

     res = ICOS_Apply(MODULE_NETMON, 0, 0, &Netmon, sizeof(Netmon));
     if (res != ICOS_SUCCESS)

不然 jweb.j.to_int(o, "recount_seconds", &e->recount_seconds) 會直接讓 CGI process 死掉

browser 端會出現 apply fail

1110

因應 char 改成 unsigned char 引發的問題所做的修改不要 push 到 branch develop

git stash 將目前的修改存起來再 pull 以便得知 [new branch] hotfix/v1.53 的存在

➜  M300 git:(develop) ✗ git stash
Saved working directory and index state WIP on develop: 2459321 'RIP' ICOS Module implementing - let the proscend
'make menuconfig' recognize it
HEAD is now at 2459321 'RIP' ICOS Module implementing
➜  M300 git:(develop) git pull
remote: Counting objects: 28, done.
remote: Compressing objects: 100% (18/18), done.
remote: Total 28 (delta 10), reused 0 (delta 0)
Unpacking objects: 100% (28/28), done.
From 192.168.0.242:RD/M300
   2459321..141a343  develop    -> origin/develop
 * [new branch]      hotfix/v1.53 -> origin/hotfix/v1.53
First, rewinding head to replay your work on top of it...
Fast-forwarded develop to 141a3438449b612c969f57db362a241ea9dd2cfe.
➜  M300 git:(develop) 

切到 branch hotfix/v1.53 再套用剛剛用 git stash 存起來的修改

➜  M300 git:(develop) git checkout hotfix/v1.53
Branch hotfix/v1.53 set up to track remote branch hotfix/v1.53 from origin.
Switched to a new branch 'hotfix/v1.53'
➜  M300 git:(hotfix/v1.53) git stash apply
On branch hotfix/v1.53
Your branch is up-to-date with 'origin/hotfix/v1.53'.
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   ../../../prosrc/webcgi/netmon.c

no changes added to commit (use "git add" and/or "git commit -a")
➜  M300 git:(hotfix/v1.53) 

上 code

commit fc90563e1b4780eb7cbd22c3a2c9e4bb025e3606
Refs: [hotfix/v1.53], {origin/hotfix/v1.53}
Author: jeffrey <[email protected]>
Date:   Tue Aug 15 11:05:55 2017 +0800

    Since some 'NETMOND_CONFIG' elements type change from 'char' to 'unsigned char', we can not use 'jweb.j.to_int

 proscend/prosrc/webcgi/netmon.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

1315

改一下錯別字 - 緯度 - 是 latitude 不是 lantitude

commit 700a6afc913ec120798042671efc7bb08c476ce2
Refs: [hotfix/v1.53], {origin/hotfix/v1.53}
Author: jeffrey <[email protected]>
Date:   Tue Aug 15 13:12:57 2017 +0800

    Correct typo from 'Lantitude' to 'Latitude'

 proscend/prosrc/www/app/locale-en.json                         | 2 +-
 proscend/prosrc/www/app/locale-fr.json                         | 2 +-
 proscend/prosrc/www/app/locale-zh-tw.json                      | 2 +-
 proscend/prosrc/www/brand_nobrand/app/feature/status_gnss.html | 2 +-
 proscend/prosrc/www/brand_planet/app/feature/status_gnss.html  | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

1330

commit 8475876127c870753e027047e85a729246bc15a5
Author: jeffrey <[email protected]>
Date:   Tue Aug 15 13:30:48 2017 +0800

    Remove the old history's 'PROSRC_RIP' macro

 proscend/prosrc/icos/icoslib/Makefile        |  3 ---
 proscend/prosrc/icos/icoslib/entry.c         | 11 -----------
 proscend/prosrc/icos/snmp_pass/mibs/Makefile |  2 --
 3 files changed, 16 deletions(-)

1435

commit 1803e0bafc9cd86a04a614a08a50dc6ca549363c
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Tue Aug 15 14:34:49 2017 +0800

    'RIP' ICOS Module implementing
    - add 'MODULE_RIP' into moduleInitAry[]
    - add ripModule
    - add factory default configuration
    - in ripModule._notify()
      - PRO_EVENT 'ICOS_UCAST_MODULE_APPLY' not implement yet

 .../rootfs/home/factory/icos/rip/ripcfg.ini        |   3 +
 proscend/prosrc/icos/icoslib/Makefile              |   3 +
 proscend/prosrc/icos/icoslib/entry.c               |   7 +
 proscend/prosrc/icos/icoslib/rip/Makefile          |  13 +
 proscend/prosrc/icos/icoslib/rip/rip.c             | 275 +++++++++++++++++++++
 proscend/prosrc/icos/icoslib/zebra/zebra.c         |   2 +-
 proscend/prosrc/icos/include/icos_common.h         |   2 +-
 proscend/prosrc/icos/include/module_rip.h          |  78 ++----
 8 files changed, 318 insertions(+), 65 deletions(-)
⚠️ **GitHub.com Fallback** ⚠️