Skip to content

Commit

Permalink
Fix issues with Redmi 9A ... (wrong da loader)
Browse files Browse the repository at this point in the history
  • Loading branch information
bkerler committed Jul 12, 2023
1 parent 7ac42c2 commit 81694c4
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion mtk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import argparse
from mtkclient.Library.mtk_main import Main, metamodes

info = "MTK Flash/Exploit Client V1.6.2 (c) B.Kerler 2018-2023"
info = "MTK Flash/Exploit Client V1.6.3 (c) B.Kerler 2018-2023"

cmds = {
"printgpt": "Print GPT Table information",
Expand Down
27 changes: 15 additions & 12 deletions mtkclient/Library/mtk_daxflash.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,13 @@ def send_emi(self, emi):
try:
time.sleep(0.01)
if self.xsend(pack("<I", len(emi))):
if self.send_param([emi]):
self.info(f"DRAM setup passed.")
return True
try:
if self.send_param([emi]):
self.info(f"DRAM setup passed.")
return True
except Exception as err:
self.info(f"DRAM setup failed: %s" % str(err))
return False
except Exception as err:
self.error(f"Error on sending emi: {str(err)}")
return False
Expand Down Expand Up @@ -1050,7 +1054,7 @@ def setup_env(self):
log_channel = 1
system_os = self.FtSystemOSE.OS_LINUX
ufs_provision = 0x0
param = pack("<IIIII", da_log_level, log_channel, system_os, ufs_provision, 0x1)
param = pack("<IIIII", da_log_level, log_channel, system_os, ufs_provision, 0x0)
if self.send_param(param):
return True
return False
Expand Down Expand Up @@ -1173,20 +1177,19 @@ def upload_da(self):
# self.set_battery_opt(0x2)
self.set_checksum_level(0x0)
connagent = self.get_connection_agent()
emmc_info = self.get_emmc_info(False)
if emmc_info is not None and emmc_info.user_size != 0:
self.info("DRAM config needed for : " + hexlify(emmc_info.cid[:8]).decode('utf-8'))
else:
ufs_info = self.get_ufs_info()
if ufs_info is not None and ufs_info.block_size != 0:
self.info("DRAM config needed for : " + hexlify(ufs_info.cid).decode('utf-8'))

# dev_fw_info=self.get_dev_fw_info()
# dramtype = self.get_dram_type()
stage = None
if connagent == b"brom":
stage = 1
if self.daconfig.emi is None:
emmc_info = self.get_emmc_info(False)
if emmc_info is not None and emmc_info.user_size != 0:
self.info("DRAM config needed for : " + hexlify(emmc_info.cid[:8]).decode('utf-8'))
else:
ufs_info = self.get_ufs_info()
if ufs_info is not None and ufs_info.block_size != 0:
self.info("DRAM config needed for : " + hexlify(ufs_info.cid).decode('utf-8'))
self.info("No preloader given. Searching for preloader")
found = False
self.info("Sending emi data ...")
Expand Down
Binary file not shown.
Binary file added mtkclient/Loader/MTK_AllInOne_DA_mt6789.bin
Binary file not shown.
Binary file removed mtkclient/Loader/MTK_AllInOne_DA_old.bin
Binary file not shown.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

setup(
name='mtkclient',
version='1.6.2',
version='1.6.3',
packages=find_packages(),
long_description=open("README.md").read(),
scripts=['mtk','stage2'],
Expand Down

0 comments on commit 81694c4

Please sign in to comment.