Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions subsys/mgmt/mcumgr/grp/os_mgmt/src/os_mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@

#ifdef CONFIG_REBOOT
#include <zephyr/sys/reboot.h>
#ifdef CONFIG_BT
#include <zephyr/bluetooth/bluetooth.h>
#endif
#ifdef CONFIG_MPSL
#include <mpsl.h>
#endif
#endif

#ifdef CONFIG_MCUMGR_MGMT_NOTIFICATION_HOOKS
Expand Down Expand Up @@ -362,6 +368,16 @@ static int os_mgmt_taskstat_read(struct smp_streamer *ctxt)
#ifdef CONFIG_MULTITHREADING
static void os_mgmt_reset_work_handler(struct k_work *work)
{
#ifdef CONFIG_BT
int ret = bt_disable();

if (ret) {
LOG_ERR("BT disable failed before reboot: %d\n", ret);
}
#endif
#ifdef CONFIG_MPSL
mpsl_uninit();
#endif
ARG_UNUSED(work);

sys_reboot(SYS_REBOOT_WARM);
Expand Down Expand Up @@ -454,6 +470,16 @@ static int os_mgmt_reset(struct smp_streamer *ctxt)
/* Reboot the system from the system workqueue thread. */
k_work_schedule(&os_mgmt_reset_work, K_MSEC(CONFIG_MCUMGR_GRP_OS_RESET_MS));
#else
#ifdef CONFIG_BT
err_rc = bt_disable();
if (err_rc) {
LOG_ERR("BT disable failed before reboot: %d\n", err_rc);
}
#endif
#ifdef CONFIG_MPSL
mpsl_uninit();
#endif

sys_reboot(SYS_REBOOT_WARM);
#endif

Expand Down