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

View File

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