# HG changeset patch # User Zachary T Welch zach@mandolincreekfarm.com # Fake Node ID 1f7f1fd0113a9a34596900231af30788dff31dd9
chirpc: add --copy-mem option (#2343)
This patch adds an option that permits copying a memory channel.
diff --git a/chirpc b/chirpc index c3b85d2..1a3fec4 100755 --- a/chirpc +++ b/chirpc @@ -110,6 +110,8 @@ if __name__ == "__main__":
memarg.add_argument("--get-mem", action="store_true", help="Get and print memory location") + memarg.add_argument("--copy-mem", action="store_true", + help="Copy memory location") memarg.add_argument("--clear-mem", action="store_true", help="Clear memory location")
@@ -231,6 +233,18 @@ if __name__ == "__main__": print mem sys.exit(0)
+ if options.copy_mem: + src = parse_memory_number(radio, args) + dst = parse_memory_number(radio, args[1:]) + try: + mem = radio.get_memory(src) + except errors.InvalidMemoryLocation, e: + LOG.exception(e) + sys.exit(1) + LOG.info("copying memory %d to %d", src, dst) + mem.number = dst + radio.set_memory(mem) + if options.clear_mem: memnum = parse_memory_number(radio, args) try: