]> cvs.zerfleddert.de Git - hmcfgusb/blobdiff - flash-hmcfgusb.c
Add compiled binaries to install
[hmcfgusb] / flash-hmcfgusb.c
index 244559d6e1d61dc1cf7bd499376f1db3a80ec06b..0f0b9cef707b2b48424942d28b6144bc381d39f1 100644 (file)
@@ -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");
@@ -136,7 +134,7 @@ int main(int argc, char **argv)
                        printf("Waiting for ack...\n");
                do {
                        errno = 0;
-                       pfd = hmcfgusb_poll(dev, 1);
+                       pfd = hmcfgusb_poll(dev, 1000);
                        if ((pfd < 0) && errno) {
                                if (errno != ETIMEDOUT) {
                                        perror("\n\nhmcfgusb_poll");
Impressum, Datenschutz