You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2016/10/05 22:07:18 UTC

[1/2] incubator-mynewt-core git commit: newtmgr, mgmt; move rest of the newtmgr specific elements out of common handler argument struct.

Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop c10e883c9 -> 8fd21e960


newtmgr, mgmt; move rest of the newtmgr specific elements out of common
handler argument struct.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/7d00bea7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/7d00bea7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/7d00bea7

Branch: refs/heads/develop
Commit: 7d00bea7b04a816278512e46d1f07c178dd0a28a
Parents: c10e883
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Wed Oct 5 14:59:25 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Wed Oct 5 14:59:25 2016 -0700

----------------------------------------------------------------------
 mgmt/mgmt/include/mgmt/mgmt.h |  2 --
 mgmt/newtmgr/src/newtmgr.c    | 16 +++++++++-------
 2 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/7d00bea7/mgmt/mgmt/include/mgmt/mgmt.h
----------------------------------------------------------------------
diff --git a/mgmt/mgmt/include/mgmt/mgmt.h b/mgmt/mgmt/include/mgmt/mgmt.h
index d176127..c83c61b 100644
--- a/mgmt/mgmt/include/mgmt/mgmt.h
+++ b/mgmt/mgmt/include/mgmt/mgmt.h
@@ -65,8 +65,6 @@ struct mgmt_jbuf {
     /* json_buffer must be first element in the structure */
     struct json_buffer mjb_buf;  /* for input */
     struct json_encoder mjb_enc; /* for output */
-    struct os_mbuf *mjb_in_m;
-    struct os_mbuf *mjb_out_m;
 };
 
 typedef int (*mgmt_handler_func_t)(struct mgmt_jbuf *);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/7d00bea7/mgmt/newtmgr/src/newtmgr.c
----------------------------------------------------------------------
diff --git a/mgmt/newtmgr/src/newtmgr.c b/mgmt/newtmgr/src/newtmgr.c
index feae036..314b5e8 100644
--- a/mgmt/newtmgr/src/newtmgr.c
+++ b/mgmt/newtmgr/src/newtmgr.c
@@ -40,6 +40,8 @@ static struct os_task g_nmgr_task;
  */
 static struct nmgr_jbuf {
     struct mgmt_jbuf n_b;
+    struct os_mbuf *n_in_m;
+    struct os_mbuf *n_out_m;
     struct nmgr_hdr *n_hdr;
     uint16_t n_off;
     uint16_t n_end;
@@ -75,7 +77,7 @@ nmgr_jbuf_read_next(struct json_buffer *jb)
         return '\0';
     }
 
-    rc = os_mbuf_copydata(njb->n_b.mjb_in_m, njb->n_off, 1, &c);
+    rc = os_mbuf_copydata(njb->n_in_m, njb->n_off, 1, &c);
     if (rc == -1) {
         c = '\0';
     }
@@ -98,7 +100,7 @@ nmgr_jbuf_read_prev(struct json_buffer *jb)
     }
 
     --njb->n_off;
-    rc = os_mbuf_copydata(njb->n_b.mjb_in_m, njb->n_off, 1, &c);
+    rc = os_mbuf_copydata(njb->n_in_m, njb->n_off, 1, &c);
     if (rc == -1) {
         c = '\0';
     }
@@ -119,7 +121,7 @@ nmgr_jbuf_readn(struct json_buffer *jb, char *buf, int size)
     left = njb->n_end - njb->n_off;
     read = size > left ? left : size;
 
-    rc = os_mbuf_copydata(njb->n_b.mjb_in_m, njb->n_off, read, buf);
+    rc = os_mbuf_copydata(njb->n_in_m, njb->n_off, read, buf);
     if (rc != 0) {
         goto err;
     }
@@ -137,7 +139,7 @@ nmgr_jbuf_write(void *arg, char *data, int len)
 
     njb = (struct nmgr_jbuf *) arg;
 
-    rc = nmgr_rsp_extend(njb->n_hdr, njb->n_b.mjb_out_m, data, len);
+    rc = nmgr_rsp_extend(njb->n_hdr, njb->n_out_m, data, len);
     if (rc != 0) {
         assert(0);
         goto err;
@@ -169,7 +171,7 @@ static void
 nmgr_jbuf_setibuf(struct nmgr_jbuf *njb, struct os_mbuf *m,
         uint16_t off, uint16_t len)
 {
-    njb->n_b.mjb_in_m = m;
+    njb->n_in_m = m;
     njb->n_off = off;
     njb->n_end = off + len;
 }
@@ -178,8 +180,8 @@ static void
 nmgr_jbuf_setobuf(struct nmgr_jbuf *njb, struct nmgr_hdr *hdr,
         struct os_mbuf *m)
 {
-    njb->n_b.mjb_out_m = m;
     njb->n_b.mjb_enc.je_wr_commas = 0;
+    njb->n_out_m = m;
     njb->n_hdr = hdr;
 }
 
@@ -217,7 +219,7 @@ nmgr_send_err_rsp(struct nmgr_transport *nt, struct os_mbuf *m,
     mgmt_jbuf_setoerr(&nmgr_task_jbuf.n_b, rc);
     hdr->nh_len = htons(hdr->nh_len);
     hdr->nh_flags = NMGR_F_JSON_RSP_COMPLETE;
-    nt->nt_output(nt, nmgr_task_jbuf.n_b.mjb_out_m);
+    nt->nt_output(nt, nmgr_task_jbuf.n_out_m);
 }
 
 static int


[2/2] incubator-mynewt-core git commit: shell; start newtmgr message sequence with '\n' to flush the parsing on the other side.

Posted by ma...@apache.org.
shell; start newtmgr message sequence with '\n' to flush the parsing
on the other side.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/8fd21e96
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/8fd21e96
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/8fd21e96

Branch: refs/heads/develop
Commit: 8fd21e960adde47db7cfa48d7fb77b146efbdc70
Parents: 7d00bea
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Wed Oct 5 15:06:41 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Wed Oct 5 15:06:41 2016 -0700

----------------------------------------------------------------------
 sys/shell/src/shell.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/8fd21e96/sys/shell/src/shell.c
----------------------------------------------------------------------
diff --git a/sys/shell/src/shell.c b/sys/shell/src/shell.c
index 3606e54..e2844ab 100644
--- a/sys/shell/src/shell.c
+++ b/sys/shell/src/shell.c
@@ -280,7 +280,7 @@ shell_nlip_mtx(struct os_mbuf *m)
 #define SHELL_NLIP_MTX_BUF_SIZE (12)
     uint8_t readbuf[SHELL_NLIP_MTX_BUF_SIZE];
     char encodebuf[BASE64_ENCODE_SIZE(SHELL_NLIP_MTX_BUF_SIZE)];
-    char pkt_seq[2] = { SHELL_NLIP_PKT_START1, SHELL_NLIP_PKT_START2 };
+    char pkt_seq[3] = { '\n', SHELL_NLIP_PKT_START1, SHELL_NLIP_PKT_START2 };
     char esc_seq[2] = { SHELL_NLIP_DATA_START1, SHELL_NLIP_DATA_START2 };
     uint16_t totlen;
     uint16_t dlen;