From a2607d853cd66dbde101179edc270733646d7fd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Walstr=C3=B6m?= Date: Wed, 1 Jul 2026 21:53:41 +0200 Subject: [PATCH] statd: wifi: Limit bands to the supported ones Infix only supports 2.4/5/6 Ghz, ignore all else. --- board/common/rootfs/usr/libexec/infix/iw.py | 30 ++++++++++++--------- src/statd/python/yanger/ietf_hardware.py | 3 ++- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/board/common/rootfs/usr/libexec/infix/iw.py b/board/common/rootfs/usr/libexec/infix/iw.py index 78f9a8b2..ed6883d1 100755 --- a/board/common/rootfs/usr/libexec/infix/iw.py +++ b/board/common/rootfs/usr/libexec/infix/iw.py @@ -176,19 +176,25 @@ def parse_phy_info(phy_name): if current_band and current_band.get('frequencies'): result['bands'].append(current_band) - # Determine band names and assign band numbers + # Keep only the bands Infix supports (2.4/5/6 GHz), naming them by their + # first frequency. Hardware may expose others (e.g. S1G on hwsim) that we + # neither configure nor report. + bands = [] for band in result['bands']: - if band['frequencies']: - freq = band['frequencies'][0] - if 2400 <= freq <= 2500: - band['name'] = '2.4GHz' - band['band'] = 1 - elif 5150 <= freq <= 5900: - band['name'] = '5GHz' - band['band'] = 2 - elif 5955 <= freq <= 7115: - band['name'] = '6GHz' - band['band'] = 3 + freq = band['frequencies'][0] + if 2400 <= freq <= 2500: + band['name'] = '2.4GHz' + band['band'] = 1 + elif 5150 <= freq <= 5900: + band['name'] = '5GHz' + band['band'] = 2 + elif 5955 <= freq <= 7115: + band['name'] = '6GHz' + band['band'] = 3 + else: + continue + bands.append(band) + result['bands'] = bands # Set max TX power if max_power is not None: diff --git a/src/statd/python/yanger/ietf_hardware.py b/src/statd/python/yanger/ietf_hardware.py index 934b2f6d..e29f53e3 100644 --- a/src/statd/python/yanger/ietf_hardware.py +++ b/src/statd/python/yanger/ietf_hardware.py @@ -591,8 +591,9 @@ def convert_iw_phy_info_for_yanger(phy_info): for band in phy_info.get("bands", []): band_data = { "band": str(band.get("band", 0)), - "name": band.get("name", "Unknown") } + if band.get("name"): + band_data["name"] = band["name"] # Add capability flags (iw.py uses snake_case: ht_capable, vht_capable, he_capable) if band.get("ht_capable"):