Compare commits
2 Commits
2ab485454c
...
f5611cf826
Author | SHA1 | Date | |
---|---|---|---|
f5611cf826 | |||
8d5831286d |
@ -65,7 +65,6 @@ int main(int argc, char **argv) {
|
||||
setDebugLevel(LOG_NOTICE);
|
||||
}
|
||||
|
||||
|
||||
//return 0;
|
||||
|
||||
/*
|
||||
@ -172,7 +171,7 @@ int main(int argc, char **argv) {
|
||||
qInfo() << "using customer repository" << psaRepoDir;
|
||||
}
|
||||
|
||||
std::unique_ptr<QString> c = internal::dcCandidateToInstall();
|
||||
std::unique_ptr<QString> c = internal::dcCandidateToInstall("/etc/dc/");
|
||||
if (c) {
|
||||
fi.setFile(*c);
|
||||
if (fi.exists() == false) {
|
||||
@ -190,7 +189,7 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
Update u(fi.absoluteFilePath(), libca, debug, noaction);
|
||||
u.run();
|
||||
// u.run();
|
||||
|
||||
qInfo() << "<DC-UPDATE-FINISH>";
|
||||
|
||||
|
@ -130,16 +130,11 @@ Update::sendNextAddress(int bNum) const {
|
||||
if ( bNum==0 || bNum==1024 || bNum==2048 || bNum==3072 || bNum==4096 ) {
|
||||
// qDebug() << "addr-block" << bNum << "...";
|
||||
while (noAnswerCount <= 250) {
|
||||
// TODO
|
||||
// m_hw->bl_sendAddress(bNum);
|
||||
m_hw->bl_sendAddress(bNum);
|
||||
|
||||
QThread::msleep(100);
|
||||
|
||||
// TODO
|
||||
// DownloadResult const res = sendStatus(m_hw->bl_wasSendingAddOK());
|
||||
|
||||
DownloadResult const res = DownloadResult::OK;
|
||||
|
||||
DownloadResult const res = sendStatus(m_hw->bl_wasSendingAddOK());
|
||||
if (res != DownloadResult::NOP) {
|
||||
if (res == DownloadResult::ERROR) {
|
||||
if (++errorCount >= 10) {
|
||||
@ -179,20 +174,14 @@ Update::sendNextDataBlock(QByteArray const &binary, int bNum) const {
|
||||
qInfo() << s.toUtf8().constData();
|
||||
|
||||
QThread::msleep(200);
|
||||
return DownloadResult::OK;
|
||||
|
||||
// QByteArray b((const char *)(&local[0]), 64);
|
||||
// qCritical() << "SNDB" << bNum << b.size() << b.toHex();
|
||||
QByteArray b((const char *)(&local[0]), 64);
|
||||
qCritical() << "SNDB" << bNum << b.size() << b.toHex();
|
||||
|
||||
while (noAnswerCount <= 250) {
|
||||
// TODO
|
||||
// m_hw->bl_sendDataBlock(64, local);
|
||||
|
||||
// TODO
|
||||
// DownloadResult const res = sendStatus(m_hw->bl_wasSendingDataOK());
|
||||
|
||||
DownloadResult const res = DownloadResult::OK;
|
||||
m_hw->bl_sendDataBlock(64, local);
|
||||
|
||||
DownloadResult const res = sendStatus(m_hw->bl_wasSendingDataOK());
|
||||
if (res != DownloadResult::NOP) {
|
||||
if (res == DownloadResult::ERROR) {
|
||||
if (++errorCount >= 10) {
|
||||
@ -213,12 +202,13 @@ Update::sendNextDataBlock(QByteArray const &binary, int bNum) const {
|
||||
}
|
||||
|
||||
bool Update::startBootloader() const {
|
||||
#if 0
|
||||
qInfo() << nextTimePoint().toUtf8().constData() << "start boot loader";
|
||||
QThread::msleep(1000);
|
||||
qInfo() << nextTimePoint().toUtf8().constData() << "start boot loader ...done";
|
||||
return true;
|
||||
#else
|
||||
|
||||
#if 0
|
||||
int nTry = 5;
|
||||
while (--nTry >= 0) {
|
||||
m_hw->bl_startBL();
|
||||
@ -234,16 +224,19 @@ bool Update::startBootloader() const {
|
||||
}
|
||||
qCritical() << "starting bootloader...FAILED";
|
||||
return false;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Update::stopBootloader() const {
|
||||
#if 0
|
||||
qInfo() << nextTimePoint().toUtf8().constData() << "stopping bootloader";
|
||||
QThread::msleep(1000);
|
||||
qInfo() << nextTimePoint().toUtf8().constData() << "stopping bootloader ...done";
|
||||
return true;
|
||||
|
||||
#if 0
|
||||
#else
|
||||
|
||||
qDebug() << "stopping bootloader...";
|
||||
int nTry = 5;
|
||||
while (--nTry >= 0) {
|
||||
@ -256,13 +249,13 @@ bool Update::stopBootloader() const {
|
||||
}
|
||||
qCritical() << "stopping bootloader...FAILED";
|
||||
return false;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
bool Update::resetDeviceController() const {
|
||||
qInfo() << nextTimePoint().toUtf8().constData() << "resetting device controller";
|
||||
// TODO
|
||||
// m_hw->bl_rebootDC();
|
||||
m_hw->bl_rebootDC();
|
||||
|
||||
// wait maximally 3 seconds, before starting bootloader
|
||||
QThread::sleep(1);
|
||||
@ -280,12 +273,12 @@ QByteArray Update::loadBinaryDCFile(QString const &filename) const {
|
||||
if (!file.exists()) {
|
||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ")"
|
||||
<< file.fileName() << "does not exist";
|
||||
return QByteArray();
|
||||
return QByteArray{};
|
||||
}
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ")"
|
||||
<< "cannot open file" << file.fileName();
|
||||
return QByteArray();
|
||||
return QByteArray{};
|
||||
}
|
||||
|
||||
qInfo() << nextTimePoint().toUtf8().constData()
|
||||
@ -392,6 +385,8 @@ int Update::run() {
|
||||
|
||||
qInfo() << "DC auto request OFF";
|
||||
|
||||
qCritical() << "start dc-update for" << m_dcFileName << "at" << m_start.toString(Qt::ISODate);
|
||||
|
||||
QByteArray ba = loadBinaryDCFile(m_dcFileName);
|
||||
if (ba.size() > 0) {
|
||||
m_totalBlocks = (((ba.size())%64)==0) ? (ba.size()/64) : (ba.size()/64)+1;
|
||||
@ -411,8 +406,6 @@ int Update::run() {
|
||||
while (res != DownloadResult::ERROR && currentBlock < m_totalBlocks) {
|
||||
if ((res = sendNextAddress(currentBlock)) != DownloadResult::ERROR) {
|
||||
if ((res = sendNextDataBlock(ba, currentBlock)) != DownloadResult::ERROR) {
|
||||
// TODO
|
||||
// m_hw->dcDownloadSetCurrentBlockNumber(currentBlock);
|
||||
currentBlock += 1;
|
||||
} else break;
|
||||
}
|
||||
|
@ -280,8 +280,8 @@ Worker::Worker(int customerNr,
|
||||
// send device-controller firmware down to device-controller-hardware
|
||||
m_workList.push_back(
|
||||
std::make_unique<UpdateDCCommand>(
|
||||
QString("echo ATBUpdateDC")
|
||||
// QString("/opt/app/tools/atbupdate/ATBUpdateDC")
|
||||
// QString("echo ATBUpdateDC")
|
||||
QString("/opt/app/tools/atbupdate/ATBUpdateDC")
|
||||
, this, ++next));
|
||||
|
||||
// show/send software-status
|
||||
|
@ -116,6 +116,8 @@ std::unique_ptr<QSettings> readSettings(QString const &optionalDirName) {
|
||||
std::unique_ptr<QString> dcCandidateToInstall(QString const &dcDirectory) {
|
||||
std::unique_ptr<QString> dcCandidate{nullptr};
|
||||
|
||||
qCritical() << __func__ << __LINE__ << dcDirectory;
|
||||
|
||||
QDir dcDir{dcDirectory.isEmpty() ? customerRepoDcDir() : dcDirectory};
|
||||
if (dcDir.exists()) {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user