当前位置:   article > 正文

【源码分享】python开发的高通平台fastboot刷机工具_fastboot tooi

fastboot tooi

     用python开发的windows版本高通平台fastboot刷机工具, 点击按钮即可单独烧录模块或者全部烧录,方便日常

的开发调试工作,在win7、Win10系统中测试烧录msm8909平台正常。开发工具为JetBrains PyCharm 2019.1.1,

源码工程包含两个py文件,分别是fastboot_tool.py和fastboot_cmd.py ,打包好的exe文件下载地址如下。

https://download.csdn.net/download/hismee/16335703

软件界面:

打包好后的烧录工具目录结构:

烧录的镜像文件列表:

   boot.img
   cache.img
   emmc_appsboot.mbn
   logo.raw
   persist.img
   recovery.img
   system.img
   userdata.img

 

源码:

1、fastboot_tool.py   #GUI主界面

  1. # -*- coding: UTF-8 -*-
  2. from tkinter import *
  3. from fastboot_cmd import *
  4. import configparser
  5. import threading
  6. import os
  7. import tkinter.filedialog
  8. import time
  9. # ------------------define global variate-----------------------
  10. btn_select_image_dir = None
  11. btn_download_boot = None
  12. btn_download_aboot = None
  13. btn_download_system = None
  14. btn_download_logo = None
  15. btn_download_userdata = None
  16. btn_download_all = None
  17. btn_reboot_device = None
  18. btn_sn_write = None
  19. btn_sn_read = None
  20. image_file_path = None
  21. download_running_flag = None
  22. login_top = None
  23. login_ok_flag = None
  24. # ------------------define function-----------------------
  25. def Log(str):
  26. print(str)
  27. log_text.insert(END, '\n' + str)
  28. log_text.see(END)
  29. if ('ErrorFFFF' in str) and ('error' in str):
  30. index = log_text.get('1.0', 'end').count('\n')
  31. #print index
  32. index1 = '%d.0' %index
  33. index2 = '%d.end' %index
  34. log_text.tag_add('tag1', index1, index2 )
  35. log_text.tag_config('tag1',foreground='red')
  36. def LogE(str):
  37. print(str)
  38. star = int(float(log_text.index(END)))
  39. log_text.insert(END, '\n' + str)
  40. log_text.see(END)
  41. end = int(float(log_text.index(END)))
  42. for i in range(star, end, 1):
  43. index1 = '%d.0' %i
  44. index2 = '%d.end' %i
  45. log_text.tag_add('tag_red', index1, index2 )
  46. #print("LogE:%d" %i )
  47. log_text.tag_config('tag_red', foreground='red')
  48. def LogB(str):
  49. print(str)
  50. star = int(float(log_text.index(END)))
  51. log_text.insert(END, "\n" + str)
  52. log_text.see(END)
  53. end = int(float(log_text.index(END)))
  54. for i in range(star, end, 1):
  55. index1 = '%d.0' %i
  56. index2 = '%d.end' %i
  57. log_text.tag_add('tag_blue', index1, index2 )
  58. log_text.tag_config('tag_blue', foreground='blue')
  59. def Log_dot():
  60. print('.',)
  61. log_text.insert(END, ".")
  62. log_text.see(END)
  63. def set_button_onoff(onoff):
  64. if onoff == "on":
  65. btn_select_image_dir.config(state="normal")
  66. btn_download_boot.config(state="normal")
  67. btn_download_aboot.config(state="normal")
  68. btn_download_system.config(state="normal")
  69. btn_download_logo.config(state="normal")
  70. btn_download_userdata.config(state="normal")
  71. btn_download_all.config(state="normal")
  72. btn_reboot_device.config(state="normal")
  73. if (login_ok_flag == 1):
  74. btn_sn_write.config(state="normal")
  75. btn_sn_read.config(state="normal")
  76. pass
  77. if onoff == "off":
  78. btn_select_image_dir.config(state="disabled")
  79. btn_download_boot.config(state="disabled")
  80. btn_download_aboot.config(state="disabled")
  81. btn_download_system.config(state="disabled")
  82. btn_download_logo.config(state="disabled")
  83. btn_download_userdata.config(state="disabled")
  84. btn_download_all.config(state="disabled")
  85. btn_reboot_device.config(state="disabled")
  86. if (login_ok_flag == 1):
  87. btn_sn_write.config(state="disabled")
  88. btn_sn_read.config(state="disabled")
  89. pass
  90. def btn_select_image_dir_click():
  91. options = {}
  92. options['initialdir'] = text_path.get(0.0, END).strip()
  93. dir_name=tkinter.filedialog.askdirectory(**options)
  94. #Log(dir_name)
  95. if dir_name != "":
  96. text_path.config(state=NORMAL)
  97. text_path.delete(1.0,END)
  98. text_path.insert(END, dir_name)
  99. text_path.config(state=DISABLED)
  100. Log("\nSelect directory:\n" + text_path.get(0.0, END))
  101. config_save('image_file_path', dir_name)
  102. global image_file_path
  103. image_file_path = dir_name
  104. # ----------------------------------------------------------------
  105. def progress_bar_thread_fun():
  106. time.sleep(2)
  107. if download_running_flag:
  108. Log('')
  109. for i in range(0,40):
  110. if download_running_fl
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/298931?site
推荐阅读
相关标签
  

闽ICP备14008679号