From d429101cb44669cedb377199a7e5939391e58594 Mon Sep 17 00:00:00 2001 From: Andrew Kozlik Date: Fri, 29 Apr 2022 04:23:22 +0200 Subject: [PATCH] fixup! feat(tools): Add firmware_hash.py. --- tools/firmware_hash.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/firmware_hash.py b/tools/firmware_hash.py index cdeedee64..96fa288e1 100755 --- a/tools/firmware_hash.py +++ b/tools/firmware_hash.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 +import sys from hashlib import blake2s -from os import sys FILE_T1 = "legacy/firmware/trezor.bin" FILE_T2 = "core/build/firmware/firmware.bin" @@ -12,12 +12,12 @@ SIZE_T2 = 13 * 128 * 1024 for filename, size in ((FILE_T1, SIZE_T1), (FILE_T2, SIZE_T2)): try: data = open(filename, "rb").read() - except: + except FileNotFoundError: print(f"{filename} not found") continue if len(data) > size: - raise ValueError(fn, f"{filename} too big") + raise ValueError(filename, "too big") data = data + b"\xff" * (size - len(data)) if len(sys.argv) > 1: