forked from M-Labs/artiq
pdq2_controller: add dump option
This commit is contained in:
parent
5ab3290ed4
commit
222d0a9d37
|
@ -11,11 +11,11 @@ def get_argparser():
|
||||||
parser = argparse.ArgumentParser(description="PDQ2 controller")
|
parser = argparse.ArgumentParser(description="PDQ2 controller")
|
||||||
simple_network_args(parser, 3252)
|
simple_network_args(parser, 3252)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-s", "--serial", default=None,
|
"-u", "--url", default="hwgrep://",
|
||||||
help="device (FT245R) serial string [first]")
|
help="device url [%(default)s]")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-d", "--debug", default=False, action="store_true",
|
"-d", "--dump", default=None,
|
||||||
help="debug communications")
|
help="file to dump pdq2 data into, for later simulation")
|
||||||
verbosity_args(parser)
|
verbosity_args(parser)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
@ -23,13 +23,16 @@ def get_argparser():
|
||||||
def main():
|
def main():
|
||||||
args = get_argparser().parse_args()
|
args = get_argparser().parse_args()
|
||||||
init_logger(args)
|
init_logger(args)
|
||||||
|
port = None
|
||||||
dev = Pdq2(serial=args.serial)
|
if args.dump:
|
||||||
|
port = open(args.dump, "wb")
|
||||||
|
dev = Pdq2(url=args.url, dev=port)
|
||||||
try:
|
try:
|
||||||
simple_server_loop({"pdq2": dev}, args.bind, args.port,
|
simple_server_loop({"pdq2": dev}, args.bind, args.port,
|
||||||
id_parameters="serial=" + str(args.serial))
|
id_parameters="url=" + str(args.url))
|
||||||
finally:
|
finally:
|
||||||
dev.close()
|
dev.close()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in New Issue