diff options
| author | Keith Packard <keithp@keithp.com> | 2013-04-13 10:51:04 -0700 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2013-04-13 10:51:04 -0700 | 
| commit | 2f7015afcca7c6042365d2124d3a5b7219e8e588 (patch) | |
| tree | cf102d2abb3f9e7141fd7b7925c0c73fb3cb61d0 /libaltos/libaltos.c | |
| parent | 5077f3ad1967a33712e9ff411e3b2a0b4e1a5c4a (diff) | |
| parent | 778daf0ccbd8a073da33497e33c29400d0ecc464 (diff) | |
Merge branch 'master' into droid-gps
Diffstat (limited to 'libaltos/libaltos.c')
| -rw-r--r-- | libaltos/libaltos.c | 11 | 
1 files changed, 10 insertions, 1 deletions
diff --git a/libaltos/libaltos.c b/libaltos/libaltos.c index 2a41ef80..ad03e638 100644 --- a/libaltos/libaltos.c +++ b/libaltos/libaltos.c @@ -1319,6 +1319,7 @@ altos_open(struct altos_device *device)  	struct altos_file	*file = calloc (1, sizeof (struct altos_file));  	char	full_name[64];  	COMMTIMEOUTS timeouts; +	int i;  	if (!file)  		return NULL; @@ -1326,7 +1327,15 @@ altos_open(struct altos_device *device)  	strcpy(full_name, "\\\\.\\");  	strcat(full_name, device->path); -	file->handle = open_serial(full_name); +	file->handle = INVALID_HANDLE_VALUE; + +	for (i = 0; i < 5; i++) { +		file->handle = open_serial(full_name); +		if (file->handle != INVALID_HANDLE_VALUE) +			break; +		Sleep(100); +	} +	  	if (file->handle == INVALID_HANDLE_VALUE) {  		free(file);  		return NULL;  | 
