Higher timeout when programing via wireless.

This commit is contained in:
Kristoffer Larsen committed 2012-10-30 07:56:08 +01:00
1 parent b8cfebafd3
commit 3b4309645f
1 file changed
+4 -4
+4 -4
View File
@@ -9,8 +9,6 @@
#include <getopt.h> #include <getopt.h>
#include <sys/time.h> #include <sys/time.h>
#define SERIAL_TIMEOUT 2
#ifdef __CYGWIN__ #ifdef __CYGWIN__
#undef WIN32 #undef WIN32
#endif #endif
@@ -63,6 +61,7 @@ static char *flash_filename = NULL;
static char *device_name = NULL; static char *device_name = NULL;
static bool opt_passthrough = 0; static bool opt_passthrough = 0;
static bool opt_wireless = 0; static bool opt_wireless = 0;
static int serial_timeout = 2;
#ifndef WIN32 #ifndef WIN32
static struct termios orig_termios; static struct termios orig_termios;
@@ -85,6 +84,7 @@ int parse_options(int argc, char **argv)
break; break;
case 'w': case 'w':
opt_wireless = 1; opt_wireless = 1;
serial_timeout = 4;
break; break;
case 'p': case 'p':
opt_passthrough = 1; opt_passthrough = 1;
@@ -266,7 +266,7 @@ int serialRead(int fd, void* buf, int len)
return rc; return rc;
gettimeofday(&now, NULL); gettimeofday(&now, NULL);
} }
while((now.tv_sec - start.tv_sec) < SERIAL_TIMEOUT); while((now.tv_sec - start.tv_sec) < serial_timeout);
return 1; return 1;
} }
@@ -302,7 +302,7 @@ int serialWrite(int fd, void* buf, int len)
return rc; return rc;
gettimeofday(&now, NULL); gettimeofday(&now, NULL);
} }
while((now.tv_sec - start.tv_sec) < SERIAL_TIMEOUT); while((now.tv_sec - start.tv_sec) < serial_timeout);
return 1; return 1;
} }