wifi-scripts: make scan output fields conditional

Only print VHT/HE/EHT center frequency and channel width fields
when they are actually populated. This avoids displaying undefined
values for non-6GHz HE results where channel info is derived from
VHT/HT Operation IEs. Also fix center_chan_2 format specifier from
%s to %d.

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2026-03-17 12:25:24 +01:00
committed by Felix Fietkau
parent b8175a021b
commit 3b6050fe42
@@ -95,23 +95,32 @@ function print_scan(cells) {
if (cell.vht) {
printf('\t VHT Operation:\n');
printf('\t\tCenter Frequency 1: %d\n', cell.vht.center_chan_1);
printf('\t\tCenter Frequency 2: %s\n', cell.vht.center_chan_2);
printf('\t\tChannel Width: %s\n', cell.vht.chan_width);
if (cell.vht.center_chan_1)
printf('\t\tCenter Frequency 1: %d\n', cell.vht.center_chan_1);
if (cell.vht.center_chan_2)
printf('\t\tCenter Frequency 2: %d\n', cell.vht.center_chan_2);
if (cell.vht.chan_width)
printf('\t\tChannel Width: %s\n', cell.vht.chan_width);
}
if (cell.he) {
printf('\t HE Operation:\n');
printf('\t\tCenter Frequency 1: %d\n', cell.he.center_chan_1);
printf('\t\tCenter Frequency 2: %s\n', cell.he.center_chan_2);
printf('\t\tChannel Width: %s\n', cell.he.chan_width);
if (cell.he.center_chan_1)
printf('\t\tCenter Frequency 1: %d\n', cell.he.center_chan_1);
if (cell.he.center_chan_2)
printf('\t\tCenter Frequency 2: %d\n', cell.he.center_chan_2);
if (cell.he.chan_width)
printf('\t\tChannel Width: %s\n', cell.he.chan_width);
}
if (cell.eht) {
printf('\t EHT Operation:\n');
printf('\t\tCenter Frequency 1: %d\n', cell.eht.center_chan_1);
printf('\t\tCenter Frequency 2: %s\n', cell.eht.center_chan_2);
printf('\t\tChannel Width: %s\n', cell.eht.chan_width);
if (cell.eht.center_chan_1)
printf('\t\tCenter Frequency 1: %d\n', cell.eht.center_chan_1);
if (cell.eht.center_chan_2)
printf('\t\tCenter Frequency 2: %d\n', cell.eht.center_chan_2);
if (cell.eht.chan_width)
printf('\t\tChannel Width: %s\n', cell.eht.chan_width);
}
printf('\n');