hmsniff: add power event
[hmcfgusb] / flash-hmcfgusb.c
index 0f0b9cef707b2b48424942d28b6144bc381d39f1..a9ff876d75557bc8a230910cc3936e1cb83f1324 100644 (file)
@@ -93,11 +93,12 @@ int main(int argc, char **argv)
 
        if (!dev->bootloader) {
                fprintf(stderr, "\nHM-CFG-USB not in bootloader mode, entering bootloader.\n");
-               hmcfgusb_enter_bootloader(dev);
                fprintf(stderr, "\nWaiting for device to reappear...\n");
 
                do {
                        if (dev) {
+                               if (!dev->bootloader)
+                                       hmcfgusb_enter_bootloader(dev);
                                hmcfgusb_close(dev);
                        }
                        sleep(1);
@@ -165,6 +166,7 @@ int main(int argc, char **argv)
        firmware_free(fw);
 
        hmcfgusb_close(dev);
+       hmcfgusb_exit();
 
        return EXIT_SUCCESS;
 }
Impressum, Datenschutz