diff --git a/include/botui/NetworkManager.h b/include/botui/NetworkManager.h index 3b403c3a..ff6e6629 100644 --- a/include/botui/NetworkManager.h +++ b/include/botui/NetworkManager.h @@ -50,6 +50,7 @@ class NetworkManager : public QObject, public Singleton void changeWifiBands(QString band, int channel); void requestScan(); void deactivateAP(); + void getRaspberryPiType(); bool isOn() const; diff --git a/src/NetworkManager.cpp b/src/NetworkManager.cpp index af4815d3..55a73dbe 100644 --- a/src/NetworkManager.cpp +++ b/src/NetworkManager.cpp @@ -619,7 +619,7 @@ NetworkManager::NetworkManager() m_device(0), m_wifi(0), m_dev(nullptr) { - + getRaspberryPiType(); // Register our metatype with dbus qDBusRegisterMetaType(); qDBusRegisterMetaType(); @@ -682,6 +682,34 @@ NetworkManager::NetworkManager() qDebug() << "Active strength: " << active().strength(); } +void NetworkManager::getRaspberryPiType() +{ + QStringList arguments; + arguments << "-c" << "cat /proc/cpuinfo | grep Revision | awk '{print $3}'"; + + QProcess *myProcess = new QProcess(this); + myProcess->start("/bin/sh", arguments); // Use /bin/sh or /bin/bash to interpret the command + myProcess->waitForFinished(); + QByteArray output = myProcess->readAllStandardOutput(); + + qDebug() << "Revision code output: " << output; + if (output.trimmed() == "a020d3" || output.trimmed() == "a020d4") + { + RASPBERRYPI_TYPE = "3B+"; + } + else if (output.trimmed() == "a02082" || output.trimmed() == "a22082" || output.trimmed() == "a32082" || output.trimmed() == "a52082" || output.trimmed() == "a22083") + { + RASPBERRYPI_TYPE = "3B"; + } + else + { + RASPBERRYPI_TYPE = "Unknown"; + } + + qDebug() << "RASPBERRYPI_TYPE: " << RASPBERRYPI_TYPE; + +} + void NetworkManager::nmAccessPointAdded(const QDBusObjectPath &accessPoint) { Network network = createAccessPoint(accessPoint);