Skip to content

mgmt: mcumgr: stat_mgmt: stat_mgmt_list always send legacy behavior #80476

Closed
@nandojve

Description

@nandojve

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:

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);
}

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

Metadata

Metadata

Assignees

Labels

area: mcumgrbugThe issue is a bug, or the PR is fixing a bugpriority: mediumMedium impact/importance bug

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions