Skip to content

Commit

Permalink
Extra logging in WifiManager
Browse files Browse the repository at this point in the history
  • Loading branch information
andiradulescu committed Nov 23, 2023
1 parent 859a90d commit af1bda6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion selfdrive/ui/qt/network/wifi_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ WifiManager::WifiManager(QObject *parent) : QObject(parent) {

adapter = getAdapter();
if (!adapter.isEmpty()) {
qWarning() << "WifiManager setup";
setup();
} else {
qWarning() << "WifiManager DeviceAdded";
QDBusConnection::systemBus().connect(NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE, "DeviceAdded", this, SLOT(deviceAdded(QDBusObjectPath)));
}

Expand All @@ -71,7 +73,7 @@ void WifiManager::setup() {

raw_adapter_state = call<uint>(adapter, NM_DBUS_INTERFACE_PROPERTIES, "Get", NM_DBUS_INTERFACE_DEVICE, "State");
activeAp = call<QDBusObjectPath>(adapter, NM_DBUS_INTERFACE_PROPERTIES, "Get", NM_DBUS_INTERFACE_DEVICE_WIRELESS, "ActiveAccessPoint").path();

qWarning() << "WifiManager::setup";
initConnections();
requestScan();
}
Expand Down Expand Up @@ -204,6 +206,7 @@ void WifiManager::deactivateConnectionBySsid(const QString &ssid) {
}

std::optional<QDBusPendingCall> WifiManager::deactivateConnection(const QDBusObjectPath &path) {
qWarning() << "WifiManager::deactivateConnection";
return asyncCall(NM_DBUS_PATH, NM_DBUS_INTERFACE, "DeactivateConnection", QVariant::fromValue(path));
}

Expand Down Expand Up @@ -284,6 +287,7 @@ void WifiManager::propertyChange(const QString &interface, const QVariantMap &pr
}

void WifiManager::deviceAdded(const QDBusObjectPath &path) {
qWarning() << "WifiManager::deviceAdded";
if (getAdapterType(path) == NM_DEVICE_TYPE_WIFI && emptyPath(adapter)) {
adapter = path.path();
setup();
Expand Down Expand Up @@ -313,6 +317,7 @@ Connection WifiManager::getConnectionSettings(const QDBusObjectPath &path) {
}

void WifiManager::initConnections() {
qWarning() << "WifiManager::initConnections";
const QDBusReply<QList<QDBusObjectPath>> response = call(NM_DBUS_PATH_SETTINGS, NM_DBUS_INTERFACE_SETTINGS, "ListConnections");
for (const QDBusObjectPath &path : response.value()) {
const Connection settings = getConnectionSettings(path);
Expand All @@ -334,8 +339,10 @@ std::optional<QDBusPendingCall> WifiManager::activateWifiConnection(const QStrin
}

void WifiManager::activateModemConnection(const QDBusObjectPath &path) {
qWarning() << "WifiManager::activateModemConnection";
QString modem = getAdapter(NM_DEVICE_TYPE_MODEM);
if (!path.path().isEmpty() && !modem.isEmpty()) {
qWarning() << "WifiManager::activateModemConnection - ActivateConnection";
asyncCall(NM_DBUS_PATH, NM_DBUS_INTERFACE, "ActivateConnection", QVariant::fromValue(path), QVariant::fromValue(QDBusObjectPath(modem)), QVariant::fromValue(QDBusObjectPath("/")));
}
}
Expand All @@ -361,7 +368,9 @@ NetworkType WifiManager::currentNetworkType() {
}

void WifiManager::updateGsmSettings(bool roaming, QString apn, bool metered) {
qWarning() << "WifiManager::updateGsmSettings 1" << roaming << apn << metered;
if (!lteConnectionPath.path().isEmpty()) {
qWarning() << "WifiManager::updateGsmSettings 2" << roaming << apn << metered;
bool changes = false;
bool auto_config = apn.isEmpty();
Connection settings = getConnectionSettings(lteConnectionPath);
Expand Down Expand Up @@ -391,6 +400,7 @@ void WifiManager::updateGsmSettings(bool roaming, QString apn, bool metered) {
}

if (changes) {
qWarning() << "WifiManager::updateGsmSettings UpdateUnsaved" << settings;
call(lteConnectionPath.path(), NM_DBUS_INTERFACE_SETTINGS_CONNECTION, "UpdateUnsaved", QVariant::fromValue(settings)); // update is temporary
auto pending_call = deactivateConnection(lteConnectionPath);

Expand Down

0 comments on commit af1bda6

Please sign in to comment.