From 56d3732dda1961df0c0fa414a981f3339dac114e Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Thu, 30 Oct 2025 17:22:16 +0100 Subject: [PATCH] susbsys/mgmt/mcumgr/grp: add role field to parameters response Added optional `inst_role` field to MCUmgr Parameters response. Field is intended to express MCUmgr instance role of the device. Interpretation of the value is Application specific. Signed-off-by: Andrzej Puzdrowski --- subsys/mgmt/mcumgr/grp/os_mgmt/Kconfig | 11 +++++++++++ subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/subsys/mgmt/mcumgr/grp/os_mgmt/Kconfig b/subsys/mgmt/mcumgr/grp/os_mgmt/Kconfig index 36b727c7620..192420fea22 100644 --- a/subsys/mgmt/mcumgr/grp/os_mgmt/Kconfig +++ b/subsys/mgmt/mcumgr/grp/os_mgmt/Kconfig @@ -166,6 +166,17 @@ config MCUMGR_GRP_OS_DATETIME_HOOK config MCUMGR_GRP_OS_MCUMGR_PARAMS bool "MCUMGR Parameters retrieval command" +config MCUMGR_GRP_OS_MCUMGR_PARAMS_ROLE + bool "MCUMGR Parameter Role in response" + depends on MCUMGR_GRP_OS_MCUMGR_PARAMS + +config MCUMGR_GRP_OS_MCUMGR_PARAMS_ROLE_VALUE + int "MCUMGR Parameter Role value" + default 0 + depends on MCUMGR_GRP_OS_MCUMGR_PARAMS_ROLE + helps + Value for `inst_role` field in response to MCUmgr Parameters request. + config MCUMGR_GRP_OS_INFO bool "Support for info command" help 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 360385a1b95..e0936de2623 100644 --- a/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c +++ b/subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c @@ -472,6 +472,10 @@ os_mgmt_mcumgr_params(struct smp_streamer *ctxt) zcbor_uint32_put(zse, CONFIG_MCUMGR_TRANSPORT_NETBUF_SIZE) && zcbor_tstr_put_lit(zse, "buf_count") && zcbor_uint32_put(zse, CONFIG_MCUMGR_TRANSPORT_NETBUF_COUNT); +#ifdef CONFIG_MCUMGR_GRP_OS_MCUMGR_PARAMS_ROLE + zcbor_tstr_put_lit(zse, "inst_role") && + zcbor_uint32_put(zse, CONFIG_MCUMGR_GRP_OS_MCUMGR_PARAMS_ROLE_VALUE); +#endif return ok ? MGMT_ERR_EOK : MGMT_ERR_EMSGSIZE; }