mirror of
https://github.com/espressif/openthread.git
synced 2026-06-06 05:24:51 +00:00
[otci] fix command issue after factoryreset (#6670)
This commit is contained in:
@@ -95,7 +95,10 @@ class OtCliCommandRunner(OTCommandHandler):
|
||||
def execute_command(self, cmd, timeout=10) -> List[str]:
|
||||
self.__otcli.writeline(cmd)
|
||||
|
||||
if cmd in {'reset', 'factoryreset'}:
|
||||
if cmd in ('reset', 'factoryreset'):
|
||||
self.wait(3)
|
||||
self.__otcli.writeline('extaddr')
|
||||
self.wait(1)
|
||||
return []
|
||||
|
||||
if self.__expect_command_echoback:
|
||||
@@ -210,6 +213,10 @@ class OtbrSshCommandRunner(OTCommandHandler):
|
||||
raise CommandError(cmd, [err])
|
||||
|
||||
output = [l.rstrip('\r\n') for l in cmd_out.readlines()]
|
||||
|
||||
if cmd in ('reset', 'factoryreset'):
|
||||
self.wait(3)
|
||||
|
||||
return output
|
||||
|
||||
def close(self):
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
import ipaddress
|
||||
import logging
|
||||
import re
|
||||
import time
|
||||
from collections import Counter
|
||||
from typing import List, Collection, Union, Tuple, Optional, Dict, Pattern, Any
|
||||
|
||||
@@ -105,7 +104,6 @@ class OTCI(object):
|
||||
self.__logger and self.__logger.info('%s', line)
|
||||
|
||||
if cmd in ('reset', 'factoryreset'):
|
||||
self.__wait_reset()
|
||||
return output
|
||||
|
||||
if output[-1] == 'Done':
|
||||
@@ -2335,12 +2333,6 @@ class OTCI(object):
|
||||
s = s.replace(char, '\\%s' % char)
|
||||
return s
|
||||
|
||||
def __wait_reset(self):
|
||||
# reset would restart the otbr-agent executable. It's risky to send commands after reset too quickly because
|
||||
# it might cause ot-ctl to quit abnormally.
|
||||
# So we sleep for a while after reset.
|
||||
time.sleep(3)
|
||||
|
||||
def __txt_to_hex(self, txt: Dict[str, Union[str, bytes, bool]]) -> str:
|
||||
txt_bin = b''
|
||||
for k, v in txt.items():
|
||||
|
||||
Reference in New Issue
Block a user