From 94fb8aeaf500a5b4c8eff4eef6476f633d8a2d0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCrten?= <sebastian@mobanisto.de> Date: Thu, 8 Dec 2022 09:30:55 +0100 Subject: [PATCH] Handle USB disconnect and reconnect properly --- mobly/mesh-run/public_mesh_test.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mobly/mesh-run/public_mesh_test.py b/mobly/mesh-run/public_mesh_test.py index 3579fe2..de0cac8 100644 --- a/mobly/mesh-run/public_mesh_test.py +++ b/mobly/mesh-run/public_mesh_test.py @@ -20,7 +20,15 @@ class PublicMeshTest(base_test.BaseTestClass): self.droid2.pm.startActivity() self.droid1.pm.startAdvertising() self.droid2.pm.startDiscovery() - time.sleep(10) + with self.droid1.handle_usb_disconnect(): + with self.droid2.handle_usb_disconnect(): + maxWaitDisconnect = 10 + print("waiting for disconnect for", maxWaitDisconnect, "seconds") + time.sleep(maxWaitDisconnect) + print("wait for device 1") + self.droid1.adb.wait_for_device() + print("wait for device 2") + self.droid2.adb.wait_for_device() if __name__ == '__main__': test_runner.main() -- GitLab