Skip to content

Commit 6f1ffee

Browse files
committed
platform/arm: Decode IP address directly
Convert bytes to a string when acquired rather than in the calling functions.
1 parent 7ade1b8 commit 6f1ffee

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

devlib/platform/arm.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,6 @@ def init_target_connection(self, target):
9090
def _init_android_target(self, target):
9191
if target.connection_settings.get('device') is None:
9292
addr = self._get_target_ip_address(target)
93-
if sys.version_info[0] == 3:
94-
# Convert bytes to string for Python3 compatibility
95-
addr = addr.decode("utf-8")
9693
target.connection_settings['device'] = addr + ':5555'
9794

9895
def _init_linux_target(self, target):
@@ -119,7 +116,7 @@ def _get_target_ip_address(self, target):
119116
time.sleep(1)
120117
try:
121118
tty.expect(r'inet ([1-9]\d*.\d+.\d+.\d+)', timeout=10)
122-
return tty.match.group(1)
119+
return tty.match.group(1).decode('utf-8')
123120
except pexpect.TIMEOUT:
124121
pass # We have our own timeout -- see below.
125122
if (time.time() - wait_start_time) > self.ready_timeout:

0 commit comments

Comments
 (0)