Allow forceupdate in all conditions

This commit is contained in:
Lorenz Meier
2013-12-14 14:54:02 +01:00
parent 00dc339d2e
commit 10b2dc67e4
+12 -12
View File
@@ -2653,22 +2653,22 @@ px4io_main(int argc, char *argv[])
the user to hold the safety switch down the user to hold the safety switch down
*/ */
if (argc <= 3) { if (argc <= 3) {
printf("usage: px4io forceupdate MAGIC filename\n"); warnx("usage: px4io forceupdate MAGIC filename");
exit(1); exit(1);
} }
if (g_dev == nullptr) { if (g_dev == nullptr) {
printf("px4io is not started\n"); warnx("px4io is not started, still attempting upgrade");
exit(1); } else {
} uint16_t arg = atol(argv[2]);
uint16_t arg = atol(argv[2]); int ret = g_dev->ioctl(nullptr, PX4IO_REBOOT_BOOTLOADER, arg);
int ret = g_dev->ioctl(nullptr, PX4IO_REBOOT_BOOTLOADER, arg); if (ret != OK) {
if (ret != OK) { printf("reboot failed - %d\n", ret);
printf("reboot failed - %d\n", ret); exit(1);
exit(1); }
}
// tear down the px4io instance // tear down the px4io instance
delete g_dev; delete g_dev;
}
// upload the specified firmware // upload the specified firmware
const char *fn[2]; const char *fn[2];