mirror of
https://github.com/ARM-software/devlib.git
synced 2025-03-04 09:17:51 +00:00
plaform/juno: fix ip address from uart
In recent builds, it seems doing "ip addr list eth0" returns "no such device" when running as a regular user. Doing so as root, will give the information on the device.
This commit is contained in:
parent
83e5ddfd1b
commit
b368acb755
@ -100,22 +100,26 @@ class VersatileExpressPlatform(Platform):
|
|||||||
baudrate=self.baudrate,
|
baudrate=self.baudrate,
|
||||||
timeout=30,
|
timeout=30,
|
||||||
init_dtr=0) as tty:
|
init_dtr=0) as tty:
|
||||||
tty.sendline('')
|
tty.sendline('su') # this is, apprently, required to query network device
|
||||||
|
# info by name on recent Juno builds...
|
||||||
self.logger.debug('Waiting for the Android shell prompt.')
|
self.logger.debug('Waiting for the Android shell prompt.')
|
||||||
tty.expect(target.shell_prompt)
|
tty.expect(target.shell_prompt)
|
||||||
|
|
||||||
self.logger.debug('Waiting for IP address...')
|
self.logger.debug('Waiting for IP address...')
|
||||||
wait_start_time = time.time()
|
wait_start_time = time.time()
|
||||||
while True:
|
try:
|
||||||
tty.sendline('ip addr list eth0')
|
while True:
|
||||||
time.sleep(1)
|
tty.sendline('ip addr list eth0')
|
||||||
try:
|
time.sleep(1)
|
||||||
tty.expect(r'inet ([1-9]\d*.\d+.\d+.\d+)', timeout=10)
|
try:
|
||||||
return tty.match.group(1)
|
tty.expect(r'inet ([1-9]\d*.\d+.\d+.\d+)', timeout=10)
|
||||||
except pexpect.TIMEOUT:
|
return tty.match.group(1)
|
||||||
pass # We have our own timeout -- see below.
|
except pexpect.TIMEOUT:
|
||||||
if (time.time() - wait_start_time) > self.ready_timeout:
|
pass # We have our own timeout -- see below.
|
||||||
raise TargetError('Could not acquire IP address.')
|
if (time.time() - wait_start_time) > self.ready_timeout:
|
||||||
|
raise TargetError('Could not acquire IP address.')
|
||||||
|
finally:
|
||||||
|
tty.sendline('exit') # exit shell created by "su" call at the start
|
||||||
|
|
||||||
def _set_hard_reset_method(self, hard_reset_method):
|
def _set_hard_reset_method(self, hard_reset_method):
|
||||||
if hard_reset_method == 'dtr':
|
if hard_reset_method == 'dtr':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user