diff --git a/internal/platform/implementation/linux/wifi_hotspot.cc b/internal/platform/implementation/linux/wifi_hotspot.cc index 0cf823f6..970609a1 100644 --- a/internal/platform/implementation/linux/wifi_hotspot.cc +++ b/internal/platform/implementation/linux/wifi_hotspot.cc @@ -147,6 +147,21 @@ bool NetworkManagerWifiHotspotMedium::StartWifiHotspot( return false; } + // TODO: starting 5ghz AP with intel devices fail often bcz of LAR. Find a workaround + // Get device capabilities to select the best available band + // api::WifiCapability& capability = wireless_device_->GetCapability(); + // std::string selected_band; + // if (capability.supports_6_ghz) { + // selected_band = "a"; // 5/6 GHz - NetworkManager uses "a" for both 5 GHz and 6 GHz + // LOG(INFO) << __func__ << ": Device supports 6 GHz, using 5/6 GHz band"; + // } else if (capability.supports_5_ghz) { + // selected_band = "a"; // 5 GHz + // LOG(INFO) << __func__ << ": Device supports 5 GHz, using 5 GHz band"; + // } else { + // selected_band = "bg"; // 2.4 GHz + // LOG(INFO) << __func__ << ": Device supports only 2.4 GHz, using 2.4 GHz band"; + // } + std::map> connection_settings{ { @@ -160,6 +175,7 @@ bool NetworkManagerWifiHotspotMedium::StartWifiHotspot( {{"assigned-mac-address", "random"}, {"ap-isolation", networkmanager::constants::kNMTernaryFalse}, {"mode", "ap"}, + {"band", "bg"}, {"ssid", std::vector(ssid.begin(), ssid.end())}, {"security", "802-11-wireless-security"}}}, {"802-11-wireless-security", @@ -188,7 +204,7 @@ bool NetworkManagerWifiHotspotMedium::StartWifiHotspot( return false; } - auto [reason, timeout] = active_conn->WaitForConnection(); + auto [reason, timeout] = active_conn->WaitForConnection(absl::Seconds(60)); if (timeout) { LOG(ERROR) << __func__ << ": " diff --git a/internal/platform/implementation/linux/wifi_lan.cc b/internal/platform/implementation/linux/wifi_lan.cc index ff2794ce..5004e660 100644 --- a/internal/platform/implementation/linux/wifi_lan.cc +++ b/internal/platform/implementation/linux/wifi_lan.cc @@ -197,6 +197,8 @@ bool WifiLanMedium::StartDiscovery( } } + avahi_->SetDiscoveryCallback(std::move(callback)); + try { sdbus::ObjectPath browser_object_path = avahi_->ServiceBrowserPrepare(-1, // AVAHI_IF_UNSPEC @@ -211,7 +213,7 @@ bool WifiLanMedium::StartDiscovery( service_browsers_.emplace( service_type, std::make_unique( - *system_bus_, browser_object_path, std::move(callback), avahi_)); + *system_bus_, browser_object_path, avahi_)); } catch (const sdbus::Error &e) { DBUS_LOG_METHOD_CALL_ERROR(avahi_, "ServiceBrowserPrepare", e); return false; diff --git a/internal/platform/implementation/linux/wifi_medium.cc b/internal/platform/implementation/linux/wifi_medium.cc index a4d2fb38..79ed65ce 100644 --- a/internal/platform/implementation/linux/wifi_medium.cc +++ b/internal/platform/implementation/linux/wifi_medium.cc @@ -39,7 +39,8 @@ api::WifiCapability &NetworkManagerWifiMedium::GetCapability() { auto cap_mask = WirelessCapabilities(); // https://networkmanager.dev/docs/api/latest/nm-dbus-types.html#NMDeviceWifiCapabilities capability_.supports_5_ghz = (cap_mask & 0x00000400) != 0; - capability_.supports_6_ghz = false; + // Check for 6 GHz support (NM_WIFI_DEVICE_CAP_FREQ_6GHZ = 0x00008000) + capability_.supports_6_ghz = (cap_mask & 0x00008000) != 0; capability_.support_wifi_direct = true; } catch (const sdbus::Error &e) { DBUS_LOG_PROPERTY_GET_ERROR(&getProxy(), "WirelessCapabilities", e);