From c1b85c086c00943e639a3b8628969bf0eddafcf9 Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Thu, 4 Jun 2026 19:07:55 +0800 Subject: [PATCH] ucentral-schema: fix radio 2.4G/5G shows empty when HaLow radio exists Fixes: WIFI-15504 Signed-off-by: Ian Chen --- renderer/wifi/iface.uc | 16 ++++++++++------ system/state/wifi.uc | 23 +++++++++++++++++------ 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/renderer/wifi/iface.uc b/renderer/wifi/iface.uc index f96e1da..761306a 100644 --- a/renderer/wifi/iface.uc +++ b/renderer/wifi/iface.uc @@ -60,8 +60,10 @@ function lookup_wifs() { let rv = {}; for (let wif in wifs) { let wif_obj = wif.mlo_links?.[0] || wif; - if (!wif_obj.wiphy_freq || !iftypes[wif.iftype]) + if (!iftypes[wif.iftype]) continue; + + // Allow interfaces with wiphy_freq=0 (e.g. NOHT/channel unknown state) let w = {}; w.ssid = wif.ssid; w.bssid = wif.mac; @@ -69,11 +71,13 @@ function lookup_wifs() { w.channel = []; w.frequency = []; w.tx_power = (wif_obj.wiphy_tx_power_level / 100) || 0; - for (let f in [ wif_obj.wiphy_freq, wif_obj.center_freq1, wif_obj.center_freq2 ]) - if (f) { - push(w.channel, freq2channel(f)); - push(w.frequency, f); - } + if (wif_obj.wiphy_freq) { + for (let f in [ wif_obj.wiphy_freq, wif_obj.center_freq1, wif_obj.center_freq2 ]) + if (f) { + push(w.channel, freq2channel(f)); + push(w.frequency, f); + } + } if (chwidth[wif_obj.channel_width]) w.ch_width = chwidth[wif_obj.channel_width]; rv[wif.ifname] = w; diff --git a/system/state/wifi.uc b/system/state/wifi.uc index 5adb750..4e2d1c7 100644 --- a/system/state/wifi.uc +++ b/system/state/wifi.uc @@ -77,16 +77,27 @@ export function collect_wifi_radios(state) { for (let radio, data in wifistatus) { if (!length(data.interfaces)) continue; - let vap = wifiiface[data.interfaces[0].ifname]; + + // Find first interface with valid frequency, fallback to first available + let vap; + for (let iface in data.interfaces) { + let v = wifiiface[iface.ifname]; + if (length(v) && length(v.frequency)) { + vap = v; + break; + } + } + if (!vap) + vap = wifiiface[data.interfaces[0].ifname]; if (!length(vap)) continue; let radio = {}; - radio.channel = vap.channel[0]; - radio.channels = uniq(vap.channel); - radio.frequency = uniq(vap.frequency); - radio.channel_width = +vap.ch_width; - radio.tx_power = vap.tx_power; + radio.channel = length(vap.channel) ? vap.channel[0] : 0; + radio.channels = uniq(vap.channel || []); + radio.frequency = uniq(vap.frequency || []); + radio.channel_width = +vap.ch_width || 0; + radio.tx_power = vap.tx_power || 0; let path = data.config.path; if (exists(data.config, 'radio'))