wifi-scripts: detect and configure EHT
authorJanusz Dziedzic <janusz.dziedzic@gmail.com>
Fri, 20 Sep 2024 17:43:32 +0000 (19:43 +0200)
committerJohn Crispin <john@phrozen.org>
Wed, 2 Oct 2024 13:12:18 +0000 (15:12 +0200)
Check if EHT/11BE supported, configure in board.json
and config/wireless.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
package/network/config/wifi-scripts/files/lib/wifi/mac80211.uc
package/network/config/wifi-scripts/files/usr/share/hostap/wifi-detect.uc

index 8f25a791b38b3bc30a0bec421ea61ad8ea7c0500..b68167b7542649c2a7d0dfde11a56b8494accc89 100644 (file)
@@ -3,7 +3,7 @@ import { readfile } from "fs";
 import * as uci from 'uci';
 
 const bands_order = [ "6G", "5G", "2G" ];
-const htmode_order = [ "HE", "VHT", "HT" ];
+const htmode_order = [ "EHT", "HE", "VHT", "HT" ];
 
 let board = json(readfile("/etc/board.json"));
 if (!board.wlan)
index 6eb6b84c91453381ee8ec4903fddf6f4ff85d12d..468078ad206960e42965edf3ec46b5f6775a1847 100644 (file)
@@ -113,6 +113,7 @@ function wiphy_detect() {
                        if (band.vht_capa > 0)
                                band_info.vht = true;
                        let he_phy_cap = 0;
+                       let eht_phy_cap = 0;
 
                        for (let ift in band.iftype_data) {
                                if (!ift.he_cap_phy)
@@ -120,7 +121,12 @@ function wiphy_detect() {
 
                                band_info.he = true;
                                he_phy_cap |= ift.he_cap_phy[0];
-                               /* TODO: EHT */
+
+                               if (!ift.eht_cap_phy)
+                                       continue;
+
+                               band_info.eht = true;
+                               eht_phy_cap |= ift.eht_cap_phy[0];
                        }
 
                        if (band_name != "2G" &&
@@ -141,14 +147,19 @@ function wiphy_detect() {
                                push(modes, "VHT20");
                        if (band_info.he)
                                push(modes, "HE20");
+                       if (band_info.eht)
+                               push(modes, "EHT20");
                        if (band.ht_capa & 0x2) {
                                push(modes, "HT40");
                                if (band_info.vht)
                                        push(modes, "VHT40")
                        }
-                       if (he_phy_cap & 0x2)
+                       if (he_phy_cap & 2)
                                push(modes, "HE40");
 
+                       if (eht_phy_cap && he_phy_cap & 2)
+                               push(modes, "EHT40");
+
                        for (let freq in band.freqs) {
                                if (freq.disabled)
                                        continue;
@@ -161,14 +172,26 @@ function wiphy_detect() {
 
                        if (band_name == "2G")
                                continue;
+
+                       if (he_phy_cap & 4)
+                               push(modes, "HE40");
+                       if (eht_phy_cap && he_phy_cap & 4)
+                               push(modes, "EHT40");
                        if (band_info.vht)
                                push(modes, "VHT80");
                        if (he_phy_cap & 4)
                                push(modes, "HE80");
+                       if (eht_phy_cap && he_phy_cap & 4)
+                               push(modes, "EHT80");
                        if ((band.vht_capa >> 2) & 0x3)
                                push(modes, "VHT160");
                        if (he_phy_cap & 0x18)
                                push(modes, "HE160");
+                       if (eht_phy_cap && he_phy_cap & 0x18)
+                               push(modes, "EHT160");
+
+                       if (eht_phy_cap & 2)
+                               push(modes, "ETH320");
                }
 
                let entry = wiphy_get_entry(name, path);