Skip to content

Commit

Permalink
luci-wireless: add 11be support
Browse files Browse the repository at this point in the history
Add 11be support

Tested with banana rpi-4

Signed-off-by: Rudy Andram <[email protected]>
  • Loading branch information
rmandrad committed Sep 22, 2024
1 parent c360e37 commit a1db4a0
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 13 deletions.
7 changes: 6 additions & 1 deletion modules/luci-base/htdocs/luci-static/resources/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -3374,7 +3374,7 @@ WifiDevice = baseclass.extend(/** @lends LuCI.network.WifiDevice.prototype */ {
*/
getHWModes: function() {
var hwmodes = this.ubus('dev', 'iwinfo', 'hwmodes');
return Array.isArray(hwmodes) ? hwmodes : [ 'b', 'g' ];
return Array.isArray(hwmodes) ? hwmodes : [ 'b', 'g', 'n', 'ac', 'ax', 'be' ];
},

/**
Expand All @@ -3396,6 +3396,11 @@ WifiDevice = baseclass.extend(/** @lends LuCI.network.WifiDevice.prototype */ {
* - `HE40` - applicable to IEEE 802.11ax, 40 MHz wide channels
* - `HE80` - applicable to IEEE 802.11ax, 80 MHz wide channels
* - `HE160` - applicable to IEEE 802.11ax, 160 MHz wide channels
* - `EHT20` - applicable to IEEE 802.11be, 20 MHz wide channels
* - `EHT40` - applicable to IEEE 802.11be, 40 MHz wide channels
* - `EHT80` - applicable to IEEE 802.11be, 80 MHz wide channels
* - `EHT160` - applicable to IEEE 802.11be, 160 MHz wide channels
* - `EHT320` - applicable to IEEE 802.11be, 320 MHz wide channels
*/
getHTModes: function() {
var htmodes = this.ubus('dev', 'iwinfo', 'htmodes');
Expand Down
2 changes: 1 addition & 1 deletion modules/luci-base/root/usr/share/rpcd/ucode/luci
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ const methods = {
relayd: access('/usr/sbin/relayd') == true,
};

const wifi_features = [ 'eap', '11ac', '11ax', '11r', 'acs', 'sae', 'owe', 'suiteb192', 'wep', 'wps', 'ocv' ];
const wifi_features = [ 'eap', '11ac', '11ax', '11be', '11r', 'acs', 'sae', 'owe', 'suiteb192', 'wep', 'wps', 'ocv' ];

if (access('/usr/sbin/hostapd')) {
result.hostapd = { cli: access('/usr/sbin/hostapd_cli') == true };
Expand Down
31 changes: 28 additions & 3 deletions modules/luci-compat/luasrc/view/cbi/wireless_modefreq.htm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
var modes = [
'', 'Legacy', true,
'n', 'N', hwmodes.n,
'ac', 'AC', hwmodes.ac
'ac', 'AC', hwmodes.ac,
'ax', 'AX', hwmodes.ax,
'be', 'BE', hwmodes.be
];

var htmodes = {
Expand All @@ -45,6 +47,19 @@
'VHT40', '40 MHz', htmodes.VHT40,
'VHT80', '80 MHz', htmodes.VHT80,
'VHT160', '160 MHz', htmodes.VHT160
],
'ax': [
'HE20', '20 MHz', htmodes.HE20,
'HE40', '40 MHz', htmodes.HE40,
'HE80', '80 MHz', htmodes.HE80,
'HE160', '160 MHz', htmodes.HE160
],
'be': [
'EHT20', '20 MHz', htmodes.EHT20,
'EHT40', '40 MHz', htmodes.EHT40,
'EHT80', '80 MHz', htmodes.EHT80,
'EHT160', '160 MHz', htmodes.EHT160,
'EHT320', '320 MHz', htmodes.EHT320
]
};

Expand All @@ -59,6 +74,12 @@
],
'ac': [
'11a', '5 GHz', true
],
'ax': [
'11a', '5 GHz', true
],
'be': [
'11a', '6 GHz', true
]
};

Expand Down Expand Up @@ -128,8 +149,12 @@
var bwdt = document.getElementById(id + '.htmode');

cbi_set_values(mode, modes);

if (/VHT20|VHT40|VHT80|VHT160/.test(<%= luci.http.write_json(self.map:get(section, "htmode")) %>))

if (/EHT20|EHT40|HE80|EHT160|EHT320/.test(<%= luci.http.write_json(self.map:get(section, "htmode")) %>))
mode.value = 'be';
else if (/HE20|HE40|HE80|HE160/.test(<%= luci.http.write_json(self.map:get(section, "htmode")) %>))
mode.value = 'ax';
else if (/VHT20|VHT40|VHT80|VHT160/.test(<%= luci.http.write_json(self.map:get(section, "htmode")) %>))
mode.value = 'ac';
else if (/HT20|HT40/.test(<%= luci.http.write_json(self.map:get(section, "htmode")) %>))
mode.value = 'n';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,8 @@ var CBIWifiFrequencyValue = form.Value.extend({
'', '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
];

var htmodelist = L.toArray(data[0] ? data[0].getHTModes() : null)
Expand All @@ -361,13 +362,21 @@ 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
]
};

this.bands = {
'': [
'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,
'60g', '60 GHz', this.channels['60g'].length > 0
],
'n': [
Expand All @@ -381,7 +390,10 @@ 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': [
'6g', '6 GHz', this.channels['6g'].length > 3,
],
};
}, this));
},
Expand Down Expand Up @@ -445,7 +457,9 @@ var CBIWifiFrequencyValue = form.Value.extend({

this.setValues(mode, this.modes);

if (/HE20|HE40|HE80|HE160/.test(htval))
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';
Expand All @@ -459,10 +473,12 @@ var CBIWifiFrequencyValue = form.Value.extend({
if (hwval != null) {
this.useBandOption = false;

if (/a/.test(hwval))
band.value = '5g';
else
band.value = '2g';
if (mode.value = 'be')
band.value = '6g';
else if (/a/.test(hwval))
band.value = '5g';
else
band.value = '2g';
}
else {
this.useBandOption = true;
Expand Down

0 comments on commit a1db4a0

Please sign in to comment.