From 0687dac23b6b9ea32d06d3d4e8b58b00e7edc46e Mon Sep 17 00:00:00 2001 From: Marc Bonnici Date: Tue, 28 Feb 2017 13:48:10 +0000 Subject: [PATCH] Target: Invalidates _connected_as_root on reboot or reset. From #92, when rebooting a platform the internal connection state becomes different from `_connected_as_root`, now clears the state upon device reboot or reset. --- devlib/target.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/devlib/target.py b/devlib/target.py index d19750a..c9b0121 100644 --- a/devlib/target.py +++ b/devlib/target.py @@ -269,6 +269,7 @@ class Target(object): timeout = max(timeout - reset_delay, 10) if self.has('boot'): self.boot() # pylint: disable=no-member + self._connected_as_root = None if connect: self.connect(timeout=timeout) @@ -359,6 +360,7 @@ class Target(object): except (TargetError, TimeoutError, subprocess.CalledProcessError): # on some targets "reboot" doesn't return gracefully pass + self._connected_as_root = None def check_responsive(self): try: @@ -841,6 +843,7 @@ class AndroidTarget(Target): except (TargetError, TimeoutError, subprocess.CalledProcessError): # on some targets "reboot" doesn't return gracefully pass + self._connected_as_root = None def connect(self, timeout=10, check_boot_completed=True): # pylint: disable=arguments-differ start = time.time()