From 127c353b397bd2681f63d3b16fd5b3dfa369e8e6 Mon Sep 17 00:00:00 2001 From: Bjoern Kerler Date: Mon, 7 Oct 2024 10:46:03 +0200 Subject: [PATCH] Update xml_lib.py --- mtkclient/Library/DA/xml/xml_lib.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mtkclient/Library/DA/xml/xml_lib.py b/mtkclient/Library/DA/xml/xml_lib.py index a3575383..89521f13 100755 --- a/mtkclient/Library/DA/xml/xml_lib.py +++ b/mtkclient/Library/DA/xml/xml_lib.py @@ -967,7 +967,10 @@ def writeflash(self, addr, length, filename, offset=0, parttype=None, wdata=None self.ack_value(length) cmd, result = self.get_command_result() if type(result) is DwnFile: - data = fh.read(length) + if fh: + data = fh.read(length) + else: + data = wdata if not self.upload(result, data, raw=True): self.error("Error on writing flash at 0x%08X" % addr) return False