You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/09/28 20:09:16 UTC

incubator-mynewt-core git commit: console/full - Interpret '\n' as end-of-line.

Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop 701104676 -> ac4d18e8e


console/full - Interpret '\n' as end-of-line.

The console history feature appears to have changed the EOL character
from '\n' to '\r'.  This caused problems for newtmgr, as the newtmgr
tool ends its commands with a '\n' character.

Now we interpret both '\r' and '\n' as EOL characters.  Brief testing
indicates that newtmgr and console history work with this change.


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/ac4d18e8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/ac4d18e8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/ac4d18e8

Branch: refs/heads/develop
Commit: ac4d18e8e954d59b6e363cd9f1083b111035f744
Parents: 7011046
Author: Christopher Collins <cc...@apache.org>
Authored: Wed Sep 28 13:07:48 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Wed Sep 28 13:07:48 2016 -0700

----------------------------------------------------------------------
 libs/console/full/src/cons_tty.c | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/ac4d18e8/libs/console/full/src/cons_tty.c
----------------------------------------------------------------------
diff --git a/libs/console/full/src/cons_tty.c b/libs/console/full/src/cons_tty.c
index 36555a9..44a4345 100644
--- a/libs/console/full/src/cons_tty.c
+++ b/libs/console/full/src/cons_tty.c
@@ -362,6 +362,9 @@ console_buf_space(struct console_ring *cr)
     return space - 1;
 }
 
+uint8_t yourmom[512];
+int yourmom_idx;
+
 static int
 console_rx_char(void *arg, uint8_t data)
 {
@@ -376,6 +379,10 @@ console_rx_char(void *arg, uint8_t data)
     uint8_t tx_buf[3];
 #endif
 
+    if (yourmom_idx < sizeof yourmom) {
+        yourmom[yourmom_idx++] = data;
+    }
+
     if (CONSOLE_HEAD_INC(&ct->ct_rx) == ct->ct_rx.cr_tail) {
         /*
          * RX queue full. Reader must drain this.
@@ -389,6 +396,7 @@ console_rx_char(void *arg, uint8_t data)
     /* echo */
     switch (data) {
     case '\r':
+    case '\n':
         /*
          * linefeed
          */