Created
January 12, 2014 05:22
-
-
Save dwilkins/8381277 to your computer and use it in GitHub Desktop.
Patch for avrdude to make rfcomm devices work again
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: ser_posix.c | |
=================================================================== | |
--- ser_posix.c (revision 1255) | |
+++ ser_posix.c (working copy) | |
@@ -315,6 +315,7 @@ | |
static int ser_send(union filedescriptor *fd, unsigned char * buf, size_t buflen) | |
{ | |
int rc; | |
+ int retries = 10; | |
unsigned char * p = buf; | |
size_t len = buflen; | |
@@ -344,6 +345,10 @@ | |
while (len) { | |
rc = write(fd->ifd, p, (len > 1024) ? 1024 : len); | |
+ if (rc < 0 && errno == ENOTCONN && retries--) { | |
+ sleep(1); | |
+ continue; | |
+ } | |
if (rc < 0) { | |
fprintf(stderr, "%s: ser_send(): write error: %s\n", | |
progname, strerror(errno)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment