ui: initialize tethering connection on startup (#34274)

* initialize hotspot connection on init

* better place

* fix
pull/34275/head
Shane Smiskol 4 months ago committed by GitHub
parent 247ee2bda8
commit f149083e4a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 16
      selfdrive/ui/qt/network/wifi_manager.cc

@ -330,6 +330,10 @@ void WifiManager::initConnections() {
lteConnectionPath = path;
}
}
if (!isKnownConnection(tethering_ssid)) {
addTetheringConnection();
}
}
std::optional<QDBusPendingCall> WifiManager::activateWifiConnection(const QString &ssid) {
@ -434,10 +438,7 @@ void WifiManager::addTetheringConnection() {
connection["ipv4"]["route-metric"] = 1100;
connection["ipv6"]["method"] = "ignore";
auto path = call<QDBusObjectPath>(NM_DBUS_PATH_SETTINGS, NM_DBUS_INTERFACE_SETTINGS, "AddConnection", QVariant::fromValue(connection));
if (!path.path().isEmpty()) {
knownConnections[path] = tethering_ssid;
}
asyncCall(NM_DBUS_PATH_SETTINGS, NM_DBUS_INTERFACE_SETTINGS, "AddConnection", QVariant::fromValue(connection));
}
void WifiManager::tetheringActivated(QDBusPendingCallWatcher *call) {
@ -453,10 +454,6 @@ void WifiManager::tetheringActivated(QDBusPendingCallWatcher *call) {
void WifiManager::setTetheringEnabled(bool enabled) {
if (enabled) {
if (!isKnownConnection(tethering_ssid)) {
addTetheringConnection();
}
auto pending_call = activateWifiConnection(tethering_ssid);
if (pending_call) {
@ -478,9 +475,6 @@ bool WifiManager::isTetheringEnabled() {
}
QString WifiManager::getTetheringPassword() {
if (!isKnownConnection(tethering_ssid)) {
addTetheringConnection();
}
const QDBusObjectPath &path = getConnectionPath(tethering_ssid);
if (!path.path().isEmpty()) {
QDBusReply<QMap<QString, QVariantMap>> response = call(path.path(), NM_DBUS_INTERFACE_SETTINGS_CONNECTION, "GetSecrets", "802-11-wireless-security");

Loading…
Cancel
Save