diff --git a/CHANGELOG.md b/CHANGELOG.md index 90c91022..7a56f7f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- Provide additional details on Hardware/CPU information +- Allow execution with option "--version", while another hyperion daemon is running + ### Changed ### Fixed diff --git a/assets/webconfig/content/about.html b/assets/webconfig/content/about.html index 7246ca87..8a44aa48 100644 --- a/assets/webconfig/content/about.html +++ b/assets/webconfig/content/about.html @@ -42,10 +42,22 @@ info += '- UI Lang: ' + storedLang + ' (BrowserLang: ' + navigator.language + ')\n'; info += '- UI Access: ' + storedAccess + '\n'; //info += 'Log lvl: ' + window.serverConfig.logger.level + '\n'; - info += '- Avail Capt: ' + window.serverInfo.grabbers.available + '\n\n'; + info += '- Avail Capt: ' + window.serverInfo.grabbers.available + '\n'; + info += '\n'; + info += 'Hyperion Server OS: \n'; info += '- Distribution: ' + sys.prettyName + '\n'; - info += '- Arch: ' + sys.architecture + '\n'; + info += '- Architecture: ' + sys.architecture + '\n'; + + if (sys.cpuModelName) + info += '- CPU Model: ' + sys.cpuModelName + '\n'; + if (sys.cpuModelType) + info += '- CPU Type: ' + sys.cpuModelType + '\n'; + if (sys.cpuRevision) + info += '- CPU Revision: ' + sys.cpuRevision + '\n'; + if (sys.cpuHardware) + info += '- CPU Hardware: ' + sys.cpuHardware + '\n'; + info += '- Kernel: ' + sys.kernelType + ' (' + sys.kernelVersion + ' (WS: ' + sys.wordSize + '))\n'; info += '- Browser: ' + navigator.userAgent + ' '; diff --git a/assets/webconfig/js/content_logging.js b/assets/webconfig/js/content_logging.js index 6836bc7b..237a0a89 100644 --- a/assets/webconfig/js/content_logging.js +++ b/assets/webconfig/js/content_logging.js @@ -79,9 +79,21 @@ $(document).ready(function() { info += 'UI Lang: '+storedLang+' (BrowserL: '+navigator.language+')\n'; info += 'UI Access: '+storedAccess+'\n'; info += 'Log lvl: '+window.serverConfig.logger.level+'\n'; - info += 'Avail Capt: '+window.serverInfo.grabbers.available+'\n\n'; + info += 'Avail Capt: '+window.serverInfo.grabbers.available+'\n'; + info += '\n'; + info += 'Distribution:'+sys.prettyName+'\n'; - info += 'Arch: '+sys.architecture+'\n'; + info += 'Architecture:'+sys.architecture+'\n'; + + if (sys.cpuModelName) + info += 'CPU Model: ' + sys.cpuModelName + '\n'; + if (sys.cpuModelType) + info += 'CPU Type: ' + sys.cpuModelType + '\n'; + if (sys.cpuRevision) + info += 'CPU Revision:' + sys.cpuRevision + '\n'; + if (sys.cpuHardware) + info += 'CPU Hardware:' + sys.cpuHardware + '\n'; + info += 'Kernel: '+sys.kernelType+' ('+sys.kernelVersion+' (WS: '+sys.wordSize+'))\n'; info += 'Browser/OS: '+navigator.userAgent+'\n\n'; diff --git a/include/utils/SysInfo.h b/include/utils/SysInfo.h index c8dca5d7..3c9ec27c 100644 --- a/include/utils/SysInfo.h +++ b/include/utils/SysInfo.h @@ -11,6 +11,10 @@ public: QString kernelType; QString kernelVersion; QString architecture; + QString cpuModelName; + QString cpuModelType; + QString cpuRevision; + QString cpuHardware; QString wordSize; QString productType; QString productVersion; @@ -23,6 +27,7 @@ public: private: SysInfo(); + void getCPUInfo(); static SysInfo* _instance; diff --git a/libsrc/api/JsonAPI.cpp b/libsrc/api/JsonAPI.cpp index 0bedbeac..48526e1b 100644 --- a/libsrc/api/JsonAPI.cpp +++ b/libsrc/api/JsonAPI.cpp @@ -275,6 +275,10 @@ void JsonAPI::handleSysInfoCommand(const QJsonObject &, const QString &command, system["kernelType"] = data.kernelType; system["kernelVersion"] = data.kernelVersion; system["architecture"] = data.architecture; + system["cpuModelName"] = data.cpuModelName; + system["cpuModelType"] = data.cpuModelType; + system["cpuHardware"] = data.cpuHardware; + system["cpuRevision"] = data.cpuRevision; system["wordSize"] = data.wordSize; system["productType"] = data.productType; system["productVersion"] = data.productVersion; @@ -289,6 +293,7 @@ void JsonAPI::handleSysInfoCommand(const QJsonObject &, const QString &command, hyperion["gitremote"] = QString(HYPERION_GIT_REMOTE); hyperion["time"] = QString(__DATE__ " " __TIME__); hyperion["id"] = _authManager->getID(); + info["hyperion"] = hyperion; // send the result diff --git a/libsrc/utils/SysInfo.cpp b/libsrc/utils/SysInfo.cpp index 7898ecde..e5fa1625 100644 --- a/libsrc/utils/SysInfo.cpp +++ b/libsrc/utils/SysInfo.cpp @@ -1,7 +1,12 @@ #include "utils/SysInfo.h" +#include "utils/FileUtils.h" #include #include +#include +#include + +#include SysInfo* SysInfo::_instance = nullptr; @@ -17,6 +22,7 @@ SysInfo::SysInfo() _sysinfo.prettyName = QSysInfo::prettyProductName(); _sysinfo.hostName = QHostInfo::localHostName(); _sysinfo.domainName = QHostInfo::localDomainName(); + getCPUInfo(); } SysInfo::HyperionSysInfo SysInfo::get() @@ -26,3 +32,48 @@ SysInfo::HyperionSysInfo SysInfo::get() return SysInfo::_instance->_sysinfo; } + +void SysInfo::getCPUInfo() +{ + QString cpuInfo; + if( FileUtils::readFile("/proc/cpuinfo", cpuInfo, Logger::getInstance("DAEMON"), true) ) + { + QRegularExpression regEx ("^model\\s*:\\s(.*)", QRegularExpression::CaseInsensitiveOption | QRegularExpression::MultilineOption); + QRegularExpressionMatch match; + + match = regEx.match(cpuInfo); + if ( match.hasMatch() ) + { + _sysinfo.cpuModelType = match.captured(1); + } + + regEx.setPattern("^model name\\s*:\\s(.*)"); + match = regEx.match(cpuInfo); + if ( match.hasMatch() ) + { + _sysinfo.cpuModelName = match.captured(1); + } + + regEx.setPattern("^hardware\\s*:\\s(.*)"); + match = regEx.match(cpuInfo); + if ( match.hasMatch() ) + { + _sysinfo.cpuHardware = match.captured(1); + } + + regEx.setPattern("^revision\\s*:\\s(.*)"); + match = regEx.match(cpuInfo); + if ( match.hasMatch() ) + { + _sysinfo.cpuRevision = match.captured(1); + } + + regEx.setPattern("^revision\\s*:\\s(.*)"); + match = regEx.match(cpuInfo); + if ( match.hasMatch() ) + { + _sysinfo.cpuRevision = match.captured(1); + } + } +} + diff --git a/src/hyperiond/main.cpp b/src/hyperiond/main.cpp index 5cbd9a8e..677d113a 100644 --- a/src/hyperiond/main.cpp +++ b/src/hyperiond/main.cpp @@ -198,6 +198,16 @@ int main(int argc, char** argv) parser.process(*qApp); + if (parser.isSet(versionOption)) + { + std::cout + << "Hyperion Ambilight Deamon" << std::endl + << "\tVersion : " << HYPERION_VERSION << " (" << HYPERION_BUILD_ID << ")" << std::endl + << "\tBuild Time: " << __DATE__ << " " << __TIME__ << std::endl; + + return 0; + } + if (!parser.isSet(waitOption)) { if (getProcessIdsByProcessName(processName).size() > 1) @@ -246,15 +256,7 @@ int main(int argc, char** argv) return 0; } - if (parser.isSet(versionOption)) - { - std::cout - << "Hyperion Ambilight Deamon" << std::endl - << "\tVersion : " << HYPERION_VERSION << " (" << HYPERION_BUILD_ID << ")" << std::endl - << "\tBuild Time: " << __DATE__ << " " << __TIME__ << std::endl; - return 0; - } if (parser.isSet(exportEfxOption)) { @@ -303,8 +305,6 @@ int main(int argc, char** argv) if(!mDir.mkpath(userDataPath) || !mFi.isWritable() || !mDir.isReadable()) throw std::runtime_error("The user data path '"+mDir.absolutePath().toStdString()+"' can't be created or isn't read/writeable. Please setup permissions correctly!"); - Info(log, "Set user data path to '%s'", QSTRING_CSTR(mDir.absolutePath())); - // reset Password without spawning daemon if(parser.isSet(resetPassword)) { @@ -334,6 +334,10 @@ int main(int argc, char** argv) } } + Info(log,"Starting Hyperion - %s, %s, built: %s:%s", HYPERION_VERSION, HYPERION_BUILD_ID, __DATE__, __TIME__); + + Info(log, "Set user data path to '%s'", QSTRING_CSTR(mDir.absolutePath())); + HyperionDaemon* hyperiond = nullptr; try {