Giving better info while connecting to phone.

This commit is contained in:
cygnusx 2021-12-28 15:08:57 +01:00
parent b10ac235bf
commit 3a143f3c46
4 changed files with 16 additions and 9 deletions

View file

@ -118,7 +118,7 @@ sudo reboot
## Usage
### Using MTKTools via the graphical user interface:
For the 'basics' you can use the GUI interface. This supports dumping partitions for now. Run the following command:
For the 'basics' you can use the GUI interface. This supports dumping partitions or the full flash for now. Run the following command:
```
python mtk_gui
```

21
mtk_gui
View file

@ -62,10 +62,13 @@ def getDevInfo(self, parameters):
mtkClass = devhandler.mtkClass
da_handler = devhandler.da_handler
if mtkClass.port.cdc.connect() == False:
mtkClass.preloader.init()
else:
phoneInfo['cdcInit'] = True;
try:
if mtkClass.port.cdc.connect() == False:
mtkClass.preloader.init()
else:
phoneInfo['cdcInit'] = True
except:
phoneInfo['cantConnect'] = True
phoneInfo['chipset'] = str(mtkClass.config.chipconfig.name) + \
" (" + str(mtkClass.config.chipconfig.description) + ")"
self.sendUpdateSignal.emit()
@ -81,6 +84,9 @@ def getDevInfo(self, parameters):
else:
phoneInfo['bootMode'] = "Preloader mode"
self.sendUpdateSignal.emit()
else:
phoneInfo['cantConnect'] = True
self.sendUpdateSignal.emit()
# try:
# print(mtkClass.daloader.get_partition_data(parttype="user"))
# except Exception:
@ -96,7 +102,10 @@ def sendToLog(info):
def updateGui():
global phoneInfo
mainwindow.phoneInfoTextbox.setText("Phone detected:\n" + phoneInfo['chipset'] + "\n" + phoneInfo['bootMode'])
if (phoneInfo['cdcInit'] and phoneInfo['bootMode'] == "" ):
mainwindow.phoneInfoTextbox.setText("Phone detected:\nReading model info...")
else:
mainwindow.phoneInfoTextbox.setText("Phone detected:\n" + phoneInfo['chipset'] + "\n" + phoneInfo['bootMode'])
mainwindow.status.setText("Device detected, please wait.\nThis can take a while...")
if phoneInfo['daInit']:
mainwindow.status.setText("Device connected :)")
@ -106,7 +115,7 @@ def updateGui():
spinnerAnim.stop()
mainwindow.spinner_pic.setHidden(True)
else:
if not phoneInfo['cdcInit']:
if 'cantConnect' in phoneInfo:
mainwindow.status.setText("Error initialising. Did you install the drivers?")
spinnerAnim.start()
mainwindow.spinner_pic.setHidden(False)

View file

@ -198,7 +198,6 @@ class Ui_MainWindow(object):
self.menubar.addAction(self.toolsFlashMenu.menuAction())
self.readFlashMenu.addAction(self.actionRead_partition_s)
self.readFlashMenu.addAction(self.actionRead_full_flash)
self.readFlashMenu.addAction(self.actionRead_offset)
self.writeFlashMenu.addAction(self.actionWrite_partition_s)
self.writeFlashMenu.addAction(self.actionWrite_full_flash)
self.writeFlashMenu.addAction(self.actionWrite_at_offset)

View file

@ -413,7 +413,6 @@
</property>
<addaction name="actionRead_partition_s"/>
<addaction name="actionRead_full_flash"/>
<addaction name="actionRead_offset"/>
</widget>
<widget class="QMenu" name="writeFlashMenu">
<property name="title">