From 3b4309645fef73a378968e98b8678a1d2deb70a1 Mon Sep 17 00:00:00 2001 From: Kristoffer Larsen Date: Tue, 30 Oct 2012 07:56:08 +0100 Subject: [PATCH] Higher timeout when programing via wireless. --- cctl-prog/cctl-prog.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cctl-prog/cctl-prog.c b/cctl-prog/cctl-prog.c index 17209af..6f70209 100644 --- a/cctl-prog/cctl-prog.c +++ b/cctl-prog/cctl-prog.c @@ -9,8 +9,6 @@ #include #include -#define SERIAL_TIMEOUT 2 - #ifdef __CYGWIN__ #undef WIN32 #endif @@ -63,6 +61,7 @@ static char *flash_filename = NULL; static char *device_name = NULL; static bool opt_passthrough = 0; static bool opt_wireless = 0; +static int serial_timeout = 2; #ifndef WIN32 static struct termios orig_termios; @@ -85,6 +84,7 @@ int parse_options(int argc, char **argv) break; case 'w': opt_wireless = 1; + serial_timeout = 4; break; case 'p': opt_passthrough = 1; @@ -266,7 +266,7 @@ int serialRead(int fd, void* buf, int len) return rc; gettimeofday(&now, NULL); } - while((now.tv_sec - start.tv_sec) < SERIAL_TIMEOUT); + while((now.tv_sec - start.tv_sec) < serial_timeout); return 1; } @@ -302,7 +302,7 @@ int serialWrite(int fd, void* buf, int len) return rc; gettimeofday(&now, NULL); } - while((now.tv_sec - start.tv_sec) < SERIAL_TIMEOUT); + while((now.tv_sec - start.tv_sec) < serial_timeout); return 1; }