From f338168caba2b100eca85e5e8dfcea78cb27f1e2 Mon Sep 17 00:00:00 2001 From: Bjoern Kerler Date: Sat, 3 Aug 2024 17:28:38 +0200 Subject: [PATCH] Fix reinit and rpmb issues --- mtkclient/Library/DA/mtk_da_handler.py | 3 ++- mtkclient/Library/DA/mtk_daloader.py | 3 +-- mtkclient/Library/DA/xflash/extension/xflash.py | 15 +++++++++++---- mtkclient/Library/DA/xflash/xflash_lib.py | 3 --- mtkclient/Library/DA/xml/extension/v6.py | 11 +++++++---- mtkclient/Library/mtk_preloader.py | 5 +++++ mtkclient/Library/settings.py | 4 +++- mtkclient/config/mtk_config.py | 1 - 8 files changed, 29 insertions(+), 16 deletions(-) diff --git a/mtkclient/Library/DA/mtk_da_handler.py b/mtkclient/Library/DA/mtk_da_handler.py index dfcce12..98b0cec 100755 --- a/mtkclient/Library/DA/mtk_da_handler.py +++ b/mtkclient/Library/DA/mtk_da_handler.py @@ -10,6 +10,7 @@ from mtkclient.Library.error import ErrorHandler from mtkclient.Library.utils import Progress from mtkclient.config.brom_config import Efuse, DAmodes from mtkclient.Library.Filesystem.mtkdafs import MtkDaFS + try: from fuse import FUSE except ImportError: @@ -30,7 +31,7 @@ class DaHandler(metaclass=LogBase): self.pid = mtk.config.pid self.interface = mtk.config.interface self.pathconfig = PathConfig() - self.__logger, self.info, self.debug, self.warning, self.error = logsetup(self, self.__logger, + self.__logger, self.info, self.debug, self.warning, self.error = logsetup(self, self.__logger, loglevel, mtk.config.gui) self.eh = ErrorHandler() self.mtk = mtk diff --git a/mtkclient/Library/DA/mtk_daloader.py b/mtkclient/Library/DA/mtk_daloader.py index d975c00..0e4788d 100755 --- a/mtkclient/Library/DA/mtk_daloader.py +++ b/mtkclient/Library/DA/mtk_daloader.py @@ -145,6 +145,7 @@ class DAloader(metaclass=LogBase): self.config.meid = bytes.fromhex(config["meid"]) if "socid" in config: self.config.socid = bytes.fromhex(config["socid"]) + self.config.hwparam = HwParam(self.mtk.config, self.config.meid.hex(), self.mtk.config.hwparam_path) if config["flashmode"] == "LEGACY": self.mtk.config.chipconfig.damode = DAmodes.LEGACY self.flashmode = DAmodes.LEGACY @@ -155,8 +156,6 @@ class DAloader(metaclass=LogBase): self.mtk.config.chipconfig.damode = DAmodes.XML self.flashmode = DAmodes.XML self.config.init_hwcode(self.config.hwcode) - if self.config.meid is not None: - self.config.hwparam = HwParam(self.mtk.config, self.config.meid.hex(), self.mtk.config.hwparam_path) if self.flashmode == DAmodes.XML: self.da = DAXML(self.mtk, self.daconfig, self.loglevel) self.daconfig.flashtype = config["flashtype"] diff --git a/mtkclient/Library/DA/xflash/extension/xflash.py b/mtkclient/Library/DA/xflash/extension/xflash.py index 257ba15..f03eab4 100755 --- a/mtkclient/Library/DA/xflash/extension/xflash.py +++ b/mtkclient/Library/DA/xflash/extension/xflash.py @@ -127,6 +127,7 @@ class XFlashExt(metaclass=LogBase): ufshcd_queuecommand_ptr = daextdata.find(b"\x55\x55\x55\x55") ufshcd_get_free_tag_ptr = daextdata.find(b"\x66\x66\x66\x66") ptr_g_ufs_hba_ptr = daextdata.find(b"\x77\x77\x77\x77") + efuse_addr_ptr = daextdata.find(b"\x88\x88\x88\x88") if register_ptr != -1 and mmc_get_card_ptr != -1: if register_devctrl: @@ -159,6 +160,8 @@ class XFlashExt(metaclass=LogBase): if g_ufs_hba is None: g_ufs_hba = 0 + efuse_addr = self.config.chipconfig.efuse_addr + # Patch the addr daextdata[register_ptr:register_ptr + 4] = pack("