From 7cb71af949a8f0d521aea00ad2472909088a5296 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Tue, 18 Apr 2017 14:09:14 +0200 Subject: [PATCH] reboot.c: switch to px4_shutdown_request() --- src/systemcmds/reboot/reboot.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/systemcmds/reboot/reboot.c b/src/systemcmds/reboot/reboot.c index 8309d74ea4..c069b6302f 100644 --- a/src/systemcmds/reboot/reboot.c +++ b/src/systemcmds/reboot/reboot.c @@ -39,8 +39,8 @@ #include #include -#include #include +#include #include __EXPORT int reboot_main(int argc, char *argv[]); @@ -62,9 +62,19 @@ int reboot_main(int argc, char *argv[]) default: PX4_ERR("usage: reboot [-b]\n" " -b reboot into the bootloader"); + break; } } - px4_systemreset(to_bootloader); + int ret = px4_shutdown_request(true, to_bootloader); + + if (ret < 0) { + PX4_ERR("reboot failed (%i)", ret); + return -1; + } + + while (1) { usleep(1); } // this command should not return on success + + return 0; }