diff options
author | Rudy Andram <rmandrad@gmail.com> | 2024-10-03 09:39:10 +0100 |
---|---|---|
committer | Paul Donald <newtwen+github@gmail.com> | 2024-10-07 19:29:35 +0200 |
commit | 383edb4d6d0f1774ea83f08ac1fea1e1713cd5fe (patch) | |
tree | 54b5cb274b026806557462811143b88565082200 /modules/luci-mod-network/htdocs/luci-static/resources | |
parent | 300961bb1ba7d71b50288b97c0fdeae0c71253e7 (diff) |
luci-wireless: Add 11be support
Tested with filogic banana rpi4 / QNAP qualcommax ipq8074
Signed-off-by: Rudy Andram <rmandrad@gmail.com>
Tested-By: Daniel Pawlik <pawlik.dan@gmail.com>
Diffstat (limited to 'modules/luci-mod-network/htdocs/luci-static/resources')
-rw-r--r-- | modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js | 45 |
1 files changed, 40 insertions, 5 deletions
diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js index cedf1675ff..2cce3ed46d 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js @@ -201,7 +201,9 @@ function format_wifirate(rate) { mhz = rate.mhz, nss = rate.nss, mcs = rate.mcs, sgi = rate.short_gi, he = rate.he, he_gi = rate.he_gi, - he_dcm = rate.he_dcm; + he_dcm = rate.he_dcm, + eht = rate?.eht ?? false, eht_gi = rate?.eht_gi ?? 0, + eht_dcm = rate?.eht_dcm ?? 0; if (ht || vht) { if (vht) s += ', VHT-MCS\xa0%d'.format(mcs); @@ -217,6 +219,13 @@ function format_wifirate(rate) { if (he_dcm) s += ', HE-DCM\xa0%d'.format(he_dcm); } + if (eht) { + s += ', EHT-MCS\xa0%d'.format(mcs); + if (nss) s += ', EHT-NSS\xa0%d'.format(nss); + if (eht_gi) s += ', EHT-GI\xa0%d'.format(eht_gi); + if (eht_dcm) s += ', EHT-DCM\xa0%d'.format(eht_dcm); + } + return s; } @@ -298,7 +307,9 @@ function add_dependency_permutations(o, deps) { o.depends(res[i]); } +// Define a class CBIWifiFrequencyValue that extends form.Value var CBIWifiFrequencyValue = form.Value.extend({ + // Declare an RPC method to get the frequency list for a given device callFrequencyList: rpc.declare({ object: 'iwinfo', method: 'freqlist', @@ -306,6 +317,7 @@ var CBIWifiFrequencyValue = form.Value.extend({ expect: { results: [] } }), + // Load method to fetch WiFi device details and frequency list load: function(section_id) { return Promise.all([ network.getWifiDevice(section_id), @@ -334,13 +346,16 @@ var CBIWifiFrequencyValue = form.Value.extend({ var hwmodelist = L.toArray(data[0] ? data[0].getHWModes() : null) .reduce(function(o, v) { o[v] = true; return o }, {}); + // Define supported modes this.modes = [ '', 'Legacy', hwmodelist.a || hwmodelist.b || hwmodelist.g, 'n', 'N', hwmodelist.n, 'ac', 'AC', L.hasSystemFeature('hostapd', '11ac') && hwmodelist.ac, - 'ax', 'AX', L.hasSystemFeature('hostapd', '11ax') && hwmodelist.ax + 'ax', 'AX', L.hasSystemFeature('hostapd', '11ax') && hwmodelist.ax, + 'be', 'BE', L.hasSystemFeature('hostapd', '11be') && hwmodelist.be ]; + // Create a list of HT modes based on device capabilities var htmodelist = L.toArray(data[0] ? data[0].getHTModes() : null) .reduce(function(o, v) { o[v] = true; return o }, {}); @@ -361,9 +376,18 @@ var CBIWifiFrequencyValue = form.Value.extend({ 'HE40', '40 MHz', htmodelist.HE40, 'HE80', '80 MHz', htmodelist.HE80, 'HE160', '160 MHz', htmodelist.HE160 + ], + 'be': [ + 'EHT20', '20 MHz', htmodelist.EHT20, + 'EHT40', '40 MHz', htmodelist.EHT40, + 'EHT80', '80 MHz', htmodelist.EHT80, + 'EHT160', '160 MHz', htmodelist.EHT160, + 'EHT320', '320 MHz', htmodelist.EHT320 ] }; + // Define available bands for widget selection based on channel availability + // AX and BE are available on 2/5/6G bands this.bands = { '': [ '2g', '2.4 GHz', this.channels['2g'].length > 3, @@ -381,11 +405,17 @@ var CBIWifiFrequencyValue = form.Value.extend({ '2g', '2.4 GHz', this.channels['2g'].length > 3, '5g', '5 GHz', this.channels['5g'].length > 3, '6g', '6 GHz', this.channels['6g'].length > 3 - ] + ], + 'be': [ + '2g', '2.4 GHz', this.channels['2g'].length > 3, + '5g', '5 GHz', this.channels['5g'].length > 3, + '6g', '6 GHz', this.channels['6g'].length > 3 + ], }; }, this)); }, + // Set values in the select element setValues: function(sel, vals) { if (sel.vals) sel.vals.selected = sel.selectedIndex; @@ -445,7 +475,10 @@ var CBIWifiFrequencyValue = form.Value.extend({ this.setValues(mode, this.modes); - if (/HE20|HE40|HE80|HE160/.test(htval)) + // Determine mode based on htmode value + if (/EHT20|EHT40|EHT80|EHT160|EHT320/.test(htval)) + mode.value = 'be'; + else if (/HE20|HE40|HE80|HE160/.test(htval)) mode.value = 'ax'; else if (/VHT20|VHT40|VHT80|VHT160/.test(htval)) mode.value = 'ac'; @@ -459,7 +492,9 @@ var CBIWifiFrequencyValue = form.Value.extend({ if (hwval != null) { this.useBandOption = false; - if (/a/.test(hwval)) + if (/be/.test(mode.value)) + band.value = '6g'; + else if (/ax/.test(mode.value)) band.value = '5g'; else band.value = '2g'; |