Allow forceupdate in all conditions

This commit is contained in:
Lorenz Meier 2013-12-14 14:54:02 +01:00
parent 00dc339d2e
commit 10b2dc67e4
1 changed files with 12 additions and 12 deletions

View File

@ -2653,22 +2653,22 @@ px4io_main(int argc, char *argv[])
the user to hold the safety switch down
*/
if (argc <= 3) {
printf("usage: px4io forceupdate MAGIC filename\n");
warnx("usage: px4io forceupdate MAGIC filename");
exit(1);
}
if (g_dev == nullptr) {
printf("px4io is not started\n");
exit(1);
}
uint16_t arg = atol(argv[2]);
int ret = g_dev->ioctl(nullptr, PX4IO_REBOOT_BOOTLOADER, arg);
if (ret != OK) {
printf("reboot failed - %d\n", ret);
exit(1);
}
warnx("px4io is not started, still attempting upgrade");
} else {
uint16_t arg = atol(argv[2]);
int ret = g_dev->ioctl(nullptr, PX4IO_REBOOT_BOOTLOADER, arg);
if (ret != OK) {
printf("reboot failed - %d\n", ret);
exit(1);
}
// tear down the px4io instance
delete g_dev;
// tear down the px4io instance
delete g_dev;
}
// upload the specified firmware
const char *fn[2];