mirror of
https://github.com/bkerler/mtkclient.git
synced 2024-11-14 19:25:05 -05:00
Improve seccfg error handling
This commit is contained in:
parent
8d1dc0d295
commit
33e0f93ea0
3 changed files with 12 additions and 5 deletions
|
@ -181,9 +181,11 @@ class legacyext(metaclass=LogBase):
|
|||
if seccfg_data[:0xC] == b"AND_SECCFG_v":
|
||||
self.info("Detected V3 Lockstate")
|
||||
sc_org = seccfgV3(hwc, self.mtk)
|
||||
else:
|
||||
elif seccfg_data[:4] == b"\x4D\x4D\x4D\x4D":
|
||||
self.info("Detected V4 Lockstate")
|
||||
sc_org = seccfgV4(hwc, self.mtk)
|
||||
else:
|
||||
return False, "Unknown lockstate or no lockstate"
|
||||
if not sc_org.parse(seccfg_data):
|
||||
return False, "Device has is either already unlocked or algo is unknown. Aborting."
|
||||
writedata = sc_org.create(lockflag=lockflag)
|
||||
|
|
|
@ -1785,6 +1785,7 @@ class DALegacy(metaclass=LogBase):
|
|||
else:
|
||||
buffer = bytearray()
|
||||
bytestoread = length
|
||||
if display:
|
||||
self.mtk.daloader.progress.show_progress("Read", 0, length, display)
|
||||
while bytestoread > 0:
|
||||
size = bytestoread
|
||||
|
@ -1799,6 +1800,8 @@ class DALegacy(metaclass=LogBase):
|
|||
rpos = length - bytestoread
|
||||
else:
|
||||
rpos = 0
|
||||
if display:
|
||||
self.mtk.daloader.progress.show_progress("Read", rpos, length, display)
|
||||
if display:
|
||||
self.mtk.daloader.progress.show_progress("Read", length, length, display)
|
||||
return buffer
|
||||
|
|
|
@ -524,9 +524,11 @@ class xflashext(metaclass=LogBase):
|
|||
if seccfg_data[:0xC] == b"AND_SECCFG_v":
|
||||
self.info("Detected V3 Lockstate")
|
||||
sc_org = seccfgV3(hwc, self.mtk)
|
||||
else:
|
||||
elif seccfg_data[:4] == b"\x4D\x4D\x4D\x4D":
|
||||
self.info("Detected V4 Lockstate")
|
||||
sc_org = seccfgV4(hwc, self.mtk)
|
||||
else:
|
||||
return False, "Unknown lockstate or no lockstate"
|
||||
if not sc_org.parse(seccfg_data):
|
||||
return False, "Device has is either already unlocked or algo is unknown. Aborting."
|
||||
writedata = sc_org.create(lockflag=lockflag)
|
||||
|
|
Loading…
Reference in a new issue