mgmt: mcumgr: callbacks: Fix not checking event ID properly

Fixes an issue whereby event ID was not checked properly, meaning
that OR'd events would not work as one would expect.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
This commit is contained in:
Jamie McCrae 2023-01-06 09:42:56 +00:00 committed by Marti Bolivar
commit d0e421225a

View file

@ -106,9 +106,11 @@ int32_t mgmt_callback_notify(uint32_t event, void *data, size_t data_size)
struct mgmt_callback *loop_group =
CONTAINER_OF(snp, struct mgmt_callback, node);
if (loop_group->event_id == event || loop_group->event_id == MGMT_EVT_OP_ALL ||
if (loop_group->event_id == MGMT_EVT_OP_ALL ||
(MGMT_EVT_GET_GROUP(loop_group->event_id) == group &&
MGMT_EVT_GET_ID(loop_group->event_id) == MGMT_EVT_OP_ID_ALL)) {
(MGMT_EVT_GET_ID(event) & MGMT_EVT_GET_ID(loop_group->event_id)) ==
MGMT_EVT_GET_ID(event))) {
rc = loop_group->callback(event, return_rc, &abort_more, data, data_size);
if (rc != MGMT_ERR_EOK && failed == false) {