summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com>2024-04-13 04:35:47 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2024-04-13 04:35:47 +0000
commit73c6f08f5ebe8a04c20d82d4d5375a5a2338ca11 (patch)
tree97410cb06a6941bd58eadf8574499523cf510766
parent4922633d3fdb7f26f38b260145b0af9b5ee0337c (diff)
parent7199051aaf0ddfa2849650933119307327d8669c (diff)
downloadcore-73c6f08f5ebe8a04c20d82d4d5375a5a2338ca11.tar.gz
Merge "Wait for disconnect when rebooting to userspace FB" into main
-rw-r--r--fastboot/fastboot.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp
index 12a1ddc87..6b9e493eb 100644
--- a/fastboot/fastboot.cpp
+++ b/fastboot/fastboot.cpp
@@ -1547,9 +1547,14 @@ bool is_userspace_fastboot() {
void reboot_to_userspace_fastboot() {
fb->RebootTo("fastboot");
+ if (fb->WaitForDisconnect() != fastboot::SUCCESS) {
+ die("Error waiting for USB disconnect.");
+ }
fb->set_transport(nullptr);
- // Give the current connection time to close.
+ // Not all platforms support WaitForDisconnect. There also isn't a great way to tell whether
+ // or not WaitForDisconnect is supported. So, just wait a bit extra for everyone, in order to
+ // make sure that the device has had time to initiate its reboot and disconnect itself.
std::this_thread::sleep_for(std::chrono::seconds(1));
fb->set_transport(open_device());