Log WiFi RequestScan failures with D-Bus error detail
The RequestScan result and the underlying sd_bus error were silently dropped, so a denied or failed scan looked identical to an empty scan list on the WiFi setup page. Surface both so the deployed-machine diagnosis (e.g. user not in the networkmanager group) is visible in ~/.local/radiantwave/log.txt.
This commit is contained in:
@@ -379,7 +379,11 @@ bool NetworkManager::requestScan() {
|
||||
}
|
||||
|
||||
log("Requesting WiFi scan...");
|
||||
return impl_->device->requestScan();
|
||||
const bool ok = impl_->device->requestScan();
|
||||
if (!ok) {
|
||||
log("RequestScan failed; the network list may stay empty until it succeeds");
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
std::vector<NetworkInfo> NetworkManager::getScanResults() const {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "nm_device.h"
|
||||
#include "nm_connection.h"
|
||||
#include "logger/logger.h"
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
|
||||
@@ -188,6 +189,12 @@ bool WifiDevice::requestScan() {
|
||||
0 // Empty options dict
|
||||
);
|
||||
|
||||
if (r < 0) {
|
||||
radiantwave::logger::Logger::instance().warning("WiFi",
|
||||
"RequestScan failed on device " + impl_->object_path + ": " +
|
||||
(error.message ? error.message : strerror(-r)));
|
||||
}
|
||||
|
||||
sd_bus_error_free(&error);
|
||||
return r >= 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user