X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/hmcfgusb/blobdiff_plain/3b35a8c145cb567b625d32030ba3a287b478dd43..dc9f58f02b49575ad6de45626468a7f55dd57a12:/flash-ota.c?ds=inline diff --git a/flash-ota.c b/flash-ota.c index 634e19b..754cc29 100644 --- a/flash-ota.c +++ b/flash-ota.c @@ -435,11 +435,9 @@ int main(int argc, char **argv) (rdata.version >> 8) & 0xff, rdata.version & 0xff); - if (rdata.version < 0x0139) { - fprintf(stderr, "\nThis version does _not_ support firmware upgrade mode!\n"); + if (rdata.version < 0x013a) { + fprintf(stderr, "\nThis version does _not_ support firmware upgrade mode, you need at least 1.58!\n"); exit(EXIT_FAILURE); - } else if (rdata.version < 0x0140) { - printf("\n*** This version probably not supports firmware upgrade mode! ***\n\n"); } } else { hmcfgusb_set_debug(debug); @@ -455,11 +453,12 @@ int main(int argc, char **argv) if (!dev.hmcfgusb->bootloader) { printf("HM-CFG-USB not in bootloader mode, entering bootloader.\n"); - hmcfgusb_enter_bootloader(dev.hmcfgusb); printf("Waiting for device to reappear...\n"); do { if (dev.hmcfgusb) { + if (!dev.hmcfgusb->bootloader) + hmcfgusb_enter_bootloader(dev.hmcfgusb); hmcfgusb_close(dev.hmcfgusb); } sleep(1); @@ -468,10 +467,11 @@ int main(int argc, char **argv) if (dev.hmcfgusb->bootloader) { printf("HM-CFG-USB in bootloader mode, rebooting\n"); - hmcfgusb_leave_bootloader(dev.hmcfgusb); do { if (dev.hmcfgusb) { + if (dev.hmcfgusb->bootloader) + hmcfgusb_leave_bootloader(dev.hmcfgusb); hmcfgusb_close(dev.hmcfgusb); } sleep(1); @@ -738,6 +738,7 @@ int main(int argc, char **argv) switch(dev.type) { case DEVICE_TYPE_HMCFGUSB: hmcfgusb_close(dev.hmcfgusb); + hmcfgusb_exit(); break; case DEVICE_TYPE_CULFW: culfw_close(dev.culfw);