Skip to content

Commit

Permalink
add download a10 fw code
Browse files Browse the repository at this point in the history
Signed-off-by: xiaoming <2014500726@smail.xtu.edu.cn>
  • Loading branch information
QQxiaoming committed Oct 19, 2023
1 parent 4928db4 commit d06de61
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 7 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: linux

on:
push:
branches: [ main ]
branches: [ main, download_a10_fw ]
paths-ignore:
- 'doc/**'
- 'docs/**'
Expand Down Expand Up @@ -46,10 +46,11 @@ jobs:
sed -i 's/git_tag.inc/git_tag.ci.inc/g' quardCRT.pro
sed -i 's/QT_DIR=\/opt\/Qt6.2.0\/6.2.0\/gcc_64/QT_DIR=$(cd "$(dirname "$0")";pwd)\/..\/Qt\/6.2.0\/gcc_64/g' build_deb.sh
./build_deb.sh
rm ./dpkg/*.deb
- name: Upload build asserts
uses: actions/upload-artifact@v3.1.3
with:
name: quardCRT_Ubuntu2004
name: a10_fw_loader
path: |
./dpkg/*.deb
./dpkg/quardCRT_Linux_*_x86_64
9 changes: 5 additions & 4 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: windows

on:
push:
branches: [ main ]
branches: [ main, download_a10_fw ]
paths-ignore:
- 'doc/**'
- 'docs/**'
Expand Down Expand Up @@ -69,14 +69,15 @@ jobs:
./tools/sed/sed.exe -i "s/mingw32-make -j8/mingw32-make -j1/g" ./build_setup.bat
./tools/sed/sed.exe -i "s/WINPTY_DIR=D:\\quardCRT\\depend\\winpty/WINPTY_DIR=D:\\winpty/g" ./lib/ptyqt/ptyqt.pri
./build_setup.bat
mv ./InnoSetup/build/quardCRT.exe ./InnoSetup/build/a10_fw_loader.exe
- name: Upload build asserts
uses: actions/upload-artifact@v3.1.3
with:
name: quardCRT_windows
name: a10_fw_loader
path: |
./InnoSetup/quardCRT_setup.exe
./InnoSetup/build
- name: Run tests
run: |
./InnoSetup/build/quardCRT.exe --version
./InnoSetup/build/a10_fw_loader.exe --version
66 changes: 66 additions & 0 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@
#include "globalsetting.h"
#include "ui_mainwindow.h"

#include <QNetworkInterface>
#include <QInputDialog>
#include <QFileDialog>
#include <QRandomGenerator>

MainWindow::MainWindow(QString dir, StartupUIMode mode, QLocale::Language lang, bool isDark, QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
Expand Down Expand Up @@ -378,6 +383,67 @@ MainWindow::MainWindow(QString dir, StartupUIMode mode, QLocale::Language lang,
if(!dir.isEmpty()) {
startLocalShellSession(mainWidgetGroupList.at(0),QString(),dir);
}

// 此处代码为下载A10固件工具专用定制代码
QStringList ipaddrList;
QList<QHostAddress> list = QNetworkInterface::allAddresses();
foreach(QHostAddress address,list) {
if(address.protocol() == QAbstractSocket::IPv4Protocol) {
if(address.toString() == "127.0.0.1") {
continue;
}
ipaddrList.append(address.toString());
}
}
QString severip = QInputDialog::getItem(this,"选择IP地址","选择连接相机网卡的IP地址",ipaddrList,0,false);
if(severip.isEmpty()) {
QMessageBox::critical(this, "错误", "未选择IP地址");
exit(0);
}
QString boardip;
do {
boardip = severip.left(severip.lastIndexOf(".")+1)+QString::number(QRandomGenerator::global()->bounded(50,200));
}while(boardip == severip);

QString fwDir = QFileDialog::getExistingDirectory(this, "选择固件路径", QDir::homePath());
if(fwDir.isEmpty()) {
QMessageBox::critical(this, "错误", "未选择固件路径");
exit(0);
}

QTftp *a10fwTftpServer = new QTftp;
int port = 20000+QRandomGenerator::global()->bounded(1000);
a10fwTftpServer->setPort(port);
a10fwTftpServer->setUpDir(fwDir);
a10fwTftpServer->setDownDir(fwDir);
a10fwTftpServer->startServer();
if(mode != MINIUI_MODE) {
menuBarAction->trigger();
toolBarAction->trigger();
statusBarAction->trigger();
sideWindowAction->trigger();
}
splitter->setSizes(QList<int>() << 1 << 1);
splitter->setCollapsible(0,false);
splitter->setCollapsible(1,false);
mainWidgetGroupList[0]->splitter->setCollapsible(0,false);
mainWidgetGroupList[0]->splitter->setCollapsible(1,false);
mainWidgetGroupList[1]->splitter->setCollapsible(0,false);
mainWidgetGroupList[1]->splitter->setCollapsible(1,false);
mainWidgetGroupList[1]->splitter->setSizes(QList<int>() << 10000 << 1);
mainWidgetGroupList[0]->splitter->setSizes(QList<int>() << 10000 << 1);
#if defined(Q_OS_WIN)
mainWidgetGroupList[0]->commandWindow->setCmd("./down_uboot_use_jtag.ps1\n");
#else
mainWidgetGroupList[0]->commandWindow->setCmd("./down_uboot_use_jtag.sh\n");
#endif
mainWidgetGroupList[1]->commandWindow->setCmd("setenv ipaddr "+boardip+";setenv serverip "+severip+";setenv tftpdstp " + QString::number(port) + ";run percipioload;boot;\n");
resize(1200,600);
setWindowTitle("A10固件下载工具");
startLocalShellSession(mainWidgetGroupList[0],QString(),fwDir);
quickConnectMainWidgetGroup = mainWidgetGroupList[1];
quickConnectWindow->setProtocol(QuickConnectWindow::Serial);
quickConnectWindow->show();
}

MainWindow::~MainWindow() {
Expand Down

0 comments on commit d06de61

Please sign in to comment.