From 13a544e13fbc0f6c30b6a7cccdd5363f661f6e3c Mon Sep 17 00:00:00 2001 From: whitequark Date: Mon, 16 Jan 2017 14:07:03 +0000 Subject: [PATCH] artiq_devtool: add boot+log action; avoid forwarder crashes. --- artiq/frontend/artiq_devtool.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/artiq/frontend/artiq_devtool.py b/artiq/frontend/artiq_devtool.py index 8dc8d9795..28d08ff0a 100644 --- a/artiq/frontend/artiq_devtool.py +++ b/artiq/frontend/artiq_devtool.py @@ -34,7 +34,7 @@ def get_argparser(): parser.add_argument("actions", metavar="ACTION", type=str, default=[], nargs="+", - help="actions to perform (sequence of: build boot connect)") + help="actions to perform (sequence of: build boot boot+log connect)") return parser @@ -92,7 +92,7 @@ def main(): logger.error("Build failed") sys.exit(1) - elif action == "boot": + elif action == "boot" or action == "boot+log": logger.info("Uploading runtime") get_sftp().mkdir("/tmp/{tmp}".format(tmp=tmp)) get_sftp().put("/tmp/kc705/software/runtime/runtime.bin", @@ -101,7 +101,8 @@ def main(): logger.info("Booting runtime") flterm = run_command( "{env} python3 flterm.py {serial} " + - "--kernel /tmp/{tmp}/runtime.bin --upload-only") + "--kernel /tmp/{tmp}/runtime.bin " + + ("--upload-only" if action == "boot" else "--output-only")) artiq_flash = run_command( "{env} artiq_flash start") drain(flterm) @@ -120,8 +121,11 @@ def main(): logger.error("Trying to open a channel before the transport is ready!") continue - remote_stream = get_ssh().get_transport() \ - .open_channel('direct-tcpip', (args.ip, port), peer_addr) + try: + remote_stream = get_ssh().get_transport() \ + .open_channel('direct-tcpip', (args.ip, port), peer_addr) + except Exception as e: + logger.exception("Cannot open channel on port %s", port) while True: try: r, w, x = select.select([local_stream, remote_stream], [], [])