forked from Archive/PX4-Autopilot
Do not make PX4IO start mandatory for forceupdate
This commit is contained in:
parent
a0db455334
commit
8833f81b48
|
@ -2367,8 +2367,10 @@ start(int argc, char *argv[])
|
||||||
/* create the driver - it will set g_dev */
|
/* create the driver - it will set g_dev */
|
||||||
(void)new PX4IO(interface);
|
(void)new PX4IO(interface);
|
||||||
|
|
||||||
if (g_dev == nullptr)
|
if (g_dev == nullptr) {
|
||||||
|
delete interface;
|
||||||
errx(1, "driver alloc failed");
|
errx(1, "driver alloc failed");
|
||||||
|
}
|
||||||
|
|
||||||
if (OK != g_dev->init()) {
|
if (OK != g_dev->init()) {
|
||||||
delete g_dev;
|
delete g_dev;
|
||||||
|
@ -2769,7 +2771,25 @@ px4io_main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
if (g_dev == nullptr) {
|
if (g_dev == nullptr) {
|
||||||
warnx("px4io is not started, still attempting upgrade");
|
warnx("px4io is not started, still attempting upgrade");
|
||||||
} else {
|
|
||||||
|
/* allocate the interface */
|
||||||
|
device::Device *interface = get_interface();
|
||||||
|
|
||||||
|
/* create the driver - it will set g_dev */
|
||||||
|
(void)new PX4IO(interface);
|
||||||
|
|
||||||
|
if (g_dev == nullptr) {
|
||||||
|
delete interface;
|
||||||
|
errx(1, "driver alloc failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (OK != g_dev->init()) {
|
||||||
|
delete g_dev;
|
||||||
|
g_dev = nullptr;
|
||||||
|
errx(1, "driver init failed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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) {
|
||||||
|
@ -2779,7 +2799,6 @@ px4io_main(int argc, char *argv[])
|
||||||
|
|
||||||
// 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];
|
||||||
|
|
Loading…
Reference in New Issue