mirror of
https://github.com/bkerler/mtkclient.git
synced 2024-11-14 19:25:05 -05:00
Fix seccfg logging error
This commit is contained in:
parent
1a1f8719f5
commit
db9fbd346e
2 changed files with 37 additions and 12 deletions
|
@ -140,6 +140,7 @@ class sej(metaclass=LogBase):
|
|||
0xDE377A83
|
||||
]
|
||||
|
||||
|
||||
g_HACC_CFG_1 = [
|
||||
0x9ED40400, 0x00E884A1, 0xE3F083BD, 0x2F4E6D8A,
|
||||
0xFF838E5C, 0xE940A0E3, 0x8D4DECC6, 0x45FC0989
|
||||
|
@ -161,15 +162,15 @@ class sej(metaclass=LogBase):
|
|||
|
||||
def __init__(self, setup, loglevel=logging.INFO):
|
||||
self.__logger = self.__logger
|
||||
self.info = self.__logger.info
|
||||
self.error = self.__logger.error
|
||||
self.warning = self.__logger.warning
|
||||
self.hwcode = setup.hwcode
|
||||
self.reg = hacc_reg(setup)
|
||||
# mediatek,hacc, mediatek,sej
|
||||
self.sej_base = setup.sej_base
|
||||
self.read32 = setup.read32
|
||||
self.write32 = setup.write32
|
||||
self.info = self.__logger.info
|
||||
self.error = self.__logger.error
|
||||
self.warning = self.__logger.warning
|
||||
if loglevel == logging.DEBUG:
|
||||
logfilename = os.path.join("logs", "log.txt")
|
||||
fh = logging.FileHandler(logfilename, encoding='utf-8')
|
||||
|
@ -482,7 +483,7 @@ class sej(metaclass=LogBase):
|
|||
|
||||
# clear HACC_ASRC/HACC_ACFG/HACC_AOUT
|
||||
self.reg.HACC_ACON2 = self.HACC_AES_CLR # 0x08
|
||||
#self.reg.HACC_UNK = 1
|
||||
|
||||
self.reg.HACC_ACFG0 = iv[0] # g_AC_CFG
|
||||
self.reg.HACC_ACFG1 = iv[1]
|
||||
self.reg.HACC_ACFG2 = iv[2]
|
||||
|
|
|
@ -1,13 +1,19 @@
|
|||
from struct import unpack, pack
|
||||
from mtkclient.Library.utils import structhelper_io
|
||||
from io import BytesIO
|
||||
from struct import pack
|
||||
import os
|
||||
import hashlib
|
||||
|
||||
import logging
|
||||
from io import BytesIO
|
||||
from mtkclient.Library.utils import structhelper_io
|
||||
from mtkclient.Library.utils import LogBase
|
||||
from mtkclient.config.mtk_config import Mtk_Config
|
||||
|
||||
|
||||
class seccfgV4:
|
||||
def __init__(self, hwc, mtk):
|
||||
class seccfgV4(metaclass=LogBase):
|
||||
def __init__(self, hwc, mtk, loglevel=logging.INFO):
|
||||
self.__logger = self.__logger
|
||||
self.info = self.__logger.info
|
||||
self.error = self.__logger.error
|
||||
self.warning = self.__logger.warning
|
||||
self.hwc = hwc
|
||||
self.mtk = mtk
|
||||
self.magic = 0x4D4D4D4D
|
||||
|
@ -18,6 +24,13 @@ class seccfgV4:
|
|||
self.sboot_runtime = None
|
||||
self.endflag = 0x45454545
|
||||
self.hash = b""
|
||||
if loglevel == logging.DEBUG:
|
||||
logfilename = os.path.join("logs", "log.txt")
|
||||
fh = logging.FileHandler(logfilename, encoding='utf-8')
|
||||
self.__logger.addHandler(fh)
|
||||
self.__logger.setLevel(logging.DEBUG)
|
||||
else:
|
||||
self.__logger.setLevel(logging.INFO)
|
||||
|
||||
def parse(self, data):
|
||||
rf = structhelper_io(BytesIO(bytearray(data)))
|
||||
|
@ -118,8 +131,12 @@ class SEC_IMG_ATTR:
|
|||
ATTR_SEC_IMG_FORCE_UPDATE = 0x46464646 # FFFF
|
||||
|
||||
|
||||
class seccfgV3:
|
||||
def __init__(self, hwc, mtk):
|
||||
class seccfgV3(metaclass=LogBase):
|
||||
def __init__(self, hwc, mtk, loglevel=logging.INFO):
|
||||
self.__logger = self.__logger
|
||||
self.info = self.__logger.info
|
||||
self.error = self.__logger.error
|
||||
self.warning = self.__logger.warning
|
||||
self.hwtype = None
|
||||
self.data = None
|
||||
self.org_data = None
|
||||
|
@ -143,6 +160,13 @@ class seccfgV3:
|
|||
self.seccfg_ext = b"\x00" * 0x1004
|
||||
if self.hwc.read32 is not None:
|
||||
self.setotp(hwc)
|
||||
if loglevel == logging.DEBUG:
|
||||
logfilename = os.path.join("logs", "log.txt")
|
||||
fh = logging.FileHandler(logfilename, encoding='utf-8')
|
||||
self.__logger.addHandler(fh)
|
||||
self.__logger.setLevel(logging.DEBUG)
|
||||
else:
|
||||
self.__logger.setLevel(logging.INFO)
|
||||
|
||||
def setotp(self, hwc):
|
||||
otp = None
|
||||
|
|
Loading…
Reference in a new issue