diff options
author | Elliott Hughes <enh@google.com> | 2018-03-29 14:46:29 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2018-04-02 11:01:48 -0700 |
commit | f238d8751b9960362ae0cf7e5476ab510461db9d (patch) | |
tree | d91ea7f622213a52ce0fdbb3e325fbaaf1bba122 /fastboot/engine.cpp | |
parent | 539f3ddff5ffb124fa75d4557647092d601d9d69 (diff) |
Modernize fastboot output format.
After:
--------------------------------------------
Bootloader Version...: 0.5
Baseband Version.....: 0.5
Serial Number........: serialv1.0
--------------------------------------------
Checking product OKAY [ 0.032s]
Sending 'boot' (9962 KB) OKAY [ 0.350s]
Writing 'boot' OKAY [ 0.143s]
Sending 'dts' (14 KB) OKAY [ 0.068s]
Writing 'dts' OKAY [ 0.048s]
Sending sparse 'system' 1/2 (460796 KB) OKAY [ 14.383s]
Writing sparse 'system' 1/2 OKAY [ 4.138s]
Sending sparse 'system' 2/2 (443712 KB) OKAY [ 13.871s]
Writing sparse 'system' 2/2 OKAY [ 3.246s]
Rebooting
Finished. Total time: 36.962s
For a failure:
extracting android-info.txt (0 MB) to RAM...
--------------------------------------------
Bootloader Version...: 0.5
Baseband Version.....: 0.5
Serial Number........: serialv1.0
--------------------------------------------
Checking product FAILED
Device product is 'hikey960'.
Update requires 'marlin' or 'sailfish'.
fastboot: error: requirements not met!
This change also adds a -v/--verbose flag, but doesn't make much use of
it yet (http://b/30953083 will need it).
Bug: N/A
Test: manual
Change-Id: I7d19f5775859ffad5f3be5707b37dcb6e180917f
Diffstat (limited to 'fastboot/engine.cpp')
-rw-r--r-- | fastboot/engine.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/fastboot/engine.cpp b/fastboot/engine.cpp index 60b71247e..875e7b96d 100644 --- a/fastboot/engine.cpp +++ b/fastboot/engine.cpp @@ -109,32 +109,32 @@ static Action& queue_action(Op op, const std::string& cmd) { void fb_set_active(const std::string& slot) { Action& a = queue_action(OP_COMMAND, "set_active:" + slot); - a.msg = "Setting current slot to '" + slot + "'..."; + a.msg = "Setting current slot to '" + slot + "'"; } void fb_queue_erase(const std::string& partition) { Action& a = queue_action(OP_COMMAND, "erase:" + partition); - a.msg = "Erasing '" + partition + "'..."; + a.msg = "Erasing '" + partition + "'"; } void fb_queue_flash_fd(const std::string& partition, int fd, uint32_t sz) { Action& a = queue_action(OP_DOWNLOAD_FD, ""); a.fd = fd; a.size = sz; - a.msg = android::base::StringPrintf("Sending '%s' (%d KB)...", partition.c_str(), sz / 1024); + a.msg = android::base::StringPrintf("Sending '%s' (%u KB)", partition.c_str(), sz / 1024); Action& b = queue_action(OP_COMMAND, "flash:" + partition); - b.msg = "Writing '" + partition + "'..."; + b.msg = "Writing '" + partition + "'"; } void fb_queue_flash(const std::string& partition, void* data, uint32_t sz) { Action& a = queue_action(OP_DOWNLOAD, ""); a.data = data; a.size = sz; - a.msg = android::base::StringPrintf("Sending '%s' (%d KB)...", partition.c_str(), sz / 1024); + a.msg = android::base::StringPrintf("Sending '%s' (%u KB)", partition.c_str(), sz / 1024); Action& b = queue_action(OP_COMMAND, "flash:" + partition); - b.msg = "Writing '" + partition + "'..."; + b.msg = "Writing '" + partition + "'"; } void fb_queue_flash_sparse(const std::string& partition, struct sparse_file* s, uint32_t sz, @@ -142,12 +142,12 @@ void fb_queue_flash_sparse(const std::string& partition, struct sparse_file* s, Action& a = queue_action(OP_DOWNLOAD_SPARSE, ""); a.data = s; a.size = 0; - a.msg = android::base::StringPrintf("Sending sparse '%s' %zu/%zu (%d KB)...", partition.c_str(), + a.msg = android::base::StringPrintf("Sending sparse '%s' %zu/%zu (%u KB)", partition.c_str(), current, total, sz / 1024); Action& b = queue_action(OP_COMMAND, "flash:" + partition); - b.msg = - android::base::StringPrintf("Writing '%s' %zu/%zu...", partition.c_str(), current, total); + b.msg = android::base::StringPrintf("Writing sparse '%s' %zu/%zu", partition.c_str(), current, + total); } static int match(const char* str, const char** value, unsigned count) { @@ -270,7 +270,7 @@ static int cb_do_nothing(Action&, int, const char*) { void fb_queue_reboot() { Action& a = queue_action(OP_COMMAND, "reboot"); a.func = cb_do_nothing; - a.msg = "Rebooting..."; + a.msg = "Rebooting"; } void fb_queue_command(const std::string& cmd, const std::string& msg) { @@ -289,7 +289,7 @@ void fb_queue_download_fd(const std::string& name, int fd, uint32_t sz) { Action& a = queue_action(OP_DOWNLOAD_FD, ""); a.fd = fd; a.size = sz; - a.msg = android::base::StringPrintf("Sending '%s' (%d KB)", name.c_str(), sz / 1024); + a.msg = android::base::StringPrintf("Sending '%s' (%u KB)", name.c_str(), sz / 1024); } void fb_queue_upload(const std::string& outfile) { @@ -312,7 +312,7 @@ int64_t fb_execute_queue(Transport* transport) { for (auto& a : action_list) { a->start = now(); if (!a->msg.empty()) { - fprintf(stderr, "%s\n", a->msg.c_str()); + fprintf(stderr, "%-50s ", a->msg.c_str()); } if (a->op == OP_DOWNLOAD) { status = fb_download_data(transport, a->data, a->size); @@ -333,6 +333,7 @@ int64_t fb_execute_queue(Transport* transport) { if (status) break; } else if (a->op == OP_NOTICE) { // We already showed the notice because it's in `Action::msg`. + fprintf(stderr, "\n"); } else if (a->op == OP_DOWNLOAD_SPARSE) { status = fb_download_data_sparse(transport, reinterpret_cast<sparse_file*>(a->data)); status = a->func(*a, status, status ? fb_get_error().c_str() : ""); |