-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Description
Describe the bug
The MCUmgr statistics only work correctly when selecting MCUMGR_SMP_LEGACY_RC_BEHAVIOUR. This flag is correctly handled for stat_mgmt_show command but it is missing for stat_mgmt_list command.
It is easy to compare both functions on this points:
zephyr/subsys/mgmt/mcumgr/grp/stat_mgmt/src/stat_mgmt.c
Lines 153 to 163 in 4b4bba4
if (IS_ENABLED(CONFIG_MCUMGR_SMP_LEGACY_RC_BEHAVIOUR)) { | |
ok = zcbor_tstr_put_lit(zse, "rc") && | |
zcbor_int32_put(zse, MGMT_ERR_EOK); | |
} | |
if (ok) { | |
ok = zcbor_tstr_put_lit(zse, "name") && | |
zcbor_tstr_encode(zse, &name) && | |
zcbor_tstr_put_lit(zse, "fields") && | |
zcbor_map_start_encode(zse, counter); | |
} |
zephyr/subsys/mgmt/mcumgr/grp/stat_mgmt/src/stat_mgmt.c
Lines 203 to 206 in 4b4bba4
ok = zcbor_tstr_put_lit(zse, "rc") && | |
zcbor_int32_put(zse, MGMT_ERR_EOK) && | |
zcbor_tstr_put_lit(zse, "stat_list") && | |
zcbor_list_start_encode(zse, counter); |
Expected behavior
The MCUmgr statistics should work correctly for all protocol versions.
Impact
Field devices can not report their groups correctly when using a tool that not allow to use the MCUMGR_SMP_LEGACY_RC_BEHAVIOUR.
Environment (please complete the following information):
- OS: Linux
- Toolchain Zephyr SDK: 0.16.4
- mainline
Additional context
Tested with https://github.com/intercreate/smpmgr