wifi-scripts: detect and configure EHT

Check if EHT/11BE supported, configure in board.json
and config/wireless.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
This commit is contained in:
Janusz Dziedzic 2024-09-20 19:43:32 +02:00 committed by John Crispin
parent 7ebd9069f4
commit b478b7b1f7
2 changed files with 26 additions and 3 deletions

View File

@ -3,7 +3,7 @@ import { readfile } from "fs";
import * as uci from 'uci'; import * as uci from 'uci';
const bands_order = [ "6G", "5G", "2G" ]; 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")); let board = json(readfile("/etc/board.json"));
if (!board.wlan) if (!board.wlan)

View File

@ -113,6 +113,7 @@ function wiphy_detect() {
if (band.vht_capa > 0) if (band.vht_capa > 0)
band_info.vht = true; band_info.vht = true;
let he_phy_cap = 0; let he_phy_cap = 0;
let eht_phy_cap = 0;
for (let ift in band.iftype_data) { for (let ift in band.iftype_data) {
if (!ift.he_cap_phy) if (!ift.he_cap_phy)
@ -120,7 +121,12 @@ function wiphy_detect() {
band_info.he = true; band_info.he = true;
he_phy_cap |= ift.he_cap_phy[0]; 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" && if (band_name != "2G" &&
@ -141,14 +147,19 @@ function wiphy_detect() {
push(modes, "VHT20"); push(modes, "VHT20");
if (band_info.he) if (band_info.he)
push(modes, "HE20"); push(modes, "HE20");
if (band_info.eht)
push(modes, "EHT20");
if (band.ht_capa & 0x2) { if (band.ht_capa & 0x2) {
push(modes, "HT40"); push(modes, "HT40");
if (band_info.vht) if (band_info.vht)
push(modes, "VHT40") push(modes, "VHT40")
} }
if (he_phy_cap & 0x2) if (he_phy_cap & 2)
push(modes, "HE40"); push(modes, "HE40");
if (eht_phy_cap && he_phy_cap & 2)
push(modes, "EHT40");
for (let freq in band.freqs) { for (let freq in band.freqs) {
if (freq.disabled) if (freq.disabled)
continue; continue;
@ -161,14 +172,26 @@ function wiphy_detect() {
if (band_name == "2G") if (band_name == "2G")
continue; continue;
if (he_phy_cap & 4)
push(modes, "HE40");
if (eht_phy_cap && he_phy_cap & 4)
push(modes, "EHT40");
if (band_info.vht) if (band_info.vht)
push(modes, "VHT80"); push(modes, "VHT80");
if (he_phy_cap & 4) if (he_phy_cap & 4)
push(modes, "HE80"); push(modes, "HE80");
if (eht_phy_cap && he_phy_cap & 4)
push(modes, "EHT80");
if ((band.vht_capa >> 2) & 0x3) if ((band.vht_capa >> 2) & 0x3)
push(modes, "VHT160"); push(modes, "VHT160");
if (he_phy_cap & 0x18) if (he_phy_cap & 0x18)
push(modes, "HE160"); 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); let entry = wiphy_get_entry(name, path);