]> cvs.zerfleddert.de Git - hmcfgusb/blobdiff - flash-hmcfgusb.c
increase hm-buffer for culfw-devices
[hmcfgusb] / flash-hmcfgusb.c
index 571386f8b1bc5e49acc84c84ef0d4444dac9c499..45d467f08451aa63d76df62fec8dc3136f9eaabb 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");
@@ -138,8 +136,10 @@ int main(int argc, char **argv)
                        errno = 0;
                        pfd = hmcfgusb_poll(dev, 1);
                        if ((pfd < 0) && errno) {
-                               perror("\n\nhmcfgusb_poll");
-                               exit(EXIT_FAILURE);
+                               if (errno != ETIMEDOUT) {
+                                       perror("\n\nhmcfgusb_poll");
+                                       exit(EXIT_FAILURE);
+                               }
                        }
                        if (rdata.ack) {
                                break;
Impressum, Datenschutz