Skip to content

Commit

Permalink
Fix by @keerttttt
Browse files Browse the repository at this point in the history
  • Loading branch information
bkerler committed Dec 13, 2021
1 parent 6d63737 commit c957572
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions mtkclient/Library/mtk_da_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,22 @@ def dump_preloader_ram(self):
if idx != -1:
data = data[idx:]
length = unpack("<I", data[0x20:0x24])[0]
time.sleep(0.05)
data = b"".join([pack("<I", val) for val in self.mtk.preloader.read32(0x200000 + idx, length + 4 // 4)])
time.sleep(0.15)
data = bytearray()
startidx = idx;
while True:
try:
data.extend(b"".join([pack("<I", val) for val in self.mtk.preloader.read32(0x200000 + idx, 4)]))
idx = idx + 16;
sys.stdout.write("\r"+str(length-(idx-startidx)))
sys.stdout.flush()
if ((idx-startidx) > length):
#done reading
break;
except Exception as err:
self.error(str(err))
break;
data = bytes(data)
preloader = data[:length]
idx = data.find(b"MTK_BLOADER_INFO")
if idx != -1:
Expand All @@ -59,7 +73,7 @@ def configure_da(self, mtk, preloader):
info = mtk.daloader.reinit()
return mtk
else:
if mtk.preloader.init():
if (hasattr(mtk.port.config, "socid") and mtk.port.config.socid != b"") or mtk.preloader.init(): #at least for now making it possible to continue without re-init
if mtk.config.target_config["daa"]:
mtk = mtk.bypass_security()
self.mtk = mtk
Expand Down

0 comments on commit c957572

Please sign in to comment.