From 56a12799b582a5495a4246f966981ab3ab776aa4 Mon Sep 17 00:00:00 2001 From: Robert Quattlebaum Date: Wed, 6 Dec 2017 19:18:58 -0800 Subject: [PATCH] [ncp] Supress all output except PROP_LAST_STATUS at startup. (#2405) When an OpenThread NCP starts up, the only thing it should emit is a `CMD_PROP_VALUE_IS` for `PROP_LAST_STATUS`, with a reset reason as the status code. However, up until this point we have been also dumping out lots of other details which happen to be triggrered by OpenThread's start-up code. This is effectively noise, since a properly implemented host driver would be explicitly fetching the values of properties it needs to know at startup. This change fixes this by supressing all property updates at startup except `PROP_LAST_STATUS`. --- src/ncp/ncp_base.cpp | 6 ++++-- src/ncp/ncp_base.hpp | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ncp/ncp_base.cpp b/src/ncp/ncp_base.cpp index 2d0ee344e..968902f58 100644 --- a/src/ncp/ncp_base.cpp +++ b/src/ncp/ncp_base.cpp @@ -564,7 +564,8 @@ NcpBase::NcpBase(Instance *aInstance): mFramingErrorCounter(0), mRxSpinelFrameCounter(0), mRxSpinelOutOfOrderTidCounter(0), - mTxSpinelFrameCounter(0) + mTxSpinelFrameCounter(0), + mDidInitialUpdates(false) { assert(mInstance != NULL); @@ -1028,7 +1029,7 @@ void NcpBase::UpdateChangedProps(void) SuccessOrExit(WriteLastStatusFrame(SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, status)); } - else + else if (mDidInitialUpdates) { SuccessOrExit(WritePropertyValueIsFrame(SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, propKey)); } @@ -1038,6 +1039,7 @@ void NcpBase::UpdateChangedProps(void) } exit: + mDidInitialUpdates = true; return; } diff --git a/src/ncp/ncp_base.hpp b/src/ncp/ncp_base.hpp index 7018d10a7..528dab52b 100644 --- a/src/ncp/ncp_base.hpp +++ b/src/ncp/ncp_base.hpp @@ -759,6 +759,7 @@ private: bool mLegacyNodeDidJoin; #endif + bool mDidInitialUpdates; }; } // namespace Ncp