File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
subsys/mgmt/mcumgr/grp/os_mgmt/src Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 2727
2828#ifdef CONFIG_REBOOT
2929#include <zephyr/sys/reboot.h>
30+ #ifdef CONFIG_BT
31+ #include <zephyr/bluetooth/bluetooth.h>
32+ #endif
33+ #ifdef CONFIG_MPSL
34+ #include <mpsl.h>
35+ #endif
3036#endif
3137
3238#ifdef CONFIG_MCUMGR_MGMT_NOTIFICATION_HOOKS
@@ -362,6 +368,16 @@ static int os_mgmt_taskstat_read(struct smp_streamer *ctxt)
362368#ifdef CONFIG_MULTITHREADING
363369static void os_mgmt_reset_work_handler (struct k_work * work )
364370{
371+ #ifdef CONFIG_BT
372+ int ret = bt_disable ();
373+
374+ if (ret ) {
375+ LOG_ERR ("BT disable failed before reboot: %d\n" , ret );
376+ }
377+ #endif
378+ #ifdef CONFIG_MPSL
379+ mpsl_uninit ();
380+ #endif
365381 ARG_UNUSED (work );
366382
367383 sys_reboot (SYS_REBOOT_WARM );
@@ -454,6 +470,16 @@ static int os_mgmt_reset(struct smp_streamer *ctxt)
454470 /* Reboot the system from the system workqueue thread. */
455471 k_work_schedule (& os_mgmt_reset_work , K_MSEC (CONFIG_MCUMGR_GRP_OS_RESET_MS ));
456472#else
473+ #ifdef CONFIG_BT
474+ err_rc = bt_disable ();
475+ if (err_rc ) {
476+ LOG_ERR ("BT disable failed before reboot: %d\n" , err_rc );
477+ }
478+ #endif
479+ #ifdef CONFIG_MPSL
480+ mpsl_uninit ();
481+ #endif
482+
457483 sys_reboot (SYS_REBOOT_WARM );
458484#endif
459485
You can’t perform that action at this time.
0 commit comments