Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions renderer/wifi/iface.uc
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,24 @@ 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;
w.mode = iftypes[wif.iftype];
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;
Expand Down
23 changes: 17 additions & 6 deletions system/state/wifi.uc
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down