From 3a5e385b9a60e9b5e7d9f98a92ce48895e481bc5 Mon Sep 17 00:00:00 2001 From: bunnie Date: Fri, 29 Jul 2022 00:24:40 +0800 Subject: [PATCH] add arg to specify file (optionally) in backup --- tools/backup.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/backup.py b/tools/backup.py index 11663dbda..bff93d2eb 100755 --- a/tools/backup.py +++ b/tools/backup.py @@ -428,6 +428,9 @@ def main(): parser.add_argument( "--peek", required=False, help="Inspect an address", type=auto_int, metavar=('ADDR') ) + parser.add_argument( + "--output", help="Output file name", type=str, default="backup.pddb" + ) args = parser.parse_args() dev = usb.core.find(idProduct=0x5bf0, idVendor=0x1209) @@ -493,7 +496,7 @@ def main(): if args.peek: pc_usb.peek(args.peek + flash_region, display=True) else: - with open("backup.pddb", "wb") as file: + with open(args.output, "wb") as file: start_addr = locs['LOC_PDDB'][0] - 0x1000 total_length = locs['LOC_WF200'][0] - locs['LOC_PDDB'][0] + 0x1000 progress = ProgressBar(min_value=0, max_value=total_length, prefix='Backing up ').start()