diff --git a/smpclient/mcuboot.py b/smpclient/mcuboot.py index 1fc1b1a..6f10c50 100644 --- a/smpclient/mcuboot.py +++ b/smpclient/mcuboot.py @@ -230,14 +230,15 @@ 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 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: