You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by vi...@apache.org on 2019/04/17 18:43:07 UTC
[mynewt-core] branch master updated: sys/console: start pkt should
set g_is_output_nlip (#1770)
This is an automated email from the ASF dual-hosted git repository.
vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
The following commit(s) were added to refs/heads/master by this push:
new e719b0d sys/console: start pkt should set g_is_output_nlip (#1770)
e719b0d is described below
commit e719b0de1341aebf041d5432af27b53995ed816c
Author: Vipul Rahane <vr...@gmail.com>
AuthorDate: Wed Apr 17 11:43:02 2019 -0700
sys/console: start pkt should set g_is_output_nlip (#1770)
- start pkt should set g_is_output_nlip
- remove g_is_output_nlip from handle_nlip(), not needed
---
sys/console/full/src/console.c | 12 ++++++++++--
sys/console/minimal/src/console.c | 16 ++++++++++++++--
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/sys/console/full/src/console.c b/sys/console/full/src/console.c
index 604d7c9..49a5dcf 100644
--- a/sys/console/full/src/console.c
+++ b/sys/console/full/src/console.c
@@ -170,10 +170,20 @@ console_write(const char *str, int cnt)
if (console_lock(timeout) != OS_OK) {
return;
}
+
if (cnt >= 2 && str[0] == CONSOLE_NLIP_DATA_START1 &&
str[1] == CONSOLE_NLIP_DATA_START2) {
g_is_output_nlip = 1;
}
+
+ /* From the shell the first byte is always \n followed by the
+ * actual pkt start bytes, hence checking byte 1 and 2
+ */
+ if (cnt >= 3 && str[1] == CONSOLE_NLIP_PKT_START1 &&
+ str[2] == CONSOLE_NLIP_PKT_START2) {
+ g_is_output_nlip = 1;
+ }
+
/* If the byte string is non nlip and we are silencing non nlip bytes,
* do not let it go out on the console
*/
@@ -651,12 +661,10 @@ handle_nlip(uint8_t byte)
if ((nlip_state & NLIP_PKT_START1) &&
(byte == CONSOLE_NLIP_PKT_START2)) {
nlip_state |= NLIP_PKT_START2;
- g_is_output_nlip = 1;
return 1;
} else if ((nlip_state & NLIP_DATA_START1) &&
(byte == CONSOLE_NLIP_DATA_START2)) {
nlip_state |= NLIP_DATA_START2;
- g_is_output_nlip = 1;
return 1;
} else {
nlip_state = 0;
diff --git a/sys/console/minimal/src/console.c b/sys/console/minimal/src/console.c
index e962cd2..77870cc 100644
--- a/sys/console/minimal/src/console.c
+++ b/sys/console/minimal/src/console.c
@@ -140,6 +140,20 @@ console_write(const char *str, int cnt)
return;
}
+ if (cnt >= 2 && str[0] == CONSOLE_NLIP_DATA_START1 &&
+ str[1] == CONSOLE_NLIP_DATA_START2) {
+ g_is_output_nlip = 1;
+ }
+
+ /* From the shell the first byte is always \n followed by the
+ * actual pkt start bytes, hence checking byte 1 and 2
+ */
+ if (cnt >= 3 && str[1] == CONSOLE_NLIP_PKT_START1 &&
+ str[2] == CONSOLE_NLIP_PKT_START2) {
+ g_is_output_nlip = 1;
+ }
+
+
/* If the byte string is non nlip and we are silencing non nlip bytes,
* do not let it go out on the console
*/
@@ -240,12 +254,10 @@ handle_nlip(uint8_t byte)
if ((nlip_state & NLIP_PKT_START1) &&
(byte == CONSOLE_NLIP_PKT_START2)) {
nlip_state |= NLIP_PKT_START2;
- g_is_output_nlip = 1;
return 1;
} else if ((nlip_state & NLIP_DATA_START1) &&
(byte == CONSOLE_NLIP_DATA_START2)) {
nlip_state |= NLIP_DATA_START2;
- g_is_output_nlip = 1;
return 1;
} else {
nlip_state = 0;