From 095a29e4f4ae59f1b5bbf574f4f7ea03279b27cb Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 30 Dec 2024 08:40:01 +0000 Subject: [PATCH] [nrf fromtree] mgmt: mcumgr: grp: os_mgmt: Add error code for invalid responses Adds a new error code that can be used to signify that a query was valid but the response was not valid Signed-off-by: Jamie McCrae (cherry picked from commit 58710374264d02b976f69b42c643a1d6b32cc603) --- include/zephyr/mgmt/mcumgr/grp/os_mgmt/os_mgmt.h | 3 +++ subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c | 1 + 2 files changed, 4 insertions(+) diff --git a/include/zephyr/mgmt/mcumgr/grp/os_mgmt/os_mgmt.h b/include/zephyr/mgmt/mcumgr/grp/os_mgmt/os_mgmt.h index 9aef7721929..da4572e33da 100644 --- a/include/zephyr/mgmt/mcumgr/grp/os_mgmt/os_mgmt.h +++ b/include/zephyr/mgmt/mcumgr/grp/os_mgmt/os_mgmt.h @@ -47,6 +47,9 @@ enum os_mgmt_err_code_t { /** RTC command failed */ OS_MGMT_ERR_RTC_COMMAND_FAILED, + + /** Query was recognized but there is no valid value for the response. */ + OS_MGMT_ERR_QUERY_RESPONSE_VALUE_NOT_VALID, }; /* Bitmask values used by the os info command handler. Note that the width of this variable is diff --git a/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c b/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c index 648f3842705..983cee510aa 100644 --- a/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c @@ -1046,6 +1046,7 @@ static int os_mgmt_translate_error_code(uint16_t err) case OS_MGMT_ERR_QUERY_YIELDS_NO_ANSWER: case OS_MGMT_ERR_RTC_NOT_SET: + case OS_MGMT_ERR_QUERY_RESPONSE_VALUE_NOT_VALID: rc = MGMT_ERR_ENOENT; break;