From 0c7eb9e91e46fd551d9986afebe10670b1f160aa Mon Sep 17 00:00:00 2001 From: Patrick Bellasi Date: Wed, 12 Jul 2017 12:30:30 +0100 Subject: [PATCH] target: add support to kill/restart and ADB connection Sometimes it could be useful to disconnect from the target, for example when a "pass thought" energy monitor is used to control the USB connection to the device. This patch adds a couple of utility methods which allows to kill the ADB server and restart it while waiting for the device to be ready to accept new connections. Signed-off-by: Patrick Bellasi --- devlib/target.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/devlib/target.py b/devlib/target.py index 8a38a8c..e9b24df 100644 --- a/devlib/target.py +++ b/devlib/target.py @@ -1077,6 +1077,12 @@ class AndroidTarget(Target): def clear_logcat(self): adb_command(self.adb_name, 'logcat -c', timeout=30) + def adb_kill_server(self, timeout=30): + adb_command(self.adb_name, 'kill-server', timeout) + + def adb_wait_for_device(self, timeout=30): + adb_command(self.adb_name, 'wait-for-device', timeout) + def adb_reboot_bootloader(self, timeout=30): adb_command(self.adb_name, 'reboot-bootloader', timeout)