添加U盘升级功能

This commit is contained in:
ranchuan
2023-09-22 18:26:14 +08:00
parent 4292478f67
commit d8e41f133b
9 changed files with 304 additions and 14 deletions

View File

@@ -160,7 +160,7 @@ class console_dlg(QObject):
self._item_append_green_str("已识别到U盘.")
if(index==5):
# 打开目录失败
self._item_append_red_str("打开目录失败,插入U盘并且在根目录建立 'updata' 文件夹.")
self._item_append_red_str("打开目录失败,插入U盘并且在根目录建立 'updata' 文件夹.")
self.cmd_list.clear()
if(index==6):
# 找不到相应文件
@@ -203,7 +203,7 @@ class console_dlg(QObject):
self.console_text.moveCursor(QTextCursor.MoveOperation.End)
except Exception as e:
print(str(e))
def file_file_by_type(self,type:str):
def find_file_by_type(self,type:str):
for i in self.file_list:
if(i[-len(type):]==type):
return i
@@ -220,16 +220,22 @@ class console_dlg(QObject):
# 组装命令列表
def _pack_cmd_list(self):
self.cmd_list.append("systemctl stop atk-qtapp-start.service")
self.cmd_list.append("systemctl stop pyeamon.service")
self.cmd_list.append("systemctl disable pyeamon.service")
self.cmd_list.append("mkdir /home/root/config")
self.cmd_list.append("cp "+self.file_file_by_type(".elf")+" /usr/local/QDesktop-fb")
self.cmd_list.append("cp "+self.find_file_by_type(".elf")+" /usr/local/QDesktop-fb")
self.cmd_list.append("chmod 777 /usr/local/QDesktop-fb")
self.cmd_list.append("cp "+self.file_file_by_type(".bin")+" /home/root/config/checker_slave.bin")
self.cmd_list.append("cp "+self.file_file_by_type("scheme.json")+" /home/root/config/checker_ye_cfg.json")
self.cmd_list.append("cp "+self.find_file_by_type(".bin")+" /home/root/config/checker_slave.bin")
self.cmd_list.append("cp "+self.find_file_by_type("scheme.json")+" /home/root/config/checker_ye_cfg.json")
self.cmd_list.append("cp cfg.json /home/root/config/cfg.json")
self.cmd_list.append("cp "+self.file_file_by_type(".axf")+" /lib/firmware/checker_m4.axf")
self.cmd_list.append("cp "+self.file_file_by_type(".dtb")+" /boot/stm32mp157d-atk.dtb")
self.cmd_list.append("cp "+self.find_file_by_type(".axf")+" /lib/firmware/checker_m4.axf")
self.cmd_list.append("cp "+self.find_file_by_type(".dtb")+" /boot/stm32mp157d-atk.dtb")
self.cmd_list.append("cp "+self.find_file_by_type(".py")+ " /home/root/daemon.py")
self.cmd_list.append("cp "+self.find_file_by_type(".service")+ " /lib/systemd/system/pydeamon.service")
self.cmd_list.append("sync")
self.cmd_list.append("systemctl restart atk-qtapp-start.service")
self.cmd_list.append("systemctl enable pyeamon.service")
self.cmd_list.append("systemctl restart pyeamon.service")
def send_cmdlist(self):
if(len(self.cmd_list)>0):