projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' into droid-gps
[fw/altos]
/
libaltos
/
libaltos.c
diff --git
a/libaltos/libaltos.c
b/libaltos/libaltos.c
index 2a41ef80159e1813f7573672fe049a69d1c78a65..ad03e638e2a4937e0c7bd913afef88e8fcb862f9 100644
(file)
--- 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;
struct altos_file *file = calloc (1, sizeof (struct altos_file));
char full_name[64];
COMMTIMEOUTS timeouts;
+ int i;
if (!file)
return NULL;
if (!file)
return NULL;
@@
-1326,7
+1327,15
@@
altos_open(struct altos_device *device)
strcpy(full_name, "\\\\.\\");
strcat(full_name, device->path);
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;
if (file->handle == INVALID_HANDLE_VALUE) {
free(file);
return NULL;