X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/57b382558d0f2a5146bea735943f09c6d1b83286..0da99447d3e88e83f9977501bee56af5c7aa56c0:/Bootloaders/HID/HostLoaderApp/hid_bootloader_cli.c diff --git a/Bootloaders/HID/HostLoaderApp/hid_bootloader_cli.c b/Bootloaders/HID/HostLoaderApp/hid_bootloader_cli.c index 0562690a6..c86b0da9c 100644 --- a/Bootloaders/HID/HostLoaderApp/hid_bootloader_cli.c +++ b/Bootloaders/HID/HostLoaderApp/hid_bootloader_cli.c @@ -49,7 +49,7 @@ void usage(void) fprintf(stderr, "\n = atmegaXXuY or at90usbXXXY"); fprintf(stderr, "\nFor support and more information, please visit:\n"); - fprintf(stderr, "http://www.lufa-lub.org\n"); + fprintf(stderr, "http://www.lufa-lib.org\n"); fprintf(stderr, "\nBased on the TeensyHID command line programmer software:\n"); fprintf(stderr, "http://www.pjrc.com/teensy/loader_cli.html\n"); @@ -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,21 +392,9 @@ 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; } -void print_win32_err(void) -{ - char buf[256]; - DWORD err; - - err = GetLastError(); - FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, - 0, buf, sizeof(buf), NULL); - printf("err %ld: %s\n", err, buf); -} - static HANDLE win32_teensy_handle = NULL; int teensy_open(void) @@ -710,10 +700,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 +791,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 +817,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; @@ -979,13 +970,9 @@ void parse_options(int argc, char **argv) } else if (strncmp(arg, "-mmcu=", 6) == 0) { arg += 6; - uint8_t valid_prefix = 0; - if (strncmp(arg, "at90usb", 7) == 0) { - valid_prefix = 1; arg += 7; } else if (strncmp(arg, "atmega", 6) == 0) { - valid_prefix = 1; arg += 6; } else { die("Unknown MCU type\n");