From d6f4f1f3bcfa9724666091e09b717e3bd3b640a2 Mon Sep 17 00:00:00 2001 From: whitequark Date: Mon, 26 Jun 2017 00:00:05 +0000 Subject: [PATCH] artiq_devtool, artiq_pcap: better option naming. --- artiq/frontend/artiq_devtool.py | 13 ++++++------- artiq/frontend/artiq_pcap.py | 10 +++++----- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/artiq/frontend/artiq_devtool.py b/artiq/frontend/artiq_devtool.py index a2da3220d..dd4798a19 100755 --- a/artiq/frontend/artiq_devtool.py +++ b/artiq/frontend/artiq_devtool.py @@ -22,15 +22,15 @@ def get_argparser(): verbosity_args(parser) - parser.add_argument("--host", metavar="HOST", + parser.add_argument("-H", "--host", metavar="HOST", type=str, default="lab.m-labs.hk", help="SSH host where the development board is located") + parser.add_argument("-D", "--device", metavar="DEVICE", + type=str, default="kc705.lab.m-labs.hk", + help="address or domain corresponding to the development board") parser.add_argument("-s", "--serial", metavar="SERIAL", type=str, default="/dev/ttyUSB_kc705", help="TTY device corresponding to the development board") - parser.add_argument("-i", "--ip", metavar="IP", - type=str, default="kc705.lab.m-labs.hk", - help="IP address corresponding to the development board") parser.add_argument("-t", "--target", metavar="TARGET", type=str, default="kc705_dds", help="Target to build, one of: " @@ -62,7 +62,6 @@ def main(): substs = { "env": "bash -c 'export PATH=$HOME/miniconda/bin:$PATH; exec $0 $*' ", "serial": args.serial, - "ip": args.ip, "firmware": firmware, } @@ -120,14 +119,14 @@ def main(): while True: local_stream, peer_addr = listener.accept() logger.info("Accepting %s:%s and opening SSH channel to %s:%s", - *peer_addr, args.ip, port) + *peer_addr, args.device, port) if client.get_transport() is None: logger.error("Trying to open a channel before the transport is ready!") continue try: remote_stream = client.get_transport() \ - .open_channel('direct-tcpip', (args.ip, port), peer_addr) + .open_channel('direct-tcpip', (args.device, port), peer_addr) except Exception as e: logger.exception("Cannot open channel on port %s", port) continue diff --git a/artiq/frontend/artiq_pcap.py b/artiq/frontend/artiq_pcap.py index 26db1a658..8ec01fc00 100644 --- a/artiq/frontend/artiq_pcap.py +++ b/artiq/frontend/artiq_pcap.py @@ -16,12 +16,12 @@ def get_argparser(): verbosity_args(parser) - parser.add_argument("--host", metavar="HOST", + parser.add_argument("-H", "--host", metavar="HOST", type=str, default="lab.m-labs.hk", help="SSH host where the development board is located") - parser.add_argument("-i", "--ip", metavar="IP", + parser.add_argument("-D", "--device", metavar="DEVICE", type=str, default="kc705.lab.m-labs.hk", - help="IP address corresponding to the development board") + help="address or domain corresponding to the development board") parser.add_argument("-f", "--file", metavar="PCAP_FILE", type=str, default="coredevice.pcap", help="Location to retrieve the pcap file into") @@ -41,8 +41,8 @@ def main(): sftp = client.get_sftp() tcpdump = client.spawn_command( - "/usr/sbin/tcpdump host {ip} -w {tmp}/trace.pcap", get_pty=True, - ip=args.ip) + "/usr/sbin/tcpdump host {device} -w {tmp}/trace.pcap", get_pty=True, + device=args.device) try: subprocess.check_call(args.command)