summaryrefslogtreecommitdiff
path: root/fastboot/fastboot_driver.cpp
diff options
context:
space:
mode:
authorDima Zavin <dmitriyz@waymo.com>2019-02-23 21:14:38 -0800
committerDima Zavin <dmitriyz@waymo.com>2019-02-28 14:55:49 -0800
commit8f9822d576d07adf57678a64fb01e3610b81d00b (patch)
tree24c6b42eb0deb8217b650da0360f58686e6aa1e8 /fastboot/fastboot_driver.cpp
parent2bdca4f6e1de4adee5a7f4ca106a45da020fcb08 (diff)
fastboot: reset timeout if INFO is received during long commands
As part of a refactor, commit db511207ed3b2bb4fc422ef83868009b03692e61 added a timeout for receving responses for commands. Unfortunately, the timeout is optimistic as to how quickly target devices can complete such operations. Flash and erase commands can be quite slow on devices with traditional flash chips. The fastboot protocol is already adept at handling such cases because it allows for sending INFO packets during these periods. We may receive one or more INFO packets during tehse long operations. Every time we receive an INFO packet, it proves the remote end is alive, but busy, which should reset our timeout timer. Change-Id: Ia3bba21c497b22639b626d89711ecd4eb02504ed Signed-off-by: Dima Zavin <dmitriyz@waymo.com>
Diffstat (limited to 'fastboot/fastboot_driver.cpp')
-rw-r--r--fastboot/fastboot_driver.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/fastboot/fastboot_driver.cpp b/fastboot/fastboot_driver.cpp
index 4deed94a04..fea0a77e5b 100644
--- a/fastboot/fastboot_driver.cpp
+++ b/fastboot/fastboot_driver.cpp
@@ -427,6 +427,11 @@ RetCode FastBootDriver::HandleResponse(std::string* response, std::vector<std::s
std::string tmp = input.substr(strlen("INFO"));
info_(tmp);
add_info(std::move(tmp));
+ // We may receive one or more INFO packets during long operations,
+ // e.g. flash/erase if they are back by slow media like NAND/NOR
+ // flash. In that case, reset the timer since it's not a real
+ // timeout.
+ start = std::chrono::steady_clock::now();
} else if (android::base::StartsWith(input, "OKAY")) {
set_response(input.substr(strlen("OKAY")));
return SUCCESS;