Index: sources/gui/qml/pages/settings/SettingsSWUpdate.qml =================================================================== diff -u -r20b370a54d2737831b307a0de82aec9e06e2b772 -r8ed1ad9f8c2de2ea19dd455cf59b648061c0a998 --- sources/gui/qml/pages/settings/SettingsSWUpdate.qml (.../SettingsSWUpdate.qml) (revision 20b370a54d2737831b307a0de82aec9e06e2b772) +++ sources/gui/qml/pages/settings/SettingsSWUpdate.qml (.../SettingsSWUpdate.qml) (revision 8ed1ad9f8c2de2ea19dd455cf59b648061c0a998) @@ -81,7 +81,7 @@ width : _root.cellWidth1 color : "#4290EC" Text { - text : "File name" + text : "Package Name" anchors.centerIn : parent } } @@ -161,6 +161,7 @@ text : displayRole anchors.centerIn : parent font.pixelSize : 18 + clip : true } color: colorRole Index: sources/update/IDataProvider.h =================================================================== diff -u -r20b370a54d2737831b307a0de82aec9e06e2b772 -r8ed1ad9f8c2de2ea19dd455cf59b648061c0a998 --- sources/update/IDataProvider.h (.../IDataProvider.h) (revision 20b370a54d2737831b307a0de82aec9e06e2b772) +++ sources/update/IDataProvider.h (.../IDataProvider.h) (revision 8ed1ad9f8c2de2ea19dd455cf59b648061c0a998) @@ -74,7 +74,12 @@ * * \return The amount of bytes fetched / ran out of data to fill the buffer. */ - virtual std::size_t read(std::size_t offset, unsigned char* pBuffer, std::size_t size_bytes) = 0; + virtual std::size_t read(std::size_t offset, unsigned char* pBuffer, std::size_t size_bytes) { + (void)offset; + (void)pBuffer; + (void)size_bytes; + return 0; // NOP. + } /*! * \brief Copy a file to a given destination. @@ -94,7 +99,7 @@ // Use our fileDestination set at constructor if we don't override. FILE* pDest = fopen( - destination.size() != 0 ? destination.c_str() : fileDestination.c_str(), + destination.size() != 0 ? destination.c_str() : fileDestination.c_str(), "wb"); std::size_t copied = 0; @@ -103,11 +108,11 @@ rv = true; while (rv) { try { - std::size_t sz_r = read(copied, pBuffer, MEMORY_PAGE_SIZE); + std::size_t sz_r = this->read(copied, pBuffer, MEMORY_PAGE_SIZE); if (sz_r == 0) { break; } else { - decrypt(pBuffer, sz_r); + //IDataProvider::decrypt(pBuffer, sz_r); std::size_t sz_w = fwrite(pBuffer, 1, sz_r, pDest); if (sz_w != sz_r) { rv = false; @@ -117,7 +122,7 @@ } catch (...) { rv = false; } - } + } // Close it. rv &= (fclose(pDest) == 0); @@ -143,7 +148,7 @@ * \param pBuffer Buffer to use. * \param size_bytes Max bytes to return. */ - void decrypt(unsigned char* pBuffer, std::size_t size_bytes) { + static void decrypt(unsigned char* pBuffer, std::size_t size_bytes) { const unsigned char obs = 71; // Randomly picked value. for (uint32 ii = 0; ii < size_bytes; ii++) { pBuffer[ii] -= obs; Index: sources/update/IEnterBootLoader.h =================================================================== diff -u -r7cf31f6cfef97bb564a103c263821a3b722c8a2b -r8ed1ad9f8c2de2ea19dd455cf59b648061c0a998 --- sources/update/IEnterBootLoader.h (.../IEnterBootLoader.h) (revision 7cf31f6cfef97bb564a103c263821a3b722c8a2b) +++ sources/update/IEnterBootLoader.h (.../IEnterBootLoader.h) (revision 8ed1ad9f8c2de2ea19dd455cf59b648061c0a998) @@ -35,7 +35,10 @@ * * \param asHd True=do the HD, False=do the DG. */ - virtual void sendEnterBootloader(bool asHd) = 0; + virtual void sendEnterBootloader(bool asHd) { + (void)asHd; + ; // NOp. + } }; } // namespace SwUpdate Index: sources/update/UiProtocol.h =================================================================== diff -u -r7cf31f6cfef97bb564a103c263821a3b722c8a2b -r8ed1ad9f8c2de2ea19dd455cf59b648061c0a998 --- sources/update/UiProtocol.h (.../UiProtocol.h) (revision 7cf31f6cfef97bb564a103c263821a3b722c8a2b) +++ sources/update/UiProtocol.h (.../UiProtocol.h) (revision 8ed1ad9f8c2de2ea19dd455cf59b648061c0a998) @@ -261,10 +261,14 @@ * \return True on started ok. */ void setup( - std::vector& targets) { + std::vector& targets) { std::lock_guard lockApi(_apiMutex); - _targets = targets; + // Copy. + + for (DataProvider_File* p : targets) { + _targets.emplace_back(DataProvider_File(*p)); + } // So UI threads can get transfer status asynchronously // once we start, save off the transfer max in number of files. @@ -273,6 +277,7 @@ // Copy the key info in. _desired = Complete; _lastState = None; + _state = Starting; } /*! @@ -283,9 +288,9 @@ // In theory this is fast, so "status" is about number of files copied. bool ok = true; - for (IDataProvider* p : _targets) { + for (IDataProvider& p : _targets) { if (_desired == Complete) { - ok = p->copyFile(); + ok = p.copyFile(); } else { break; @@ -300,7 +305,7 @@ } protected: - std::vector _targets; ///< File targets to copy. + std::vector _targets; ///< File targets to copy. }; } // namespace::SwUpdate Index: sources/update/UiSwUpdate.cpp =================================================================== diff -u -r7cf31f6cfef97bb564a103c263821a3b722c8a2b -r8ed1ad9f8c2de2ea19dd455cf59b648061c0a998 --- sources/update/UiSwUpdate.cpp (.../UiSwUpdate.cpp) (revision 7cf31f6cfef97bb564a103c263821a3b722c8a2b) +++ sources/update/UiSwUpdate.cpp (.../UiSwUpdate.cpp) (revision 8ed1ad9f8c2de2ea19dd455cf59b648061c0a998) @@ -85,8 +85,8 @@ // Get a list of the files, UI then linux. std::map aboutToStart; - std::vector uiFiles; - std::vector linuxFiles; + std::vector uiFiles; + std::vector linuxFiles; std::vector priorTargets; // Make a list we can access via map to get ordering, and get the files. @@ -96,11 +96,11 @@ // Handle files. if (target == UI) { - uiFiles.push_back(pDp); + uiFiles.push_back(dynamic_cast(pDp)); continue; } if (target == LINUX) { - linuxFiles.push_back(pDp); + linuxFiles.push_back(dynamic_cast(pDp)); continue; } Index: sources/update/VSwUpdate.cpp =================================================================== diff -u -rd87d797c11e7a6f4c0b2559bb8fd50fc33643cbc -r8ed1ad9f8c2de2ea19dd455cf59b648061c0a998 --- sources/update/VSwUpdate.cpp (.../VSwUpdate.cpp) (revision d87d797c11e7a6f4c0b2559bb8fd50fc33643cbc) +++ sources/update/VSwUpdate.cpp (.../VSwUpdate.cpp) (revision 8ed1ad9f8c2de2ea19dd455cf59b648061c0a998) @@ -34,7 +34,7 @@ // Enables (1) or disables (!1) reboot to allow for better testing. // Default is to reboot when this is finished. #ifndef REBOOT_ENABLED -#define REBOOT_ENABLED (0) +#define REBOOT_ENABLED (1) #endif #define MSG_ID_ENTER_BOOTLOADER_NOW (0x8093) ///< HD Jump to the bootloader application @@ -481,17 +481,29 @@ // For now just log. writeLog("We are rebooting!", false); #if (REBOOT_ENABLED == 1) + QProcess* pd = new QProcess(); - pd->start(QString::fromStdString("systemctl --message=\"Software upgrade\" reboot; sleep 1s"), QStringList()); + pd->start(QString::fromStdString("./bin/systemctl --message=\"Software upgrade\" reboot; sleep 1s"), QStringList()); // We want the process we spawned to finish causing the reboot even if the CPU was busy. // Sleep 1 second (just in case) then spin wait for finished. There is a sleep of 1s in the command line. QThread::currentThread()->msleep(1000); pd->waitForFinished(); + QString output = QString::fromLocal8Bit(pd->readAllStandardOutput()) + " : " + + QString::fromLocal8Bit(pd->readAllStandardError()); + QProcess* pd2 = new QProcess(); + pd2->start(QString::fromStdString("./sbin/reboot"), QStringList()); + + // We want the process we spawned to finish causing the reboot even if the CPU was busy. + // Sleep 1 second (just in case) then spin wait for finished. There is a sleep of 1s in the command line. + pd2->waitForFinished(); + output += "2" + QString::fromLocal8Bit(pd2->readAllStandardOutput()) + " : " + + QString::fromLocal8Bit(pd2->readAllStandardError()); + // If we got here, we are likely failing at rebooting for some reason and should log it. // User can always manually reboot. - writeLog("We failed to reboot???", false); + writeLog("We failed to reboot ??? " + output, false); setState(_stateMsg + "\nFailed to update, please power cycle!"); #endif } @@ -596,7 +608,7 @@ pch->start(QString::fromStdString("chmod 755 " + script), QStringList()); pch->waitForFinished(); QProcess* pd = new QProcess(); - pd->start(QString::fromStdString("." + script), QStringList()); + pd->start(QString::fromStdString("./" + script), QStringList()); pd->waitForFinished(); } // Signal done. @@ -624,7 +636,6 @@ bool hadUi = false; for (SwUpdate::UiUpdateStatus s : stats) { hadUi |= s.targetName == "Files"; - allCompleted &= (s.stepName == "Completed"); } if (allCompleted && hadUi) { emit aboutToReboot();