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":
|
if seccfg_data[:0xC] == b"AND_SECCFG_v":
|
||||||
self.info("Detected V3 Lockstate")
|
self.info("Detected V3 Lockstate")
|
||||||
sc_org = seccfgV3(hwc, self.mtk)
|
sc_org = seccfgV3(hwc, self.mtk)
|
||||||
else:
|
elif seccfg_data[:4] == b"\x4D\x4D\x4D\x4D":
|
||||||
self.info("Detected V4 Lockstate")
|
self.info("Detected V4 Lockstate")
|
||||||
sc_org = seccfgV4(hwc, self.mtk)
|
sc_org = seccfgV4(hwc, self.mtk)
|
||||||
|
else:
|
||||||
|
return False, "Unknown lockstate or no lockstate"
|
||||||
if not sc_org.parse(seccfg_data):
|
if not sc_org.parse(seccfg_data):
|
||||||
return False, "Device has is either already unlocked or algo is unknown. Aborting."
|
return False, "Device has is either already unlocked or algo is unknown. Aborting."
|
||||||
writedata = sc_org.create(lockflag=lockflag)
|
writedata = sc_org.create(lockflag=lockflag)
|
||||||
|
|
|
@ -1785,7 +1785,8 @@ class DALegacy(metaclass=LogBase):
|
||||||
else:
|
else:
|
||||||
buffer = bytearray()
|
buffer = bytearray()
|
||||||
bytestoread = length
|
bytestoread = length
|
||||||
self.mtk.daloader.progress.show_progress("Read", 0, length, display)
|
if display:
|
||||||
|
self.mtk.daloader.progress.show_progress("Read", 0, length, display)
|
||||||
while bytestoread > 0:
|
while bytestoread > 0:
|
||||||
size = bytestoread
|
size = bytestoread
|
||||||
if bytestoread > packetsize:
|
if bytestoread > packetsize:
|
||||||
|
@ -1799,6 +1800,8 @@ class DALegacy(metaclass=LogBase):
|
||||||
rpos = length - bytestoread
|
rpos = length - bytestoread
|
||||||
else:
|
else:
|
||||||
rpos = 0
|
rpos = 0
|
||||||
self.mtk.daloader.progress.show_progress("Read", rpos, length, display)
|
if display:
|
||||||
self.mtk.daloader.progress.show_progress("Read", length, length, 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
|
return buffer
|
||||||
|
|
|
@ -524,9 +524,11 @@ class xflashext(metaclass=LogBase):
|
||||||
if seccfg_data[:0xC] == b"AND_SECCFG_v":
|
if seccfg_data[:0xC] == b"AND_SECCFG_v":
|
||||||
self.info("Detected V3 Lockstate")
|
self.info("Detected V3 Lockstate")
|
||||||
sc_org = seccfgV3(hwc, self.mtk)
|
sc_org = seccfgV3(hwc, self.mtk)
|
||||||
else:
|
elif seccfg_data[:4] == b"\x4D\x4D\x4D\x4D":
|
||||||
self.info("Detected V4 Lockstate")
|
self.info("Detected V4 Lockstate")
|
||||||
sc_org = seccfgV4(hwc, self.mtk)
|
sc_org = seccfgV4(hwc, self.mtk)
|
||||||
|
else:
|
||||||
|
return False, "Unknown lockstate or no lockstate"
|
||||||
if not sc_org.parse(seccfg_data):
|
if not sc_org.parse(seccfg_data):
|
||||||
return False, "Device has is either already unlocked or algo is unknown. Aborting."
|
return False, "Device has is either already unlocked or algo is unknown. Aborting."
|
||||||
writedata = sc_org.create(lockflag=lockflag)
|
writedata = sc_org.create(lockflag=lockflag)
|
||||||
|
|
Loading…
Reference in a new issue