projects
/
pub
/
USBasp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
CI: Build on Arch (bleeding-ege) and Ubuntu (stable) AVR-GCC toolchains.
[pub/USBasp.git]
/
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
200f406
..
b54f943
100644
(file)
--- a/
Bootloaders/HID/HostLoaderApp/hid_bootloader_cli.c
+++ b/
Bootloaders/HID/HostLoaderApp/hid_bootloader_cli.c
@@
-395,17
+395,6
@@
int write_usb_device(HANDLE h, void *buf, int len, int timeout)
return 1;
}
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)
static HANDLE win32_teensy_handle = NULL;
int teensy_open(void)
@@
-668,6
+657,11
@@
int hard_reboot(void)
#include <dev/usb/usb_ioctl.h>
#endif
#include <dev/usb/usb_ioctl.h>
#endif
+#ifndef USB_GET_DEVICEINFO
+# define USB_GET_DEVICEINFO 0
+# error The USB_GET_DEVICEINFO ioctl() value is not defined for your system.
+#endif
+
int open_usb_device(int vid, int pid)
{
int r, fd;
int open_usb_device(int vid, int pid)
{
int r, fd;
@@
-723,7
+717,7
@@
int teensy_write(void *buf, int len, double timeout)
{
int r;
{
int r;
- // TODO: im
e
plement timeout... how??
+ // TODO: implement timeout... how??
r = write(uhid_teensy_fd, buf, len);
if (r == len) return 1;
return 0;
r = write(uhid_teensy_fd, buf, len);
if (r == len) return 1;
return 0;
@@
-818,7
+812,7
@@
int read_intel_hex(const char *filename)
/* parses a line of intel hex code, stores the data in bytes[] */
/* and the beginning address in addr, and returns a 1 if the */
/* parses a line of intel hex code, stores the data in bytes[] */
/* and the beginning address in addr, and returns a 1 if the */
-/* line was valid, or a 0 if an error occured. The variable */
+/* line was valid, or a 0 if an error occur
r
ed. The variable */
/* num gets the number of bytes that were stored into bytes[] */
/* num gets the number of bytes that were stored into bytes[] */
@@
-927,21
+921,22
@@
void ihex_get_data(int addr, int len, unsigned char *bytes)
int printf_verbose(const char *format, ...)
{
va_list ap;
int printf_verbose(const char *format, ...)
{
va_list ap;
- int r;
+ int r
= 0
;
va_start(ap, format);
if (verbose) {
r = vprintf(format, ap);
fflush(stdout);
va_start(ap, format);
if (verbose) {
r = vprintf(format, ap);
fflush(stdout);
- return r;
}
}
- return 0;
+ va_end(ap);
+
+ return r;
}
void delay(double seconds)
{
}
void delay(double seconds)
{
- #ifdef WIN32
-
S
leep(seconds * 1000.0);
+ #ifdef
USE_
WIN32
+
s
leep(seconds * 1000.0);
#else
usleep(seconds * 1000000.0);
#endif
#else
usleep(seconds * 1000000.0);
#endif
@@
-954,10
+949,12
@@
void die(const char *str, ...)
va_start(ap, str);
vfprintf(stderr, str, ap);
fprintf(stderr, "\n");
va_start(ap, str);
vfprintf(stderr, str, ap);
fprintf(stderr, "\n");
+ va_end(ap);
+
exit(1);
}
exit(1);
}
-#if defined
(WIN32)
+#if defined
USE_WIN32
#define strcasecmp stricmp
#endif
#define strcasecmp stricmp
#endif
@@
-981,13
+978,9
@@
void parse_options(int argc, char **argv)
} else if (strncmp(arg, "-mmcu=", 6) == 0) {
arg += 6;
} else if (strncmp(arg, "-mmcu=", 6) == 0) {
arg += 6;
- uint8_t valid_prefix = 0;
-
if (strncmp(arg, "at90usb", 7) == 0) {
if (strncmp(arg, "at90usb", 7) == 0) {
- valid_prefix = 1;
arg += 7;
} else if (strncmp(arg, "atmega", 6) == 0) {
arg += 7;
} else if (strncmp(arg, "atmega", 6) == 0) {
- valid_prefix = 1;
arg += 6;
} else {
die("Unknown MCU type\n");
arg += 6;
} else {
die("Unknown MCU type\n");