1
0
mirror of https://github.com/ARM-software/devlib.git synced 2024-10-06 10:50:51 +01:00

tagert: factor out the wait_boot_complete code

The connect() method embeds some code to wait for a target to be
completely booted.

Let's move this code into a dedicated function.

Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
This commit is contained in:
Patrick Bellasi 2017-07-12 12:27:28 +01:00
parent 2e106c9f70
commit f26f942723

View File

@ -877,8 +877,16 @@ class AndroidTarget(Target):
pass
self._connected_as_root = None
def connect(self, timeout=10, check_boot_completed=True): # pylint: disable=arguments-differ
def wait_boot_complete(self, timeout=10):
start = time.time()
boot_completed = boolean(self.getprop('sys.boot_completed'))
while not boot_completed and timeout >= time.time() - start:
time.sleep(5)
boot_completed = boolean(self.getprop('sys.boot_completed'))
if not boot_completed:
raise TargetError('Connected but Android did not fully boot.')
def connect(self, timeout=10, check_boot_completed=True): # pylint: disable=arguments-differ
device = self.connection_settings.get('device')
if device and ':' in device:
# ADB does not automatically remove a network device from it's
@ -890,12 +898,7 @@ class AndroidTarget(Target):
super(AndroidTarget, self).connect(timeout=timeout)
if check_boot_completed:
boot_completed = boolean(self.getprop('sys.boot_completed'))
while not boot_completed and timeout >= time.time() - start:
time.sleep(5)
boot_completed = boolean(self.getprop('sys.boot_completed'))
if not boot_completed:
raise TargetError('Connected but Android did not fully boot.')
self.wait_boot_complete(timeout)
def setup(self, executables=None):
super(AndroidTarget, self).setup(executables)