X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/hmcfgusb/blobdiff_plain/bedcaba0bd60f3ae0856fe75bf4c81c2087c0baa..9718f9faebacf4cd01307b87e5dfb89ed012e8aa:/flash-hmcfgusb.c?ds=inline diff --git a/flash-hmcfgusb.c b/flash-hmcfgusb.c index 244559d..45d467f 100644 --- a/flash-hmcfgusb.c +++ b/flash-hmcfgusb.c @@ -97,13 +97,11 @@ int main(int argc, char **argv) fprintf(stderr, "\nWaiting for device to reappear...\n"); do { - sleep(2); - } while ((dev = hmcfgusb_init(parse_hmcfgusb, &rdata)) == NULL); - - if (!dev->bootloader) { - fprintf(stderr, "Can't enter bootloader, giving up!\n"); - exit(EXIT_FAILURE); - } + if (dev) { + hmcfgusb_close(dev); + } + sleep(1); + } while (((dev = hmcfgusb_init(parse_hmcfgusb, &rdata)) == NULL) || (!dev->bootloader)); } printf("\nHM-CFG-USB opened.\n\n");