aboutsummaryrefslogtreecommitdiff
path: root/cc3200/tools/update-wipy.py
diff options
context:
space:
mode:
authorDaniel Campora2015-06-24 15:23:03 +0200
committerDaniel Campora2015-06-24 15:26:05 +0200
commitd02f671737ebfe90026790de98b6b08752680354 (patch)
treed39d475c5df47e8885573e74329cbbcb66f2ba09 /cc3200/tools/update-wipy.py
parentd709622bd218f1bf3cf396d21bf5f22bce481e2e (diff)
cc3200: Add deploy target and improve robustness of update-wipy.py.
Diffstat (limited to 'cc3200/tools/update-wipy.py')
-rw-r--r--cc3200/tools/update-wipy.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/cc3200/tools/update-wipy.py b/cc3200/tools/update-wipy.py
index ed87388e0..078ab7c7f 100644
--- a/cc3200/tools/update-wipy.py
+++ b/cc3200/tools/update-wipy.py
@@ -21,7 +21,7 @@ from telnetlib import Telnet
def print_exception(e):
- print ('Error: {}, on line {}'.format(e, sys.exc_info()[-1].tb_lineno))
+ print ('Exception: {}, on line {}'.format(e, sys.exc_info()[-1].tb_lineno))
def transfer_file(args):
@@ -65,13 +65,19 @@ def reset_board(args):
time.sleep(1)
tn.write(bytes(args.password, 'ascii') + b"\r\n")
- if b"Login succeeded!" in tn.read_until(b"for more information.", timeout=5):
+ if b'Type "help()" for more information.' in tn.read_until(b'Type "help()" for more information.', timeout=5):
print("Telnet login succeeded")
- tn.write(b"import pyb\r\n")
- tn.write(b"pyb.reset()\r\n")
+ tn.write(b'\r\x03\x03') # ctrl-C twice: interrupt any running program
time.sleep(1)
- print("Reset performed")
- success = True
+ tn.write(b'\r\x02') # ctrl-B: enter friendly REPL
+ if b'Type "help()" for more information.' in tn.read_until(b'Type "help()" for more information.', timeout=5):
+ tn.write(b"import pyb\r\n")
+ tn.write(b"pyb.reset()\r\n")
+ time.sleep(1)
+ print("Reset performed")
+ success = True
+ else:
+ print("Error: cannot enter friendly REPL")
else:
print("Error: telnet login failed")