From b0e9c1a76a24b27b22d8ed4e6f8ff78dfc80ca1c Mon Sep 17 00:00:00 2001 From: ShaneSmiskol Date: Wed, 28 Jul 2021 16:52:57 -0700 Subject: [PATCH] temporarily change home-only --- launch_chffrplus.sh | 1 - selfdrive/common/params.cc | 1 + selfdrive/ui/qt/offroad/networking.cc | 5 ++++- selfdrive/ui/qt/offroad/networking.h | 1 + selfdrive/ui/qt/offroad/wifiManager.cc | 14 +------------- selfdrive/ui/qt/offroad/wifiManager.h | 1 - 6 files changed, 7 insertions(+), 16 deletions(-) diff --git a/launch_chffrplus.sh b/launch_chffrplus.sh index 5be462f551..40cbe23874 100755 --- a/launch_chffrplus.sh +++ b/launch_chffrplus.sh @@ -100,7 +100,6 @@ function tici_init { sudo su -c 'echo "performance" > /sys/class/devfreq/soc:qcom,memlat-cpu0/governor' sudo su -c 'echo "performance" > /sys/class/devfreq/soc:qcom,memlat-cpu4/governor' - nmcli connection modify --temporary lte gsm.auto-config yes # set success flag for current boot slot sudo abctl --set_success diff --git a/selfdrive/common/params.cc b/selfdrive/common/params.cc index 6a2a89038e..a1e86c7183 100644 --- a/selfdrive/common/params.cc +++ b/selfdrive/common/params.cc @@ -174,6 +174,7 @@ std::unordered_map keys = { {"GitRemote", PERSISTENT}, {"GithubSshKeys", PERSISTENT}, {"GithubUsername", PERSISTENT}, + {"GsmRoaming", PERSISTENT}, {"HardwareSerial", PERSISTENT}, {"HasAcceptedTerms", PERSISTENT}, {"IsDriverViewEnabled", CLEAR_ON_MANAGER_START}, diff --git a/selfdrive/ui/qt/offroad/networking.cc b/selfdrive/ui/qt/offroad/networking.cc index 0509173c9a..25f99d799a 100644 --- a/selfdrive/ui/qt/offroad/networking.cc +++ b/selfdrive/ui/qt/offroad/networking.cc @@ -154,8 +154,11 @@ AdvancedNetworking::AdvancedNetworking(QWidget* parent, WifiManager* wifi): QWid main_layout->addWidget(horizontal_line(), 0); // Roaming toggle - ToggleControl *roamingToggle = new ToggleControl("Enable Roaming", "", "", wifi->isRoamingEnabled()); + const bool roamingEnabled = params.getBool("GsmRoaming"); + wifi->setRoamingEnabled(roamingEnabled); + ToggleControl *roamingToggle = new ToggleControl("Enable Roaming", "", "", roamingEnabled); QObject::connect(roamingToggle, &SshToggle::toggleFlipped, [=](bool state) { + params.putBool("GsmRoaming", state); wifi->setRoamingEnabled(state); }); main_layout->addWidget(roamingToggle); diff --git a/selfdrive/ui/qt/offroad/networking.h b/selfdrive/ui/qt/offroad/networking.h index 02fd2d372f..d6c2aafed7 100644 --- a/selfdrive/ui/qt/offroad/networking.h +++ b/selfdrive/ui/qt/offroad/networking.h @@ -38,6 +38,7 @@ public: private: LabelControl* ipLabel; WifiManager* wifi = nullptr; + Params params; signals: void backPress(); diff --git a/selfdrive/ui/qt/offroad/wifiManager.cc b/selfdrive/ui/qt/offroad/wifiManager.cc index 29a59f8b9c..a7838be421 100644 --- a/selfdrive/ui/qt/offroad/wifiManager.cc +++ b/selfdrive/ui/qt/offroad/wifiManager.cc @@ -431,23 +431,11 @@ void WifiManager::setRoamingEnabled(bool roaming) { Connection settings = QDBusReply(nm.call("GetSettings")).value(); if (settings.value("gsm").value("home-only").toBool() == roaming) { settings["gsm"]["home-only"] = !roaming; - nm.call("Update", QVariant::fromValue(settings)); + nm.call("UpdateUnsaved", QVariant::fromValue(settings)); // resets on reboot } } } -bool WifiManager::isRoamingEnabled() { - const QDBusObjectPath &path = getConnectionPath("lte"); - if (!path.path().isEmpty()) { - QDBusInterface nm(NM_DBUS_SERVICE, path.path(), NM_DBUS_INTERFACE_SETTINGS_CONNECTION, bus); - nm.setTimeout(DBUS_TIMEOUT); - - const Connection &settings = QDBusReply(nm.call("GetSettings")).value(); - return !settings.value("gsm").value("home-only").toBool(); - } - return false; -} - // Functions for tethering void WifiManager::addTetheringConnection() { Connection connection; diff --git a/selfdrive/ui/qt/offroad/wifiManager.h b/selfdrive/ui/qt/offroad/wifiManager.h index 0b5526967f..9c5bd6ceef 100644 --- a/selfdrive/ui/qt/offroad/wifiManager.h +++ b/selfdrive/ui/qt/offroad/wifiManager.h @@ -50,7 +50,6 @@ public: void activateWifiConnection(const QString &ssid); NetworkType currentNetworkType(); void setRoamingEnabled(bool roaming); - bool isRoamingEnabled(); void connect(const Network &ssid); void connect(const Network &ssid, const QString &password);