From 26fabd3a7086ad37dfb99c175db21964d188e7aa Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Thu, 25 May 2017 21:55:13 -0700 Subject: [PATCH] logging: `otSetDynamicLogLevel()` returning `OT_ERROR_DISABLED_FEATURE` when not enabled. (#1832) --- include/openthread/instance.h | 5 +++-- src/core/api/instance_api.cpp | 2 +- src/ncp/ncp_base.cpp | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/openthread/instance.h b/include/openthread/instance.h index dceec2742..d8878ad39 100644 --- a/include/openthread/instance.h +++ b/include/openthread/instance.h @@ -278,8 +278,9 @@ otLogLevel otGetDynamicLogLevel(otInstance *aInstance); * @param[in] aInstance A pointer to an OpenThread instance. * @param[in] aLogLevel The dynamic log level. * - * @retval OT_ERROR_NONE The log level was changed successfully. - * @retval OT_ERROR_NOT_CAPABLE The dynamic log level is not supported. + * @retval OT_ERROR_NONE The log level was changed successfully. + * @retval OT_ERROR_DISABLED_FEATURE The dynamic log level feature is disabled. + * (@sa `OPENTHREAD_CONFIG_ENABLE_DYNAMIC_LOG_LEVEL` configuration option). * */ otError otSetDynamicLogLevel(otInstance *aInstance, otLogLevel aLogLevel); diff --git a/src/core/api/instance_api.cpp b/src/core/api/instance_api.cpp index dffbd36b9..5dbc69eb0 100644 --- a/src/core/api/instance_api.cpp +++ b/src/core/api/instance_api.cpp @@ -239,7 +239,7 @@ otError otSetDynamicLogLevel(otInstance *aInstance, otLogLevel aLogLevel) #if OPENTHREAD_CONFIG_ENABLE_DYNAMIC_LOG_LEVEL aInstance->mLogLevel = aLogLevel; #else - error = OT_ERROR_NOT_CAPABLE; + error = OT_ERROR_DISABLED_FEATURE; (void)aInstance; (void)aLogLevel; #endif diff --git a/src/ncp/ncp_base.cpp b/src/ncp/ncp_base.cpp index 9113bcaad..e87ab751e 100644 --- a/src/ncp/ncp_base.cpp +++ b/src/ncp/ncp_base.cpp @@ -6068,7 +6068,7 @@ otError NcpBase::SetPropertyHandler_DEBUG_NCP_LOG_LEVEL(uint8_t header, spinel_p } else { - if (errorCode == OT_ERROR_NOT_CAPABLE) + if (errorCode == OT_ERROR_DISABLED_FEATURE) { errorCode = SendLastStatus(header, SPINEL_STATUS_INVALID_COMMAND_FOR_PROP); }