#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 r;
- // TODO: imeplement timeout... how??
+ // TODO: implement timeout... how??
r = write(uhid_teensy_fd, buf, len);
if (r == len) return 1;
return 0;
/* 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 occurred. The variable */
/* num gets the number of bytes that were stored into bytes[] */
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);
- return r;
}
- return 0;
+ va_end(ap);
+
+ return r;
}
void delay(double seconds)
{
- #ifdef WIN32
- Sleep(seconds * 1000.0);
+ #ifdef USE_WIN32
+ sleep(seconds * 1000.0);
#else
usleep(seconds * 1000000.0);
#endif
va_start(ap, str);
vfprintf(stderr, str, ap);
fprintf(stderr, "\n");
+ va_end(ap);
+
exit(1);
}
-#if defined(WIN32)
+#if defined USE_WIN32
#define strcasecmp stricmp
#endif