Index: scripts/rtc_check.out =================================================================== diff -u --- scripts/rtc_check.out (revision 0) +++ scripts/rtc_check.out (revision d005537390186cc065a824a923f41d615782b552) @@ -0,0 +1,2 @@ +1623175245.713140625 +1623175246.725028625 Index: scripts/run.sh =================================================================== diff -u -r8f45330e0b1af61e029bece73c9f23669ada56c1 -rd005537390186cc065a824a923f41d615782b552 --- scripts/run.sh (.../run.sh) (revision 8f45330e0b1af61e029bece73c9f23669ada56c1) +++ scripts/run.sh (.../run.sh) (revision d005537390186cc065a824a923f41d615782b552) @@ -76,13 +76,18 @@ # setup wifi killall wpa_supplicant >> $HOME/filesystem.out 2>> $HOME/filesystem.err -# driver check - bluetoothctl +# POST - driver check - bluetoothctl echo -e "show\n" | bluetoothctl > /tmp/bluetooth_check.out -# driver check - touchscreen and CAN +# POST - driver check - touchscreen and CAN dmesg | grep "touch" > /tmp/touchscreen_check.out lsmod > /tmp/modules_check.out +# POST - RTC +date +"%s.%N" > /tmp/rtc_check.out +sleep 1 +date +"%s.%N" >> /tmp/rtc_check.out + #launching denali application, disable keep-alive $HOME/denali -u & # 2>> $HOME/filesystem.err & Index: sources/storage/StorageGlobals.cpp =================================================================== diff -u -r8f45330e0b1af61e029bece73c9f23669ada56c1 -rd005537390186cc065a824a923f41d615782b552 --- sources/storage/StorageGlobals.cpp (.../StorageGlobals.cpp) (revision 8f45330e0b1af61e029bece73c9f23669ada56c1) +++ sources/storage/StorageGlobals.cpp (.../StorageGlobals.cpp) (revision d005537390186cc065a824a923f41d615782b552) @@ -111,11 +111,13 @@ const char *Path_Modules_Check = "/home/denali/Projects/application/scripts/modules_check.out"; const char *Path_Touchscreen_Check = "/home/denali/Projects/application/scripts/touchscreen_check.out"; const char *Path_Bluetooth_Check = "/home/denali/Projects/application/scripts/bluetoothctl_check.out"; + const char *Path_RTC_Check = "/home/denali/Projects/application/scripts/rtc_check.out"; #elif BUILD_FOR_TARGET const char *Path_FileSystem_Checksums = "/home/root/checksums_desktop.conf"; const char *Path_Modules_Check = "/tmp/modules_check.out"; const char *Path_Touchscreen_Check = "/tmp/touchscreen_check.out"; const char *Path_Bluetooth_Check = "/tmp/bluetoothctl_check.out"; + const char *Path_RTC_Check = "/tmp/rtc_check.out"; #endif Index: sources/storage/StorageGlobals.h =================================================================== diff -u -r8f45330e0b1af61e029bece73c9f23669ada56c1 -rd005537390186cc065a824a923f41d615782b552 --- sources/storage/StorageGlobals.h (.../StorageGlobals.h) (revision 8f45330e0b1af61e029bece73c9f23669ada56c1) +++ sources/storage/StorageGlobals.h (.../StorageGlobals.h) (revision d005537390186cc065a824a923f41d615782b552) @@ -77,5 +77,5 @@ extern const char *Path_Modules_Check; extern const char *Path_Touchscreen_Check; extern const char *Path_Bluetooth_Check; - + extern const char *Path_RTC_Check; } Index: sources/view/VUIPowerOnSelfTest.cpp =================================================================== diff -u -ra73067eedc12bcb4a41afdf4aabb6db9f1994f33 -rd005537390186cc065a824a923f41d615782b552 --- sources/view/VUIPowerOnSelfTest.cpp (.../VUIPowerOnSelfTest.cpp) (revision a73067eedc12bcb4a41afdf4aabb6db9f1994f33) +++ sources/view/VUIPowerOnSelfTest.cpp (.../VUIPowerOnSelfTest.cpp) (revision d005537390186cc065a824a923f41d615782b552) @@ -17,6 +17,7 @@ // Qt #include #include +#include // Project #include "FileHandler.h" @@ -48,6 +49,7 @@ { AdjustUIPostFinalResultRequestData data; + // assume success then set to 0 if there are any failures data.mResult = 1; if (!selfTestFileSystem()) data.mResult = 0; @@ -61,8 +63,6 @@ data.mResult = 0; if (!selfTestRTCClock()) data.mResult = 0; - if (!selfTestClockSpeed()) - data.mResult = 0; emit didAdjustment(data); } @@ -96,20 +96,17 @@ if (!FileHandler::read(Path_FileSystem_Checksums, obj)) return false; bool result = true; - QStringList invalidChecksums; for (const QString& path : obj.keys()) { QString calculatedChecksum = sha256(path); if ( calculatedChecksum != obj.value(path).toString()) { - invalidChecksums.append(path); + LOG_DEBUG(QString("Invalid checksum detected: %1").arg(path)); result = false; } else { LOG_DEBUG(QString("Checksum verified: %1").arg(path)); } } - for (const QString &invalidChecksum : invalidChecksums) - LOG_DEBUG(QString("Invalid checksum detected: %1").arg(invalidChecksum)); return result; } @@ -215,23 +212,38 @@ } /*! - * \brief VUIPostSingleResult::selfTestRTCClock - * Tests that the RTC clock is correct + * \brief VUIPostSingleResult::selfTestClockSpeed + * Test that the clock speed can be read and is within spec */ bool VUIPowerOnSelfTest::selfTestRTCClock() { - // TODO: If needed - return true; -} + QString content; + if (!FileHandler::read(Path_RTC_Check, content)) + { + LOG_DEBUG(QString("Could not read %1!").arg(Path_RTC_Check)); + return false; + } -/*! - * \brief VUIPostSingleResult::selfTestClockSpeed - * Test that the clock speed is within spec - */ -bool VUIPowerOnSelfTest::selfTestClockSpeed() -{ - // TODO: If needed - return true; + QStringList lines = content.split("\n", QString::SkipEmptyParts); + QList times; + for (const QString &line : lines) + { + bool ok = false; + double tm = line.toDouble(&ok); + if (ok) + times.append(tm); + } + if (times.length() == 2) + { + double diff = times.at(1) - times.at(0); + if ((diff > 0) && (diff < (1.0 + _rtc_tolerance))) + { + LOG_DEBUG("RTC Clock speed check passed."); + return true; + } + } + LOG_DEBUG("RTC Clock speed check failed."); + return false; } /*! Index: sources/view/VUIPowerOnSelfTest.h =================================================================== diff -u -ra73067eedc12bcb4a41afdf4aabb6db9f1994f33 -rd005537390186cc065a824a923f41d615782b552 --- sources/view/VUIPowerOnSelfTest.h (.../VUIPowerOnSelfTest.h) (revision a73067eedc12bcb4a41afdf4aabb6db9f1994f33) +++ sources/view/VUIPowerOnSelfTest.h (.../VUIPowerOnSelfTest.h) (revision d005537390186cc065a824a923f41d615782b552) @@ -40,12 +40,15 @@ VIEW_DEC_CLASS(VUIPowerOnSelfTest) VIEW_DEC_SLOT(HDRequestVersionsData) + private: + struct PostTest { QString name; quint32 result = 2; }; + const float _rtc_tolerance = 0.050; // seconds QList _tests; void powerOnSelfTests(); @@ -56,7 +59,6 @@ bool selfTestBluetoothDriver(); bool selfTestCANDriver(); bool selfTestRTCClock(); - bool selfTestClockSpeed(); bool checkFileForRegularExpression(const QString &vFilePath, const QRegularExpression vRegExp); signals: