Fix minor bug

This commit is contained in:
Bjoern Kerler 2021-09-01 12:41:41 +02:00
parent 0cff830228
commit 53f873a325

8
mtk
View file

@ -372,7 +372,7 @@ class Main(metaclass=LogBase):
mtk.preloader.get_hw_sw_ver() mtk.preloader.get_hw_sw_ver()
if mtk.preloader.jump_da(daaddr): if mtk.preloader.jump_da(daaddr):
self.info(f"Jumped to {hex(daaddr)}.") self.info(f"Jumped to {hex(daaddr)}.")
ack = unpack(">I", mtk.port.read(4))[0] ack = unpack(">I", mtk.port.usbread(4))[0]
if ack == 0xB1B2B3B4: if ack == 0xB1B2B3B4:
self.info("Successfully loaded stage2") self.info("Successfully loaded stage2")
return return
@ -396,7 +396,7 @@ class Main(metaclass=LogBase):
self.info(f"Sent da to {hex(daaddr)}, length {hex(len(dadata))}") self.info(f"Sent da to {hex(daaddr)}, length {hex(len(dadata))}")
if mtk.preloader.jump_da(daaddr): if mtk.preloader.jump_da(daaddr):
self.info(f"Jumped to {hex(daaddr)}.") self.info(f"Jumped to {hex(daaddr)}.")
ack = unpack(">I", mtk.port.read(4))[0] ack = unpack(">I", mtk.port.usbread(4))[0]
if ack == 0xB1B2B3B4: if ack == 0xB1B2B3B4:
self.info("Successfully loaded stage2") self.info("Successfully loaded stage2")
else: else:
@ -549,7 +549,7 @@ class Main(metaclass=LogBase):
bytestoread = len(stage2data) bytestoread = len(stage2data)
while bytestoread > 0: while bytestoread > 0:
size = min(bytestoread, 1) size = min(bytestoread, 1)
rdata += mtk.port.read(size) rdata += mtk.port.usbread(size)
bytestoread -= size bytestoread -= size
flag = mtk.port.rdword() flag = mtk.port.rdword()
if flag != 0xD0D0D0D0: if flag != 0xD0D0D0D0:
@ -575,7 +575,7 @@ class Main(metaclass=LogBase):
# address # address
mtk.port.usbwrite(pack(">I", stage2addr)) mtk.port.usbwrite(pack(">I", stage2addr))
self.info("Done jumping stage2 at %08X" % stage2addr) self.info("Done jumping stage2 at %08X" % stage2addr)
ack = unpack(">I", mtk.port.read(4))[0] ack = unpack(">I", mtk.port.usbread(4))[0]
if ack == 0xB1B2B3B4: if ack == 0xB1B2B3B4:
self.info("Successfully loaded stage2") self.info("Successfully loaded stage2")
self.close() self.close()