Merge \\"Better diagnostics from \\"adb sideload\\".\\" am: edd401e24e
am: c63439ae7f
Change-Id: Iba368cdb974292d8e2cce1cfac7a96ef93809e1f
diff --git a/adb/commandline.cpp b/adb/commandline.cpp
index ec0a467..084985a 100644
--- a/adb/commandline.cpp
+++ b/adb/commandline.cpp
@@ -887,19 +887,18 @@
* we hang up.
*/
static int adb_sideload_host(const char* fn) {
- printf("loading: '%s'", fn);
- fflush(stdout);
+ fprintf(stderr, "loading: '%s'...\n", fn);
std::string content;
if (!android::base::ReadFileToString(fn, &content)) {
- printf("\n");
- fprintf(stderr, "* cannot read '%s' *\n", fn);
+ fprintf(stderr, "failed: %s\n", strerror(errno));
return -1;
}
const uint8_t* data = reinterpret_cast<const uint8_t*>(content.data());
unsigned sz = content.size();
+ fprintf(stderr, "connecting...\n");
std::string service =
android::base::StringPrintf("sideload-host:%d:%d", sz, SIDELOAD_HOST_BLOCK_SIZE);
std::string error;
@@ -907,7 +906,7 @@
if (fd < 0) {
// Try falling back to the older sideload method. Maybe this
// is an older device that doesn't support sideload-host.
- printf("\n");
+ fprintf(stderr, "falling back to older sideload method...\n");
return adb_download_buffer("sideload", fn, data, sz, true);
}