Merge "Better diagnostics from "adb sideload"."
This commit is contained in:
commit
edd401e24e
1 changed files with 4 additions and 5 deletions
|
|
@ -872,19 +872,18 @@ static int adb_download_buffer(const char *service, const char *fn, const void*
|
||||||
* we hang up.
|
* we hang up.
|
||||||
*/
|
*/
|
||||||
static int adb_sideload_host(const char* fn) {
|
static int adb_sideload_host(const char* fn) {
|
||||||
printf("loading: '%s'", fn);
|
fprintf(stderr, "loading: '%s'...\n", fn);
|
||||||
fflush(stdout);
|
|
||||||
|
|
||||||
std::string content;
|
std::string content;
|
||||||
if (!android::base::ReadFileToString(fn, &content)) {
|
if (!android::base::ReadFileToString(fn, &content)) {
|
||||||
printf("\n");
|
fprintf(stderr, "failed: %s\n", strerror(errno));
|
||||||
fprintf(stderr, "* cannot read '%s' *\n", fn);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint8_t* data = reinterpret_cast<const uint8_t*>(content.data());
|
const uint8_t* data = reinterpret_cast<const uint8_t*>(content.data());
|
||||||
unsigned sz = content.size();
|
unsigned sz = content.size();
|
||||||
|
|
||||||
|
fprintf(stderr, "connecting...\n");
|
||||||
std::string service =
|
std::string service =
|
||||||
android::base::StringPrintf("sideload-host:%d:%d", sz, SIDELOAD_HOST_BLOCK_SIZE);
|
android::base::StringPrintf("sideload-host:%d:%d", sz, SIDELOAD_HOST_BLOCK_SIZE);
|
||||||
std::string error;
|
std::string error;
|
||||||
|
|
@ -892,7 +891,7 @@ static int adb_sideload_host(const char* fn) {
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
// Try falling back to the older sideload method. Maybe this
|
// Try falling back to the older sideload method. Maybe this
|
||||||
// is an older device that doesn't support sideload-host.
|
// 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);
|
return adb_download_buffer("sideload", fn, data, sz, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue