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

platform/arm: Decode IP address directly

Convert bytes to a string when acquired rather than in the calling
functions.
This commit is contained in:
Marc Bonnici 2020-04-03 18:46:43 +01:00
parent 7ade1b8bcc
commit 6f1ffee2b7

View File

@ -90,9 +90,6 @@ class VersatileExpressPlatform(Platform):
def _init_android_target(self, target):
if target.connection_settings.get('device') is None:
addr = self._get_target_ip_address(target)
if sys.version_info[0] == 3:
# Convert bytes to string for Python3 compatibility
addr = addr.decode("utf-8")
target.connection_settings['device'] = addr + ':5555'
def _init_linux_target(self, target):
@ -119,7 +116,7 @@ class VersatileExpressPlatform(Platform):
time.sleep(1)
try:
tty.expect(r'inet ([1-9]\d*.\d+.\d+.\d+)', timeout=10)
return tty.match.group(1)
return tty.match.group(1).decode('utf-8')
except pexpect.TIMEOUT:
pass # We have our own timeout -- see below.
if (time.time() - wait_start_time) > self.ready_timeout: