Merge branch 'pu/ATBUpdateDC_CommandLineParameter'

This commit is contained in:
2026-02-16 16:30:27 +01:00
5 changed files with 33 additions and 46 deletions

View File

@@ -98,9 +98,6 @@ OTHER_FILES += \
../ATBUpdateTool.ini ../ATBUpdateTool.ini
FORMS += \
mainwindow.ui
########################################################################################## ##########################################################################################
# for running program on target through QtCreator # for running program on target through QtCreator
contains( CONFIG, PTU5 ) { contains( CONFIG, PTU5 ) {

View File

@@ -4,7 +4,6 @@
#include <QByteArray> #include <QByteArray>
#include <QProcess> #include <QProcess>
#include <QCommandLineParser>
#include <QStandardPaths> #include <QStandardPaths>
#include <QSettings> #include <QSettings>
#include <QDir> #include <QDir>
@@ -65,9 +64,7 @@ int main(int argc, char **argv) {
setDebugLevel(LOG_NOTICE); setDebugLevel(LOG_NOTICE);
} }
//return 0; /*
/*
CommandLineParser parser; CommandLineParser parser;
parser.process(a); parser.process(a);
parser.readSettings(); parser.readSettings();
@@ -129,21 +126,13 @@ int main(int argc, char **argv) {
printf(APP_EXTENDED_VERSION"\n"); printf(APP_EXTENDED_VERSION"\n");
return 0; return 0;
} }
*/
QString const &customerRepo
= QDir::cleanPath(workingDir + QDir::separator() + QString("customer_%1").arg(customerNr));
*/
QString const &psaDcDir = internal::customerRepoDcDir();
QString const &psaRepoRootDir = internal::customerRepoRoot();
QString const &psaRepoDir = internal::customerRepoDir();
QString const &branchName = internal::branchName();
bool debug = false; bool debug = false;
bool noaction = true; bool noaction = true;
QString workingDir;
QString libDir; QString libDir;
QString libca; QString libca;
QString workingDir;
std::unique_ptr<QSettings> settings = internal::readSettings(); std::unique_ptr<QSettings> settings = internal::readSettings();
@@ -162,37 +151,37 @@ int main(int argc, char **argv) {
settings->endGroup(); settings->endGroup();
} }
// etc/dc: located under mount-path
std::optional<QString> mountPath = System::checkForUSBStick(psaDcDir);
QFileInfo fi; QFileInfo fi;
if (mountPath.has_value()) {
fi.setFile(mountPath.value(), System::getDCFileOnUsbStick(mountPath.value()));
} else
if ((mountPath = System::checkForSDCard(psaDcDir)).has_value()) {
fi.setFile(mountPath.value(), System::getDCFileOnSDCard(mountPath.value()));
} else {
if (debug) { // ------------------- single command line argument is DC-firmware binary file -----------------
qInfo() << "using customer repository" << psaRepoDir; QStringList args = a.arguments();
if (args.size() != 2) {
qCritical() << "ERROR: missing parameter <dc-firmware>";
exit(1);
} }
std::unique_ptr<QString> c = internal::dcCandidateToInstall("/etc/dc/"); qCritical() << "------------------------------------------------------";
if (c) { qCritical() << "main: argument dc-firmware: " << args.at(1);
fi.setFile(*c); qCritical() << "------------------------------------------------------";
if (fi.exists() == false) {
qCritical() << "dc2c.bin candidate" << *c << "does not exist. STOP."; fi.setFile(args.at(1));
return -1;
} if (!fi.isFile()) {
qInfo() << "dc2c.bin canditate" << fi.absoluteFilePath(); qCritical() << "ERROR: parameter " << fi.absoluteFilePath() << " is not a file";
} exit(1);
} }
if (debug) { if (!fi.isReadable()) {
qInfo() << "downloading dc-firmware" << fi.absoluteFilePath(); qCritical() << "ERROR: parameter " << fi.absoluteFilePath() << " is not readable";
qInfo() << "dc-firmware size (bytes)" << fi.size(); exit(1);
qInfo() << "dc-version" << Update::dcVersion(fi.absoluteFilePath());
} }
qCritical() << "------------------------------------------------------";
qCritical() << "uploading dc-firmware" << fi.absoluteFilePath();
qCritical() << "dc-firmware size (bytes)" << fi.size();
qCritical() << "dc-version" << Update::dcVersion(fi.absoluteFilePath());
qCritical() << "------------------------------------------------------";
Update u(fi.absoluteFilePath(), libca, debug, noaction); Update u(fi.absoluteFilePath(), libca, debug, noaction);
u.run(); u.run();

View File

@@ -397,9 +397,7 @@ int Update::run() {
qInfo() << "<DC-VERSION>" << Update::dcVersion(m_dcFileName); qInfo() << "<DC-VERSION>" << Update::dcVersion(m_dcFileName);
} }
if (!m_debug) {
m_hw->dc_autoRequest(false); m_hw->dc_autoRequest(false);
}
qInfo() << "DC auto request OFF"; qInfo() << "DC auto request OFF";

View File

@@ -405,7 +405,7 @@ std::optional<QString> GitClient::gitPull() {
export GIT_SSH_COMMAND="ssh -i /opt/app/tools/atbupdate/.keys/id_ed25519_ptuConfig -o StrictHostKeyChecking=no" export GIT_SSH_COMMAND="ssh -i /opt/app/tools/atbupdate/.keys/id_ed25519_ptuConfig -o StrictHostKeyChecking=no"
... or use separate known_hosts file: ... or use separate known_hosts file:
export GIT_SSH_COMMAND="ssh -i /mypath/.keys/id_ed25519 -o StrictHostKeyChecking=yes -o UserKnownHostsFile=/opt/app/tools/atbupdate/.keys/known_hosts export GIT_SSH_COMMAND="ssh -i /mypath/.keys/id_ed25519 -o StrictHostKeyChecking=yes -o UserKnownHostsFile=/opt/app/tools/atbupdate/.keys/known_hosts"
git pull git pull
leads to the following warning/error message: leads to the following warning/error message:

View File

@@ -178,6 +178,9 @@ QString Utils::zoneName(quint8 i) {
//if (i < (sizeof(zName)/sizeof(char const *))) { //if (i < (sizeof(zName)/sizeof(char const *))) {
// return zName[i]; // return zName[i];
//} //}
Q_UNUSED(i)
return "---"; return "---";
} }