diff options
Diffstat (limited to 'adb/commandline.c')
| -rw-r--r-- | adb/commandline.c | 136 |
1 files changed, 1 insertions, 135 deletions
diff --git a/adb/commandline.c b/adb/commandline.c index cbf079c4..be596ce5 100644 --- a/adb/commandline.c +++ b/adb/commandline.c @@ -144,7 +144,6 @@ void help() " adb start-server - ensure that there is a server running\n" " adb kill-server - kill the server if it is running\n" " adb get-state - prints: offline | bootloader | device\n" - " adb get-product - prints: <product-id>\n" " adb get-serialno - prints: <serial-number>\n" " adb status-window - continuously print device status for a specified device\n" " adb remount - remounts the /system partition on the device read-write\n" @@ -377,82 +376,6 @@ int interactive_shell(void) } - -int adb_download_buffer(const char *service, const void* data, int sz, - unsigned progress) -{ - char buf[4096]; - unsigned total; - int fd; - const unsigned char *ptr; - - snprintf(buf, sizeof buf, "%s:%d", service, sz); - fd = adb_connect(buf); - if(fd < 0) { - fprintf(stderr,"error: %s\n", adb_error()); - return -1; - } - - adb_socket_setbufsize(fd, CHUNK_SIZE); - - total = sz; - ptr = data; - - if(progress) { - char *x = strrchr(service, ':'); - if(x) service = x + 1; - } - - while(sz > 0) { - unsigned xfer = (sz > CHUNK_SIZE) ? CHUNK_SIZE : sz; - if(writex(fd, ptr, xfer)) { - adb_status(fd); - fprintf(stderr,"* failed to write data '%s' *\n", adb_error()); - return -1; - } - sz -= xfer; - ptr += xfer; - if(progress) { - int percent = 100 - (int)(100.0 * ((float)sz / (float)total)); - printf("sending: '%s' %4d%% \r", service, percent); - fflush(stdout); - } - } - if(progress) { - printf("\n"); - } - - if(readx(fd, buf, 4)){ - fprintf(stderr,"* error reading response *\n"); - adb_close(fd); - return -1; - } - if(memcmp(buf, "OKAY", 4)) { - buf[4] = 0; - fprintf(stderr,"* error response '%s' *\n", buf); - adb_close(fd); - return -1; - } - - adb_close(fd); - return 0; -} - - -int adb_download(const char *service, const char *fn, unsigned progress) -{ - void *data; - unsigned sz; - - data = load_file(fn, &sz); - if(data == 0) { - fprintf(stderr,"* cannot read '%s' *\n", service); - return -1; - } - - return adb_download_buffer(service, data, sz, progress); -} - static void format_host_command(char* buffer, size_t buflen, const char* command, transport_type ttype, const char* serial) { if (serial) { @@ -678,13 +601,6 @@ static int logcat(transport_type transport, char* serial, int argc, char **argv) return 0; } -int adb_download_data(const char *what, const void* data, int sz, unsigned progress) -{ - char service[4096]; - snprintf(service, sizeof service, "bootloader:flash:%s", what); - return adb_download_buffer(service, data, sz, 1); -} - #define SENTINEL_FILE "config" OS_PATH_SEPARATOR_STR "envsetup.make" static int top_works(const char *top) { @@ -977,32 +893,6 @@ top: } } - if(!strcmp(argv[0], "debug")) { - int fd = adb_connect("bootdebug:"); - if(fd >= 0) { - read_and_dump(fd); - adb_close(fd); - return 0; - } - fprintf(stderr,"error: %s\n", adb_error()); - return 1; - } - - if(!strcmp(argv[0], "bl")) { - int fd; - if(argc != 2) return usage(); - snprintf(buf, sizeof buf, "bootloader:%s", argv[1]); - fd = adb_connect(buf); - if(fd >= 0) { - read_and_dump(fd); - adb_close(fd); - return 0; - } else { - fprintf(stderr,"* command failed: %s *\n", adb_error()); - } - return 1; - } - if(!strcmp(argv[0], "kill-server")) { int fd; fd = _adb_connect("host:kill"); @@ -1024,27 +914,6 @@ top: return 1; } - /* adb_download() commands */ - - if(!strcmp(argv[0], "send")) { - if(argc != 3) return usage(); - snprintf(buf, sizeof buf, "bootloader:send:%s", argv[1]); - if(adb_download(buf, argv[2], 1)) { - return 1; - } else { - return 0; - } - } - - if(!strcmp(argv[0], "recover")) { - if(argc != 2) return usage(); - if(adb_download("recover", argv[1], 1)) { - return 1; - } else { - return 0; - } - } - if(!strcmp(argv[0], "bugreport")) { if (argc != 1) { return 1; @@ -1057,9 +926,7 @@ top: if(!strncmp(argv[0], "wait-for-", strlen("wait-for-"))) { char* service = argv[0]; - if (!strncmp(service, "wait-for-bootloader", strlen("wait-for-bootloader"))) { - fprintf(stderr,"WAIT FOR BOOTLOADER\n"); - } else if (!strncmp(service, "wait-for-device", strlen("wait-for-device"))) { + if (!strncmp(service, "wait-for-device", strlen("wait-for-device"))) { if (ttype == kTransportUsb) { service = "wait-for-usb"; } else if (ttype == kTransportLocal) { @@ -1157,7 +1024,6 @@ top: /* passthrough commands */ if(!strcmp(argv[0],"get-state") || - !strcmp(argv[0],"get-product") || !strcmp(argv[0],"get-serialno")) { char *tmp; |
