diff options
author | px4dev <px4@purgatory.org> | 2013-08-03 22:35:18 -0700 |
---|---|---|
committer | px4dev <px4@purgatory.org> | 2013-08-03 22:35:18 -0700 |
commit | e931d3b9cda723d63bf352ca866dc499d8df21f5 (patch) | |
tree | 181e4656d32ecacfb4c0b51b8611ce9efce38e4c /src/systemcmds | |
parent | fbd5aae8c67ef7695cc31aa3c9d450a3e0ce46cb (diff) | |
download | px4-firmware-e931d3b9cda723d63bf352ca866dc499d8df21f5.tar.gz px4-firmware-e931d3b9cda723d63bf352ca866dc499d8df21f5.tar.bz2 px4-firmware-e931d3b9cda723d63bf352ca866dc499d8df21f5.zip |
Add an option to the systemreset() call and to the reboot command (-b) to reboot into the bootloader.
The system will remain in the bootloader until it's reset, or until an upload is completed.
Diffstat (limited to 'src/systemcmds')
-rw-r--r-- | src/systemcmds/reboot/reboot.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/systemcmds/reboot/reboot.c b/src/systemcmds/reboot/reboot.c index 0fd1e2724..91a2c2eb8 100644 --- a/src/systemcmds/reboot/reboot.c +++ b/src/systemcmds/reboot/reboot.c @@ -40,14 +40,31 @@ #include <nuttx/config.h> #include <unistd.h> #include <stdio.h> +#include <getopt.h> #include <systemlib/systemlib.h> +#include <systemlib/err.h> __EXPORT int reboot_main(int argc, char *argv[]); int reboot_main(int argc, char *argv[]) { - systemreset(); + int ch; + bool to_bootloader = false; + + while ((ch = getopt(argc, argv, "b")) != -1) { + switch (ch) { + case 'b': + to_bootloader = true; + break; + default: + errx(1, "usage: reboot [-b]\n" + " -b reboot into the bootloader"); + + } + } + + systemreset(to_bootloader); } |