From c993535cd917d135425f693babc306326500c1b6 Mon Sep 17 00:00:00 2001 From: Laurynas Lisauskas Date: Mon, 11 Aug 2025 12:22:35 +0300 Subject: [PATCH 1/2] smpclient: mcuboot: treat all files as binary except for .hex --- smpclient/mcuboot.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/smpclient/mcuboot.py b/smpclient/mcuboot.py index 1fc1b1a..73f5ca9 100644 --- a/smpclient/mcuboot.py +++ b/smpclient/mcuboot.py @@ -232,12 +232,8 @@ def get_tlv(self, tlv: IMAGE_TLV) -> ImageTLVValue: def load_file(path: str) -> 'ImageInfo': """Load MCUBoot `ImageInfo` from the .bin or .hex file at `path`.""" file_path = pathlib.Path(path) - if file_path.suffix not in {".bin", ".hex"}: - raise MCUBootImageError( - f"Ambiguous file extension, '{file_path.suffix}', use '.bin' or '.hex'" - ) - if file_path.suffix == ".bin": + if file_path.suffix != ".hex": with open(file_path, 'rb') as _f: f = BytesIO(_f.read()) else: From c947c7d7ce1fea9552f30748aa6d261017f15add Mon Sep 17 00:00:00 2001 From: Laurynas Lisauskas Date: Wed, 13 Aug 2025 09:36:27 +0300 Subject: [PATCH 2/2] mcuboot: update load_file docstring Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- smpclient/mcuboot.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/smpclient/mcuboot.py b/smpclient/mcuboot.py index 73f5ca9..6f10c50 100644 --- a/smpclient/mcuboot.py +++ b/smpclient/mcuboot.py @@ -230,7 +230,12 @@ def get_tlv(self, tlv: IMAGE_TLV) -> ImageTLVValue: @staticmethod def load_file(path: str) -> 'ImageInfo': - """Load MCUBoot `ImageInfo` from the .bin or .hex file at `path`.""" + """ + Load MCUBoot `ImageInfo` from the file at `path`. + + Files with the `.hex` extension are treated as Intel HEX format. + All other file extensions are treated as binary. + """ file_path = pathlib.Path(path) if file_path.suffix != ".hex":