From 24a11e3f2c01d81bd16bbd71e03082c3954dfc30 Mon Sep 17 00:00:00 2001 From: Erin Date: Thu, 7 Nov 2024 15:05:45 -0600 Subject: [PATCH 01/17] Updated KIPR_VERSION to 1.2.0 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4189a949..c19de02e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ option(DEBUG "Enable debug mode" OFF) option(RELEASE "Enable release mode" OFF) option(docker_cross "Cross compile option for docker container" OFF) set(KIPR_VERSION_MAJOR 1) -set(KIPR_VERSION_MINOR 1) +set(KIPR_VERSION_MINOR 2) set(KIPR_VERSION_PATCH 0) cmake_minimum_required(VERSION 2.8.11) From ea8f83a0b54ed9fe27ba336fb8a47fedb28a05a3 Mon Sep 17 00:00:00 2001 From: Erin Date: Thu, 7 Nov 2024 16:25:49 -0600 Subject: [PATCH 02/17] Changed USB update path to use wombat-os/updateFiles/wombat_update.sh --- src/WombatUpdateWidget.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/WombatUpdateWidget.cpp b/src/WombatUpdateWidget.cpp index e384c4cb..8906e822 100644 --- a/src/WombatUpdateWidget.cpp +++ b/src/WombatUpdateWidget.cpp @@ -51,8 +51,11 @@ void WombatUpdateWidget::update() // Check if update file exists QDir subDir = WombatUpdateWidget::mountDir; subDir.cd(selectedName); - if(!subDir.exists(WombatUpdateWidget::updateFileName)) - QMessageBox::warning(this, "File not found", "The update file no longer exists"); + QDir updateDir = subDir; + updateDir.cd("updateFiles") + + if(!updateDir.exists("wombat_update.sh")) + QMessageBox::warning(this, "File not found", "The update file wombat_update.sh does not exist"); else { // Change UI to show output ui->updateConsole->setVisible(true); From bd2b23a9699011a6f68b6fe6c7e59bd8b48ee60a Mon Sep 17 00:00:00 2001 From: Erin Date: Thu, 7 Nov 2024 16:40:47 -0600 Subject: [PATCH 03/17] Edit to add ";" --- src/WombatUpdateWidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WombatUpdateWidget.cpp b/src/WombatUpdateWidget.cpp index 8906e822..3a52e4d2 100644 --- a/src/WombatUpdateWidget.cpp +++ b/src/WombatUpdateWidget.cpp @@ -52,7 +52,7 @@ void WombatUpdateWidget::update() QDir subDir = WombatUpdateWidget::mountDir; subDir.cd(selectedName); QDir updateDir = subDir; - updateDir.cd("updateFiles") + updateDir.cd("updateFiles"); if(!updateDir.exists("wombat_update.sh")) QMessageBox::warning(this, "File not found", "The update file wombat_update.sh does not exist"); From 64fc3c7c810bdc9c0d0406bf47475912591f0fca Mon Sep 17 00:00:00 2001 From: Erin Date: Fri, 8 Nov 2024 14:54:30 -0600 Subject: [PATCH 04/17] Changing directory and file checks for USB update --- src/WombatUpdateWidget.cpp | 137 ++++++++++++++++++------------------- 1 file changed, 68 insertions(+), 69 deletions(-) diff --git a/src/WombatUpdateWidget.cpp b/src/WombatUpdateWidget.cpp index 3a52e4d2..21b8e001 100644 --- a/src/WombatUpdateWidget.cpp +++ b/src/WombatUpdateWidget.cpp @@ -7,69 +7,70 @@ #include WombatUpdateWidget::WombatUpdateWidget(Device *device, QWidget *parent) - : StandardWidget(device, parent), - ui(new Ui::WombatUpdateWidget) + : StandardWidget(device, parent), + ui(new Ui::WombatUpdateWidget) { ui->setupUi(this); performStandardSetup("Update"); - + ui->updateConsole->setVisible(false); - + connect(ui->update, SIGNAL(clicked()), SLOT(update())); connect(ui->refresh, SIGNAL(clicked()), SLOT(refresh())); - connect(ui->ethernet, SIGNAL(clicked()), SLOT(ethernet())); + connect(ui->ethernet, SIGNAL(clicked()), SLOT(ethernet())); } WombatUpdateWidget::~WombatUpdateWidget() { delete ui; } - + void WombatUpdateWidget::update() -{ +{ // Get single selected item const QList selected = ui->updateList->selectedItems(); - if(selected.size() != 1) + if (selected.size() != 1) return; const QString selectedName = selected.at(0)->text(); - + // Verify with user that they want to do the update - if(QMessageBox::question(this, "Update?", - QString("Are you sure you want to update using %1?").arg(selectedName), - QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) - return; - + if (QMessageBox::question(this, "Update?", + QString("Are you sure you want to update using %1?").arg(selectedName), + QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) + return; + // Disable buttons ui->update->setEnabled(false); ui->refresh->setEnabled(false); ui->ethernet->setEnabled(false); // Mount USB drive - if(!this->mountUsb("/dev/sda1", WombatUpdateWidget::mountDir) && !this->mountUsb("/dev/sdb1", WombatUpdateWidget::mountDir)) + if (!this->mountUsb("/dev/sda1", WombatUpdateWidget::mountDir) && !this->mountUsb("/dev/sdb1", WombatUpdateWidget::mountDir)) QMessageBox::warning(this, "USB not found", "Failed to mount USB device"); - else { - // Check if update file exists - QDir subDir = WombatUpdateWidget::mountDir; - subDir.cd(selectedName); - QDir updateDir = subDir; - updateDir.cd("updateFiles"); - - if(!updateDir.exists("wombat_update.sh")) - QMessageBox::warning(this, "File not found", "The update file wombat_update.sh does not exist"); - else { + else + { + + // Check if selectedName contains ".zip" + if (!selectedName.contains(".zip", Qt::CaseInsensitive)) + { + QMessageBox::warning(this, "File Not Found", "The selected folder is not a .zip folder"); + } + else + { // Change UI to show output ui->updateConsole->setVisible(true); ui->selectionWidget->setVisible(false); ui->statusLabel->setText("Update progress:"); - + // Run update process m_updateProc = new QProcess(); m_updateProc->setProcessChannelMode(QProcess::MergedChannels); - m_updateProc->setWorkingDirectory(subDir.absolutePath()); + m_updateProc->setWorkingDirectory("/home/kipr"); ui->updateConsole->setProcess(m_updateProc); connect(m_updateProc, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(updateFinished(int, QProcess::ExitStatus))); - m_updateProc->start("sh", QStringList() << WombatUpdateWidget::updateFileName); - + QString selectedPath = WombatUpdateWidget::mountDir.absoluteFilePath(selectedName); + m_updateProc->start("sh", QStringList() << "updateMe.sh" << selectedPath); + // Update script will reboot the controller } } @@ -78,33 +79,34 @@ void WombatUpdateWidget::update() void WombatUpdateWidget::refresh() { ui->refresh->setEnabled(false); - + // Clear items ui->updateList->clear(); - + // Mount USB drive - if(!this->mountUsb("/dev/sda1", WombatUpdateWidget::mountDir) && !this->mountUsb("/dev/sdb1", WombatUpdateWidget::mountDir)) + if (!this->mountUsb("/dev/sda1", WombatUpdateWidget::mountDir) && !this->mountUsb("/dev/sdb1", WombatUpdateWidget::mountDir)) QMessageBox::warning(this, "USB not found", "Failed to mount USB device"); - else { + else + { // Look at each directory - foreach(const QString &name, WombatUpdateWidget::mountDir.entryList(QDir::NoDotAndDotDot | QDir::Dirs)) + foreach (const QString &name, WombatUpdateWidget::mountDir.entryList(QDir::NoDotAndDotDot | QDir::Dirs)) { // Filter out directories without updates QDir subDir = WombatUpdateWidget::mountDir; subDir.cd(name); - - if(!subDir.exists(WombatUpdateWidget::updateFileName)) + + if (!subDir.exists(WombatUpdateWidget::updateFileName)) continue; - + // Add directory to the list ui->updateList->addItem(subDir.dirName()); } - + // Unmount USB drive - if(!this->unmountUsb(WombatUpdateWidget::mountDir.absolutePath())) + if (!this->unmountUsb(WombatUpdateWidget::mountDir.absolutePath())) qDebug() << "Failed to unmount USB drive"; } - + ui->refresh->setEnabled(true); } @@ -112,26 +114,25 @@ void WombatUpdateWidget::updateFinished(int, QProcess::ExitStatus exitStatus) { StandardWidget::enableMenuBar(); - - //Check to see if the update failed - if(m_updateProc->exitStatus() != QProcess::NormalExit){ - ui->updateConsole->insertPlainText("\n Update Failed (Crashed): \n The update script has crashed with an error. \n Contact KIPR tech support for assistance if the problem persists \n"); - ui->updateConsole->moveCursor(QTextCursor::End, QTextCursor::KeepAnchor); - } + // Check to see if the update failed + if (m_updateProc->exitStatus() != QProcess::NormalExit) + { + ui->updateConsole->insertPlainText("\n Update Failed (Crashed): \n The update script has crashed with an error. \n Contact KIPR tech support for assistance if the problem persists \n"); + ui->updateConsole->moveCursor(QTextCursor::End, QTextCursor::KeepAnchor); + } // Cleanup process ui->updateConsole->setProcess(0); delete m_updateProc; - + // Unmount USB drive - if(!this->unmountUsb(WombatUpdateWidget::mountDir.absolutePath())) + if (!this->unmountUsb(WombatUpdateWidget::mountDir.absolutePath())) qDebug() << "Failed to unmount USB drive"; - + // Re-enable buttons ui->refresh->setEnabled(true); ui->update->setEnabled(true); - } bool WombatUpdateWidget::mountUsb(const QString device, const QDir dir) @@ -151,27 +152,25 @@ bool WombatUpdateWidget::unmountUsb(const QString device) const QString WombatUpdateWidget::updateFileName = "wombat_update.sh"; const QDir WombatUpdateWidget::mountDir = QDir("/mnt"); -void WombatUpdateWidget::ethernet(){ - if(QMessageBox::question(this, "Update?", QString("Is your controller connected to the internet over ethernet or Wifi?"), QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) { +void WombatUpdateWidget::ethernet() +{ + if (QMessageBox::question(this, "Update?", QString("Is your controller connected to the internet over ethernet or Wifi?"), QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) + { return; } - // Change UI to show output - ui->updateConsole->setVisible(true); - ui->selectionWidget->setVisible(false); - ui->statusLabel->setText("Update progress:"); - - - //Disables menubar (Back and Home buttons) in StandardWidget - StandardWidget::disableMenuBar(); - - - // Run update process - m_updateProc = new QProcess(); - m_updateProc->setProcessChannelMode(QProcess::MergedChannels); - ui->updateConsole->setProcess(m_updateProc); - connect(m_updateProc, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(updateFinished(int, QProcess::ExitStatus))); - m_updateProc->startCommand("sudo sh /home/kipr/updateMe.sh"); -} + // Change UI to show output + ui->updateConsole->setVisible(true); + ui->selectionWidget->setVisible(false); + ui->statusLabel->setText("Update progress:"); + // Disables menubar (Back and Home buttons) in StandardWidget + StandardWidget::disableMenuBar(); + // Run update process + m_updateProc = new QProcess(); + m_updateProc->setProcessChannelMode(QProcess::MergedChannels); + ui->updateConsole->setProcess(m_updateProc); + connect(m_updateProc, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(updateFinished(int, QProcess::ExitStatus))); + m_updateProc->startCommand("sudo sh /home/kipr/updateMe.sh"); +} From 5b79b3c73e8db88deb21abcd0c8fd6e0d243363c Mon Sep 17 00:00:00 2001 From: Erin Date: Fri, 8 Nov 2024 15:05:49 -0600 Subject: [PATCH 05/17] Changed what refresh() looks for (zip files) --- src/WombatUpdateWidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/WombatUpdateWidget.cpp b/src/WombatUpdateWidget.cpp index 21b8e001..6bb535bb 100644 --- a/src/WombatUpdateWidget.cpp +++ b/src/WombatUpdateWidget.cpp @@ -91,11 +91,11 @@ void WombatUpdateWidget::refresh() // Look at each directory foreach (const QString &name, WombatUpdateWidget::mountDir.entryList(QDir::NoDotAndDotDot | QDir::Dirs)) { - // Filter out directories without updates + // Filter out directories that aren't zip files QDir subDir = WombatUpdateWidget::mountDir; subDir.cd(name); - if (!subDir.exists(WombatUpdateWidget::updateFileName)) + if (!selectedName.contains(".zip", Qt::CaseInsensitive)) continue; // Add directory to the list From d8fa4e17505525bb26d2a4aa9d7271e5dafe8bde Mon Sep 17 00:00:00 2001 From: Erin Date: Fri, 8 Nov 2024 15:11:14 -0600 Subject: [PATCH 06/17] Editing bug in refresh() not looking for .zip files --- src/WombatUpdateWidget.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/WombatUpdateWidget.cpp b/src/WombatUpdateWidget.cpp index 6bb535bb..49fa8d34 100644 --- a/src/WombatUpdateWidget.cpp +++ b/src/WombatUpdateWidget.cpp @@ -89,17 +89,14 @@ void WombatUpdateWidget::refresh() else { // Look at each directory - foreach (const QString &name, WombatUpdateWidget::mountDir.entryList(QDir::NoDotAndDotDot | QDir::Dirs)) + foreach (const QString &file, WombatUpdateWidget::mountDir.entryList(QDir::Files)) { - // Filter out directories that aren't zip files - QDir subDir = WombatUpdateWidget::mountDir; - subDir.cd(name); - - if (!selectedName.contains(".zip", Qt::CaseInsensitive)) + // Filter out files that aren't zip files + if (!file.contains(".zip", Qt::CaseInsensitive)) continue; // Add directory to the list - ui->updateList->addItem(subDir.dirName()); + ui->updateList->addItem(file); } // Unmount USB drive From a91d6d815cba029d2feeb2e64851e93bcdb96253 Mon Sep 17 00:00:00 2001 From: Erin Date: Fri, 8 Nov 2024 16:06:24 -0600 Subject: [PATCH 07/17] Updated where to find updateMe.sh script file --- src/WombatUpdateWidget.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/WombatUpdateWidget.cpp b/src/WombatUpdateWidget.cpp index 49fa8d34..d4b7ff07 100644 --- a/src/WombatUpdateWidget.cpp +++ b/src/WombatUpdateWidget.cpp @@ -68,8 +68,7 @@ void WombatUpdateWidget::update() m_updateProc->setWorkingDirectory("/home/kipr"); ui->updateConsole->setProcess(m_updateProc); connect(m_updateProc, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(updateFinished(int, QProcess::ExitStatus))); - QString selectedPath = WombatUpdateWidget::mountDir.absoluteFilePath(selectedName); - m_updateProc->start("sh", QStringList() << "updateMe.sh" << selectedPath); + m_updateProc->start("sh", QStringList() << "-c" << "/home/kipr/updateMe.sh /media/kipr/*/*"); // Update script will reboot the controller } From 340590250fb5d4de8f7984adbd17eb929b1f2a23 Mon Sep 17 00:00:00 2001 From: Erin Date: Mon, 11 Nov 2024 15:35:25 -0600 Subject: [PATCH 08/17] Added more revision codes to determine Raspberry Pi 3B vs. Raspberry Pi 3B+ --- src/NetworkSettingsWidget.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/NetworkSettingsWidget.cpp b/src/NetworkSettingsWidget.cpp index fc87f129..02bca007 100644 --- a/src/NetworkSettingsWidget.cpp +++ b/src/NetworkSettingsWidget.cpp @@ -97,7 +97,7 @@ void NetworkSettingsWidget::eventModeDisabledState() getWombatName(); // Get Wombat name INITIAL_CONNECTION_CONFIG = getConnectionConfig(); // Get initial connection config - RASPBERRYPI_TYPE_SETTINGS = "3B+"; + RASPBERRYPI_TYPE_SETTINGS = getRaspberryPiType(); if (RASPBERRYPI_TYPE_SETTINGS == "3B+") // if RaspberryPi is 3B+ { @@ -156,14 +156,17 @@ QString NetworkSettingsWidget::getRaspberryPiType() QByteArray output = myProcess->readAllStandardOutput(); qDebug() << "Revision code output: " << output; - - if (output.contains("a020d3")) + if (output.trimmed() == "a020d3" || output.trimmed() == "a020d4") + { + piType = "3B+"; + } + else if (output.trimmed() == "a02082" || output.trimmed() == "a22082" || output.trimmed() == "a32082" || output.trimmed() == "a52082" || output.trimmed() == "a22083") { - RASPBERRYPI_TYPE_SETTINGS = "3B+"; + piType = "3B"; } - else if (output.contains("a02082") || output.contains("a22082")) + else { - RASPBERRYPI_TYPE_SETTINGS = "3B"; + piType = "Unknown"; } qDebug() << "RASPBERRYPI_TYPE_SETTINGS: " << RASPBERRYPI_TYPE_SETTINGS; From 0277aad45c8db33563361e165cb038dcb82f43d2 Mon Sep 17 00:00:00 2001 From: Erin Date: Mon, 11 Nov 2024 15:37:21 -0600 Subject: [PATCH 09/17] Edit variable --- src/NetworkSettingsWidget.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/NetworkSettingsWidget.cpp b/src/NetworkSettingsWidget.cpp index 02bca007..6ee98827 100644 --- a/src/NetworkSettingsWidget.cpp +++ b/src/NetworkSettingsWidget.cpp @@ -158,15 +158,15 @@ QString NetworkSettingsWidget::getRaspberryPiType() qDebug() << "Revision code output: " << output; if (output.trimmed() == "a020d3" || output.trimmed() == "a020d4") { - piType = "3B+"; + RASPBERRYPI_TYPE_SETTINGS = "3B+"; } else if (output.trimmed() == "a02082" || output.trimmed() == "a22082" || output.trimmed() == "a32082" || output.trimmed() == "a52082" || output.trimmed() == "a22083") { - piType = "3B"; + RASPBERRYPI_TYPE_SETTINGS = "3B"; } else { - piType = "Unknown"; + RASPBERRYPI_TYPE_SETTINGS = "Unknown"; } qDebug() << "RASPBERRYPI_TYPE_SETTINGS: " << RASPBERRYPI_TYPE_SETTINGS; From 810136e2c69843c53b304cc5b56e67c3eb67f7d4 Mon Sep 17 00:00:00 2001 From: Erin Date: Fri, 15 Nov 2024 11:12:35 -0600 Subject: [PATCH 10/17] Temp file path for USB update file **will update to change .zip path** --- src/WombatUpdateWidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WombatUpdateWidget.cpp b/src/WombatUpdateWidget.cpp index d4b7ff07..e85387dc 100644 --- a/src/WombatUpdateWidget.cpp +++ b/src/WombatUpdateWidget.cpp @@ -68,7 +68,7 @@ void WombatUpdateWidget::update() m_updateProc->setWorkingDirectory("/home/kipr"); ui->updateConsole->setProcess(m_updateProc); connect(m_updateProc, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(updateFinished(int, QProcess::ExitStatus))); - m_updateProc->start("sh", QStringList() << "-c" << "/home/kipr/updateMe.sh /media/kipr/*/*"); + m_updateProc->start("sh", QStringList() << "-c" << "/home/kipr/updateMe.sh /media/kipr/*/wombat-os-31Update.zip"); // Update script will reboot the controller } From 1447471af3e07d94d496fb9adf688c4e50b42ba3 Mon Sep 17 00:00:00 2001 From: Erin Date: Fri, 15 Nov 2024 11:56:56 -0600 Subject: [PATCH 11/17] Added getRaspberryPiType() to NetworkManager --- include/botui/NetworkManager.h | 1 + src/NetworkManager.cpp | 30 +++++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) 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); From 8c0c1eb7139b2576a6bcd5786bfca1f360ce8177 Mon Sep 17 00:00:00 2001 From: Erin Date: Fri, 15 Nov 2024 13:24:31 -0600 Subject: [PATCH 12/17] Try to recreate AP config if missing "band" or "channel" --- src/NetworkManager.cpp | 81 ++++++++++++++++++++++++++---------------- 1 file changed, 51 insertions(+), 30 deletions(-) diff --git a/src/NetworkManager.cpp b/src/NetworkManager.cpp index 55a73dbe..9407fa2f 100644 --- a/src/NetworkManager.cpp +++ b/src/NetworkManager.cpp @@ -46,12 +46,13 @@ QDBusObjectPath AP_PATH; Connection DEFAULT_AP; QString RASPBERRYPI_TYPE; -#ifdef WOMBAT - #define WIFI_DEVICE "wlan0" // always wlan0 for raspberry pi - #else - #define WIFI_DEVICE "wlo1" // wlo1 for dev machine - #endif +// #ifdef WOMBAT +// #define WIFI_DEVICE "wlan0" // always wlan0 for raspberry pi +// #else +// #define WIFI_DEVICE "wlo1" // wlo1 for dev machine +// #endif +#define WIFI_DEVICE "wlo1" // wlo1 for dev machine #define AP_NAME m_dev->serial() + "-wombat" #define AP_SSID (AP_NAME).toUtf8() @@ -275,8 +276,6 @@ void NetworkManager::changeWifiBands(QString band, int channel) qDebug() << "Correct connection ssid " << connectionSettings[NM_802_11_WIRELESS_KEY]["ssid"].toString(); QPair correctConnectionPair = getConnection(connectionSettings[NM_802_11_WIRELESS_KEY]["ssid"].toString()); - - QDBusPendingReply reply = m_nm->ActivateConnection(correctConnectionPair.second, devicePath, QDBusObjectPath("/")); reply.waitForFinished(); getReply(reply); @@ -325,6 +324,29 @@ bool NetworkManager::enableAP() qDebug() << "AP Path: " << apPath.path(); qDebug() << "AP Path Connection already exists"; qDebug() << "AP Strength: " << active().strength(); + OrgFreedesktopNetworkManagerSettingsConnectionInterface connection(NM_SERVICE, apPath.path(), QDBusConnection::systemBus()); + + Connection settings = connection.GetSettings().value(); + + bool containsBand = settings.contains("band"); + bool containsChannel = settings.contains("channel"); + + // Check if the settings contain "band" and "channel" + if (!containsBand || !containsChannel) + { + qDebug() << "Missing 'band' or 'channel' in AP settings. Recreating AP configuration."; + + //Delete previous AP Configuration + qDebug() << "Deleting the previous AP connection: " << apPath.path(); + connection.Delete(); + // Recreate AP configuration + createAPConfig(); + sleep(3); + apPath = getAPSettingsObjectPath(); + qDebug() << "New apPath" << apPath.path(); + m_nm->ActivateConnection(apPath, devicePath, QDBusObjectPath("/")); + return true; + } if (NetworkManager::ref().isActiveConnectionOn() == true) { @@ -684,30 +706,29 @@ NetworkManager::NetworkManager() 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; + 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) From 3fc03a5089d53d9dc9c9a1b6733cc606153c64a1 Mon Sep 17 00:00:00 2001 From: Erin Date: Fri, 15 Nov 2024 14:30:59 -0600 Subject: [PATCH 13/17] Adding band/channel if the AP config doesn't already have one --- src/NetworkManager.cpp | 43 ++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/src/NetworkManager.cpp b/src/NetworkManager.cpp index 9407fa2f..582dd94d 100644 --- a/src/NetworkManager.cpp +++ b/src/NetworkManager.cpp @@ -46,13 +46,12 @@ QDBusObjectPath AP_PATH; Connection DEFAULT_AP; QString RASPBERRYPI_TYPE; -// #ifdef WOMBAT -// #define WIFI_DEVICE "wlan0" // always wlan0 for raspberry pi -// #else -// #define WIFI_DEVICE "wlo1" // wlo1 for dev machine -// #endif - +#ifdef WOMBAT +#define WIFI_DEVICE "wlan0" // always wlan0 for raspberry pi +#else #define WIFI_DEVICE "wlo1" // wlo1 for dev machine +#endif + #define AP_NAME m_dev->serial() + "-wombat" #define AP_SSID (AP_NAME).toUtf8() @@ -336,15 +335,31 @@ bool NetworkManager::enableAP() { qDebug() << "Missing 'band' or 'channel' in AP settings. Recreating AP configuration."; - //Delete previous AP Configuration - qDebug() << "Deleting the previous AP connection: " << apPath.path(); - connection.Delete(); - // Recreate AP configuration - createAPConfig(); - sleep(3); - apPath = getAPSettingsObjectPath(); - qDebug() << "New apPath" << apPath.path(); + if (RASPBERRYPI_TYPE == "3B+") + { + settings[NM_802_11_WIRELESS_KEY]["band"] = "a"; + settings[NM_802_11_WIRELESS_KEY]["channel"] = 36; + } + else if (RASPBERRYPI_TYPE == "3B") + { + settings[NM_802_11_WIRELESS_KEY]["band"] = "bg"; + settings[NM_802_11_WIRELESS_KEY]["channel"] = 1; + } + + qDebug() << "Modified AP settings: band and channel added."; + + QDBusPendingReply reply = connection.Update(settings); + reply.waitForFinished(); + + if (reply.isError()) + { + qWarning() << "Error in Update:" << reply.error().message(); + return false; + } + m_nm->ActivateConnection(apPath, devicePath, QDBusObjectPath("/")); + + qDebug() << "AP settings updated and connection activated."; return true; } From f48a2bcdc6496983494d517b26f69eabcdb3b432 Mon Sep 17 00:00:00 2001 From: Erin Date: Mon, 18 Nov 2024 15:10:29 -0600 Subject: [PATCH 14/17] Added disabled image for 2.4/5 GHz toggle switch for visibility --- rc/qml.qrc | 1 + rc/qml/disabled.png | Bin 0 -> 1737 bytes ui/AboutWidget.ui | 3 +++ ui/NetworkSettingsWidget.ui | 11 ++++++++++- 4 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 rc/qml/disabled.png diff --git a/rc/qml.qrc b/rc/qml.qrc index 4e86dfa9..d3b2d9cc 100644 --- a/rc/qml.qrc +++ b/rc/qml.qrc @@ -3,6 +3,7 @@ qml/loading.qml qml/lock.qml qml/50-screenlock.png + qml/disabled.png qml/left.png qml/right.png qml/Event_Mode_Background.png diff --git a/rc/qml/disabled.png b/rc/qml/disabled.png new file mode 100644 index 0000000000000000000000000000000000000000..18b9678603667a68c1f604e9622be7da46d9c908 GIT binary patch literal 1737 zcmV;)1~&PLP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGf5dZ)S5dnW>Uy%R+21H3jK~!i%?V4Xq zQ&$|v4_6SZGioHACOq&*W&By_gW+F>P%@N69>AcC5i>y3m?aI2pbxx&iGitwfP|Mt zg}uxuC=iuYZGa-wstJLBjLa#0z?l$%8B>a)vhzJVWdiN(t%H^}eqMUc@AkI2-+RvQ z{Lb(Ee8?v3IO#Ki9H+qauSLPAX34^KyKZ-MY_7Wm|ZTHzc_jFWZB`vhntu|1W}~-jo7wr8##CG9EpmGTJyp<;=_jz+WO8zngoTCuUSD7TeROp6 z0RPG|>qP?8 z!Lw(@Gh-HEHt|afEE-W*)l@1~t5qaV_eIVE-<6Y-!$uZ;eq};JLN~wkpHS1&(_7-> z` zWMyTMf`Wp&Q>RW9!^VUf8ygFztJ)YYmX(#kBnq70rAwE1&pGn)@_5U&K&TBHHb@ri z*s)_|aBz_5^?Dl2hnU!1^yb=;kr4%T;tr==e}6x@apMN>IS)qR&Ye36U5>fMHO$Y? zvyly?EKoFZC(y%(LdDWDRj?&dDwPg@03sQUM&A2$T3cJm%*+h$xt2F?-bngy_|}-1 z7z~Q<&=;`MVc&*0LJa))N{D0yV!4aCxj9K<6%`c`Y}>Fy5ojo{fDv00F`AkjZik$P z4r$(UJrE0fKrtdBBG~8c+qW}?-rnACv5yn;O<49<1FSCY#A31VmTlmQ;QZmg1*+;7 zK|w+Ml5GqI18=Q7?i^K!nclyD&wI9^8)Y&vF%cxtB`{{so;}>W9E1X^iMvOYqv^-- zW%Ergm$RNNo;-QNTi%JI5oN{UKE>OGf>W1*L!mzNFQ0{y$Y-G>;!vnvyLR!GcjE8w z&s*XMbVqF-9UbM}%Wwtad6mAt8ac+=G;~3l(!#pfQxm zQP8)VIi%3gP~LJq5Xq5H$Vr8Tg^dc4k&y#P--<=3QZt^;;_lIeM4lMdT}f0_)PS&m z|9*C?+}GE~jP_8eRJ^rvxN|f~$#y4ris( zE$&JQ1BfIgf1jS74j=ve(W6H}%;o3i=Kg{snpdx0u`k$zipdTM{x9wn3C|!!B=~K( zq~phrYtUyS3P)9OadFSX!^344E?j^~6r?BW>+7A)dm}lB!VY(U)Gh?_@mV-{5(T4) z&LFeVXbi%U)xurX)zuYsb#>($jfP0AGr$7S($Yevrlz>XHuNR1{IffNFj7K*k3l^` zRaF&A3w}C!^k^+?i{w=*l_PWte%0OG?ei%Imsll`ya%384rB{FLsC)_q4DLgPN(~t zn->d(B>KUF2m9vc=48FSy{jHSWn^Tm zdUkUyVHJt`UCXs=*S=X=!nka1pj;27FJ`mZLT{XRcdFJE;7}INN=2HX{wdK`L7Ckp z0Mjr(KfhyQVqymlM=L8Uy>2REF+vFeN)_n{`lF$tA;(_To#-a0rWHjN;EXkN?4-M=r)S|nAv-(!SG8JQvD6>gLXuEcAXsN-XQp1SPow*wWQ)bJkzeu% zkb9#sogU@WX=!O~Vk2lNP6=g;`}gmAL_z+?)pO26$Up1=f_)C$P*eZ_01jnXNoGw= f04e|g00;m8000000Mb*F00000NkvXXu0mjfy}edg literal 0 HcmV?d00001 diff --git a/ui/AboutWidget.ui b/ui/AboutWidget.ui index bf326af3..54aed17c 100644 --- a/ui/AboutWidget.ui +++ b/ui/AboutWidget.ui @@ -392,6 +392,9 @@ + + true + 0 diff --git a/ui/NetworkSettingsWidget.ui b/ui/NetworkSettingsWidget.ui index f149fe27..1ac02cf6 100644 --- a/ui/NetworkSettingsWidget.ui +++ b/ui/NetworkSettingsWidget.ui @@ -97,7 +97,16 @@ QCheckBox::indicator:checked{ QCheckBox::indicator:unchecked{ image:url("://qml/left.png"); -} +} + +QCheckBox::indicator:disabled:checked { + image: url("://qml/disabled.png"); +} + +QCheckBox::indicator:disabled:unchecked { + image: url("://qml/disabled.png"); +} + From 9264c79b3af4d65f852a723e5ed1d5a912ecb1c9 Mon Sep 17 00:00:00 2001 From: Erin Date: Mon, 18 Nov 2024 15:18:53 -0600 Subject: [PATCH 15/17] Grey out 2.4 GHz and 5 GHz labels if Wombat contains Raspberry Pi 3B --- src/NetworkSettingsWidget.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/NetworkSettingsWidget.cpp b/src/NetworkSettingsWidget.cpp index 6ee98827..26c23353 100644 --- a/src/NetworkSettingsWidget.cpp +++ b/src/NetworkSettingsWidget.cpp @@ -101,7 +101,8 @@ void NetworkSettingsWidget::eventModeDisabledState() if (RASPBERRYPI_TYPE_SETTINGS == "3B+") // if RaspberryPi is 3B+ { - + ui->TwoFourGHZLabel->setEnabled(true); // Enable 2.4GHz label + ui->FiveGHZLabel->setEnabled(true); // Enable 5GHz label if (INITIAL_CONNECTION_CONFIG.contains("band=a")) // If currently on 5GHz band { ui->toggleSwitch->setChecked(true); // 5GHz toggle side @@ -118,6 +119,8 @@ void NetworkSettingsWidget::eventModeDisabledState() { ui->toggleSwitch->setChecked(false); // 2.4GHz toggle side ui->toggleSwitch->setEnabled(false); // If 3B, can only use 2.4GHz + ui->TwoFourGHZLabel->setEnabled(false); //Grey out 2.4GHz label + ui->FiveGHZLabel->setEnabled(false); //Grey out 5GHz label } ui->connectionModeSelect->clear(); From a355f3b9aa64e354fa646c38b7f16564d9eeac29 Mon Sep 17 00:00:00 2001 From: Erin Date: Tue, 19 Nov 2024 13:37:36 -0600 Subject: [PATCH 16/17] Better checking if AP configuration has band/channel --- src/NetworkManager.cpp | 76 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 67 insertions(+), 9 deletions(-) diff --git a/src/NetworkManager.cpp b/src/NetworkManager.cpp index 582dd94d..cd694f37 100644 --- a/src/NetworkManager.cpp +++ b/src/NetworkManager.cpp @@ -47,10 +47,10 @@ QDBusObjectPath AP_PATH; Connection DEFAULT_AP; QString RASPBERRYPI_TYPE; #ifdef WOMBAT -#define WIFI_DEVICE "wlan0" // always wlan0 for raspberry pi -#else -#define WIFI_DEVICE "wlo1" // wlo1 for dev machine -#endif + #define WIFI_DEVICE "wlan0" // always wlan0 for raspberry pi + #else + #define WIFI_DEVICE "wlo1" // wlo1 for dev machine + #endif #define AP_NAME m_dev->serial() + "-wombat" @@ -323,18 +323,44 @@ bool NetworkManager::enableAP() qDebug() << "AP Path: " << apPath.path(); qDebug() << "AP Path Connection already exists"; qDebug() << "AP Strength: " << active().strength(); + qDebug() << "State: " << m_device->state(); OrgFreedesktopNetworkManagerSettingsConnectionInterface connection(NM_SERVICE, apPath.path(), QDBusConnection::systemBus()); Connection settings = connection.GetSettings().value(); + QMap wirelessSettings = settings.value("802-11-wireless"); - bool containsBand = settings.contains("band"); - bool containsChannel = settings.contains("channel"); + qDebug() << "Settings before anything: " << settings; + bool containsBand = wirelessSettings.contains("band"); + bool containsChannel = wirelessSettings.contains("channel"); + + qDebug() << "AP settings: " << settings; + qDebug() << "Contains band? : " << containsBand; + qDebug() << "Contains channel? : " << containsChannel; // Check if the settings contain "band" and "channel" if (!containsBand || !containsChannel) { qDebug() << "Missing 'band' or 'channel' in AP settings. Recreating AP configuration."; + bool activeConnectionOn = NetworkManager::ref().isActiveConnectionOn(); + + if (activeConnectionOn == true) + { + qDebug() << "Current active connection: " << m_device->activeConnection().path(); + QDBusPendingReply deactivateReply = m_nm->DeactivateConnection(m_device->activeConnection()); + deactivateReply.waitForFinished(); + + if (deactivateReply.isError()) + { + qWarning() << "Error deactivating connection:" << deactivateReply.error().message(); + return false; // Handle the error appropriately + } + else + { + qDebug() << "Connection deactivated successfully."; + } + } + if (RASPBERRYPI_TYPE == "3B+") { settings[NM_802_11_WIRELESS_KEY]["band"] = "a"; @@ -356,10 +382,41 @@ bool NetworkManager::enableAP() qWarning() << "Error in Update:" << reply.error().message(); return false; } - - m_nm->ActivateConnection(apPath, devicePath, QDBusObjectPath("/")); - qDebug() << "AP settings updated and connection activated."; + if (reply.isValid()) + { + qDebug() << "AP settings updated successfully."; + qDebug() << "Connection after update: " << connection.GetSettings().value(); + } + + QDBusPendingReply activateReply = m_nm->ActivateConnection(apPath, devicePath, QDBusObjectPath("/")); + activateReply.waitForFinished(); + + if (activateReply.isError()) + { + qWarning() << "Error activating connection:" << activateReply.error().message(); + return false; // Handle the error appropriately + } + else + { + qDebug() << "Connection activated successfully."; + } + + qDebug() << "Device is now active. Proceeding to reapply settings."; + + QDBusPendingReply reapplyReply = m_device->Reapply(settings, 0, 0); + reapplyReply.waitForFinished(); + + if (reapplyReply.isError()) + { + qWarning() << "Error in Reapply:" << reapplyReply.error().message(); + return false; + } + else + { + qDebug() << "Reapply successful."; + } + return true; } @@ -369,6 +426,7 @@ bool NetworkManager::enableAP() } else if (NetworkManager::ref().isActiveConnectionOn() == false) { + turnOn(); uint stateReply; while (true) From 5abb681528640c2aed0048756f98a1af332e527d Mon Sep 17 00:00:00 2001 From: Erin Date: Tue, 19 Nov 2024 15:07:31 -0600 Subject: [PATCH 17/17] Updating wombat update process --- src/WombatUpdateWidget.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/WombatUpdateWidget.cpp b/src/WombatUpdateWidget.cpp index e85387dc..37a1948a 100644 --- a/src/WombatUpdateWidget.cpp +++ b/src/WombatUpdateWidget.cpp @@ -55,6 +55,10 @@ void WombatUpdateWidget::update() { QMessageBox::warning(this, "File Not Found", "The selected folder is not a .zip folder"); } + else if (!selectedName.contains("wombat-os", Qt::CaseInsensitive)) + { + QMessageBox::warning(this, "File Not Found", "The selected folder is not a valid update file (missing wombat-os)"); + } else { // Change UI to show output @@ -68,7 +72,9 @@ void WombatUpdateWidget::update() m_updateProc->setWorkingDirectory("/home/kipr"); ui->updateConsole->setProcess(m_updateProc); connect(m_updateProc, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(updateFinished(int, QProcess::ExitStatus))); - m_updateProc->start("sh", QStringList() << "-c" << "/home/kipr/updateMe.sh /media/kipr/*/wombat-os-31Update.zip"); + QString command = QString("/home/kipr/updateMe.sh %1").arg("/media/kipr/*/" + selectedName); + + m_updateProc->start("sh", QStringList() << "-c" << command); // Update script will reboot the controller }