Mark bandwidths invalid on various devices (rather than marking what is valid) (#1639)

* Mark bandwidths invalid on various devices (rather than marking
what is valid)

* Typo
This commit is contained in:
Tim Wilkinson 2024-10-17 12:54:54 -07:00 committed by GitHub
parent 55c1ffed63
commit 1edfae6dae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 39 additions and 33 deletions

View File

@ -68,7 +68,7 @@
},
"gl.inet gl-mt1300": {
"wlan0": {
"bandwidths": [ 20 ],
"exclude_bandwidths": [ 5, 10 ],
"antenna": {
"description": "3 dBi Omni",
"gain": 3,
@ -76,7 +76,7 @@
}
},
"wlan1": {
"bandwidths": [ 20 ],
"exclude_bandwidths": [ 5, 10 ],
"antenna": {
"description": "3 dBi Omni",
"gain": 3,
@ -342,7 +342,7 @@
},
"mikrotik routerboard 921gs-5hpacd-15s": {
"maxpower": 31,
"bandwidths": [ 10, 20, 40, 80 ],
"exclude_bandwidths": [ 5 ],
"antenna": {
"description": "15 dBi 120° Sector",
"gain": 15,
@ -351,7 +351,7 @@
},
"mikrotik routerboard 921gs-5hpacd-19s": {
"maxpower": 31,
"bandwidths": [ 10, 20, 40, 80 ],
"exclude_bandwidths": [ 5 ],
"antenna": {
"description": "19 dBi 120° Sector",
"gain": 19,
@ -369,7 +369,7 @@
},
"wlan1": {
"maxpower": 22,
"bandwidths": [ 10, 20 ],
"exclude_bandwidths": [ 5 ],
"antenna": {
"description": "2 dBi Omni",
"gain": 2,
@ -388,7 +388,7 @@
},
"wlan1": {
"maxpower": 22,
"bandwidths": [ 10, 20 ],
"exclude_bandwidths": [ 5 ],
"antenna": {
"description": "2 dBi Omni",
"gain": 2,
@ -407,7 +407,7 @@
},
"wlan1": {
"maxpower": 22,
"bandwidths": [ 10, 20 ],
"exclude_bandwidths": [ 5 ],
"antenna": {
"description": "2 dBi Omni",
"gain": 2,
@ -449,7 +449,7 @@
},
"mikrotik ldf 5 ac (rbldfg-5acd)": {
"maxpower": 25,
"bandwidths": [ 10, 20, 40, 80 ],
"exclude_bandwidths": [ 5 ],
"antenna": "external"
},
"mikrotik routerboard rbldf-5nd": {
@ -550,7 +550,7 @@
},
"mikrotik lhg 5 ac (rblhgg-5acd)": {
"maxpower": 25,
"bandwidths": [ 10, 20, 40, 80 ],
"exclude_bandwidths": [ 5 ],
"antenna": {
"description": "24.5 dBi 7° Dish",
"gain": 24.5,
@ -559,7 +559,7 @@
},
"mikrotik lhg 5 ac xl (rblhgg-5acd-xl)": {
"maxpower": 25,
"bandwidths": [ 10, 20, 40, 80 ],
"exclude_bandwidths": [ 5 ],
"antenna": {
"description": "27 dBi 7° Dish",
"gain": 27,
@ -640,7 +640,7 @@
},
"mikrotik sxtsq 5 ac (rbsxtsqg-5acd)": {
"maxpower": 25,
"bandwidths": [ 10, 20, 40, 80 ],
"exclude_bandwidths": [ 5 ],
"antenna": {
"description": "16 dBi 23° Panel",
"gain": 16,
@ -658,7 +658,7 @@
},
"wlan1": {
"maxpower": 26,
"bandwidths": [ 10, 20, 40, 80 ],
"exclude_bandwidths": [ 5 ],
"antenna": {
"description": "2.5 dBi Omni",
"gain": 2.5,
@ -677,7 +677,7 @@
},
"wlan1": {
"maxpower": 26,
"bandwidths": [ 10, 20, 40, 80 ],
"exclude_bandwidths": [ 5 ],
"antenna": {
"description": "5.5 dBi Omni",
"gain": 5.5,
@ -982,7 +982,7 @@
"0xe4f2": {
"name": "Ubiquiti NanoBeam 2AC 13 (2WA)",
"wlan0": {
"bandwidths": [ 10, 20 ],
"exclude_bandwidths": [ 5 ],
"maxpower": 21,
"pwroffset": 6,
"antenna": {

View File

@ -195,20 +195,27 @@ export function getRfChannels(wifiIface)
export function getRfBandwidths(wifiIface)
{
const radio = getRadioIntf(wifiIface);
if (radio.bandwidths) {
return radio.bandwidths;
const invalid = {};
map(radio.exclude_bandwidths || [], v => invalid[v] = true);
const bw = [];
if (!invalid["5"]) {
push(bw, 5);
}
if (!invalid["10"]) {
push(bw, 10);
}
if (!invalid["20"]) {
push(bw, 20);
}
else {
const bw = [ 5, 10, 20 ];
if (fs.access(`/sys/kernel/debug/ieee80211/${replace(wifiIface, "wlan", "phy")}/ath10k`)) {
const f = fs.popen(`/usr/bin/iwinfo ${wifiIface} htmodelist 2> /dev/null`);
if (f) {
let line = f.read("line");
if (line) {
if (index(line, "VHT40") !== -1) {
if (index(line, "VHT40") !== -1 && !invalid["40"]) {
push(bw, 40);
}
if (index(line, "VHT80") !== -1) {
if (index(line, "VHT80") !== -1 && !invalid["80"]) {
push(bw, 80);
}
}
@ -219,7 +226,6 @@ export function getRfBandwidths(wifiIface)
}
}
return bw;
}
};
export function getDefaultChannel(wifiIface)