Commit 650b477c authored by Bjorn Andersson's avatar Bjorn Andersson
Browse files

firehose: Drain logs on write timeout



On db410c writes sometimes fails becasue the device had more log entries
to read after the <response> and refuses writes until these are drained.

Deal with this by attempting a read when write fails with a timeout.
Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
parent 00d93b29
......@@ -168,11 +168,25 @@ static int firehose_write(struct qdl_device *qdl, xmlDoc *doc)
xmlDocDumpMemory(doc, &s, &len);
if (qdl_debug)
fprintf(stderr, "FIREHOSE WRITE: %s\n", s);
ret = qdl_write(qdl, s, len);
saved_errno = errno;
for (;;) {
if (qdl_debug)
fprintf(stderr, "FIREHOSE WRITE: %s\n", s);
ret = qdl_write(qdl, s, len);
saved_errno = errno;
/*
* db410c sometimes sense a <response> followed by <log>
* entries and won't accept write commands until these are
* drained, so attempt to read any pending data and then retry
* the write.
*/
if (ret < 0 && errno == ETIMEDOUT) {
firehose_read(qdl, 100, firehose_generic_parser, NULL);
} else {
break;
}
}
xmlFree(s);
return ret < 0 ? -saved_errno : 0;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment