artiq_devtool, artiq_pcap: better option naming.

This commit is contained in:
whitequark 2017-06-26 00:00:05 +00:00
parent f4624e086a
commit d6f4f1f3bc
2 changed files with 11 additions and 12 deletions

View File

@ -22,15 +22,15 @@ def get_argparser():
verbosity_args(parser) verbosity_args(parser)
parser.add_argument("--host", metavar="HOST", parser.add_argument("-H", "--host", metavar="HOST",
type=str, default="lab.m-labs.hk", type=str, default="lab.m-labs.hk",
help="SSH host where the development board is located") 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", parser.add_argument("-s", "--serial", metavar="SERIAL",
type=str, default="/dev/ttyUSB_kc705", type=str, default="/dev/ttyUSB_kc705",
help="TTY device corresponding to the development board") 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", parser.add_argument("-t", "--target", metavar="TARGET",
type=str, default="kc705_dds", type=str, default="kc705_dds",
help="Target to build, one of: " help="Target to build, one of: "
@ -62,7 +62,6 @@ def main():
substs = { substs = {
"env": "bash -c 'export PATH=$HOME/miniconda/bin:$PATH; exec $0 $*' ", "env": "bash -c 'export PATH=$HOME/miniconda/bin:$PATH; exec $0 $*' ",
"serial": args.serial, "serial": args.serial,
"ip": args.ip,
"firmware": firmware, "firmware": firmware,
} }
@ -120,14 +119,14 @@ def main():
while True: while True:
local_stream, peer_addr = listener.accept() local_stream, peer_addr = listener.accept()
logger.info("Accepting %s:%s and opening SSH channel to %s:%s", 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: if client.get_transport() is None:
logger.error("Trying to open a channel before the transport is ready!") logger.error("Trying to open a channel before the transport is ready!")
continue continue
try: try:
remote_stream = client.get_transport() \ 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: except Exception as e:
logger.exception("Cannot open channel on port %s", port) logger.exception("Cannot open channel on port %s", port)
continue continue

View File

@ -16,12 +16,12 @@ def get_argparser():
verbosity_args(parser) verbosity_args(parser)
parser.add_argument("--host", metavar="HOST", parser.add_argument("-H", "--host", metavar="HOST",
type=str, default="lab.m-labs.hk", type=str, default="lab.m-labs.hk",
help="SSH host where the development board is located") 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", 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", parser.add_argument("-f", "--file", metavar="PCAP_FILE",
type=str, default="coredevice.pcap", type=str, default="coredevice.pcap",
help="Location to retrieve the pcap file into") help="Location to retrieve the pcap file into")
@ -41,8 +41,8 @@ def main():
sftp = client.get_sftp() sftp = client.get_sftp()
tcpdump = client.spawn_command( tcpdump = client.spawn_command(
"/usr/sbin/tcpdump host {ip} -w {tmp}/trace.pcap", get_pty=True, "/usr/sbin/tcpdump host {device} -w {tmp}/trace.pcap", get_pty=True,
ip=args.ip) device=args.device)
try: try:
subprocess.check_call(args.command) subprocess.check_call(args.command)