Add XMEGA C3 family to the ModuleTest build test.
[pub/USBasp.git] / Bootloaders / HID / HostLoaderApp / hid_bootloader_cli.c
index e22d394..200f406 100644 (file)
@@ -195,7 +195,9 @@ usb_dev_handle * open_usb_device(int vid, int pid)
        struct usb_bus *bus;
        struct usb_device *dev;
        usb_dev_handle *h;
+       #ifdef LIBUSB_HAS_GET_DRIVER_NP
        char buf[128];
+       #endif
        int r;
 
        usb_init();
@@ -390,7 +392,6 @@ int write_usb_device(HANDLE h, void *buf, int len, int timeout)
                if (r != WAIT_OBJECT_0) return 0;
        }
        if (!GetOverlappedResult(h, &ov, &n, FALSE)) return 0;
-       if (n <= 0) return 0;
        return 1;
 }
 
@@ -710,10 +711,10 @@ int teensy_open(void)
 {
        teensy_close();
        uhid_teensy_fd = open_usb_device(0x16C0, 0x0478);
-       
+
        if (uhid_teensy_fd < 0)
                uhid_teensy_fd = open_usb_device(0x03eb, 0x2067);
-       
+
        if (uhid_teensy_fd < 0) return 0;
        return 1;
 }
@@ -801,6 +802,7 @@ int read_intel_hex(const char *filename)
                if (*buf) {
                        if (parse_hex_line(buf) == 0) {
                                //printf("Warning, parse error line %d\n", lineno);
+                               fclose(fp);
                                return -2;
                        }
                }
@@ -826,7 +828,7 @@ parse_hex_line(char *line)
        int addr, code, num;
         int sum, len, cksum, i;
         char *ptr;
-        
+
         num = 0;
         if (line[0] != ':') return 0;
         if (strlen(line) < 11) return 0;