Compare commits

...

11 commits

Author SHA1 Message Date
hopez13
2669bb91ba
Merge e3cd58a837 into 127c353b39 2024-10-07 03:27:04 -06:00
Bjoern Kerler
127c353b39
Update xml_lib.py
Some checks failed
Python application / Test (push) Has been cancelled
2024-10-07 10:46:03 +02:00
Bjoern Kerler
7b30c5293c
Update pltools.py 2024-10-07 10:39:04 +02:00
Bjoern Kerler
670cd5384c
Merge pull request #1229 from cyrozap/mt6890-support
Add MT6890 information
2024-10-07 10:27:21 +02:00
cyrozap
6cbe6786b3 MT6880 and MT6890 have the same HW code
Confirmed by connecting to a Dell DW5931e / Fibocom FM350-GL in BROM USB
DL mode.
2024-09-29 12:50:52 -05:00
cyrozap
77958d7ac8 Add efuse address for MT6890 2024-09-29 01:39:44 -05:00
cyrozap
cc0a502bc0 Confirm watchdog address for MT6890 2024-09-29 01:35:39 -05:00
cyrozap
093769e72b Correct SoC name for HW code 0x0992
Connecting to the BROM of an MT6890 (found in a T-Mobile / Quanta D53 5G
mobile hotspot) reports a HW code of 0x0992.
2024-09-29 01:28:37 -05:00
hopez13
e3cd58a837
Fix Preloader Handshake In Debug Mode 2024-09-16 21:06:29 +05:30
hopez13
35c5803ae0
Update Port.py 2024-09-15 01:52:34 +05:30
hopez13
2e65679cc8
Fix preloader handshake 2024-09-15 01:30:13 +05:30
6 changed files with 42 additions and 53 deletions

View file

@ -309,7 +309,7 @@ class UsbClass(DeviceClass):
break
if self.device is None:
self.debug("Couldn't detect the device. Is it connected ?")
# self.debug("Couldn't detect the device. Is it connected ?")
return False
try:

View file

@ -967,7 +967,10 @@ class DAXML(metaclass=LogBase):
self.ack_value(length)
cmd, result = self.get_command_result()
if type(result) is DwnFile:
data = fh.read(length)
if fh:
data = fh.read(length)
else:
data = wdata
if not self.upload(result, data, raw=True):
self.error("Error on writing flash at 0x%08X" % addr)
return False

View file

@ -125,63 +125,51 @@ class Port(metaclass=LogBase):
pass
return False
def run_handshake(self):
ep_out = self.cdc.EP_OUT.write
ep_in = self.cdc.EP_IN.read
maxinsize = self.cdc.EP_IN.wMaxPacketSize
i = 0
startcmd = b"\xa0\x0a\x50\x05"
length = len(startcmd)
# On preloader, send 0xa0 first
if self.cdc.pid!=0x3:
ep_out(startcmd[0:1])
try:
while i < length:
if ep_out(startcmd[i:i+1]):
if ep_in(maxinsize)[-1] == ~(startcmd[i]) & 0xFF:
i += 1
else:
i = 0
self.info("Device detected :)")
return True
except Exception as serr:
self.debug(str(serr))
time.sleep(0.005)
return False
# def run_handshake(self):
def handshake(self, maxtries=None, loop=0):
counter = 0
while not self.cdc.connected:
try:
if maxtries is not None and counter == maxtries:
break
counter += 1
if self.cdc.connect() and self.run_handshake():
return True
else:
if loop == 5:
sys.stdout.write('\n')
self.info("Hint:\n\nPower off the phone before connecting.\n" +
"For brom mode, press and hold vol up, vol dwn, or all hw buttons and " +
"connect usb.\n" +
"For preloader mode, don't press any hw button and connect usb.\n"
"If it is already connected and on, hold power for 10 seconds to reset.\n")
sys.stdout.write('\n')
if loop >= 10:
sys.stdout.write('.')
if loop >= 20:
sys.stdout.write('\n')
loop = 0
loop += 1
time.sleep(0.3)
sys.stdout.flush()
self.cdc.connect()
ep_out = self.cdc.EP_OUT.write
ep_in = self.cdc.EP_IN.read
maxinsize = self.cdc.EP_IN.wMaxPacketSize
i = 0
startcmd = b"\xa0\x0a\x50\x05"
length = len(startcmd)
# On preloader, send 0xa0 first
if self.cdc.pid!=0x3:
ep_out(startcmd[0:1])
try:
while i < length:
if ep_out(startcmd[i:i+1]):
if ep_in(maxinsize)[-1] == ~(startcmd[i]) & 0xFF:
i += 1
else:
i = 0
self.info("Device detected :)")
return True
except Exception as serr:
self.debug(str(serr))
time.sleep(0.005)
return False
except Exception as serr:
if "access denied" in str(serr):
self.warning(str(serr))
self.debug(str(serr))
# self.debug(str(serr))
pass
return False

View file

@ -160,9 +160,6 @@ class Preloader(metaclass=LogBase):
else:
res = self.mtk.port.handshake(maxtries=maxtries)
if not res:
if display:
self.error("Status: Handshake failed, retrying...")
self.config.set_gui_status(self.config.tr("Status: Handshake failed, retrying..."))
self.mtk.port.close()
tries += 1
if tries == 1000:

View file

@ -101,7 +101,7 @@ class PLTools(metaclass=LogBase):
return False
else:
self.error(f"Error on sending payload: {filename}")
self.error(f"Error, payload answered instead: {hexlify(ack).decode('utf-8')}")
self.error(f"Error, payload answered instead: {hexlify(response_ack).decode('utf-8')}")
return False
def runbrute(self, args):

View file

@ -346,7 +346,7 @@ hwconfig = {
dacode=0x0598,
name="ELBRUS/MT0598"),
0x992: Chipconfig( # var1
# watchdog
watchdog=0x10007000,
# uart
# brom_payload_addr
# da_payload_addr
@ -355,9 +355,10 @@ hwconfig = {
# cqdma_base
# ap_dma_mem
# blacklist
efuse_addr=0x11EC0000,
damode=DAmodes.XFLASH,
dacode=0x0992,
name="MT0992"),
name="MT6880/MT6890"),
0x2601: Chipconfig(
var1=0xA, # Smartwatch, confirmed
watchdog=0x10007000,