wifi-scripts: fix phy index lookup in device_capabilities
authorFelix Fietkau <nbd@nbd.name>
Thu, 19 Dec 2024 05:44:30 +0000 (06:44 +0100)
committerFelix Fietkau <nbd@nbd.name>
Thu, 19 Dec 2024 05:44:48 +0000 (06:44 +0100)
For renamed phys, the index cannot be derived from the name

Signed-off-by: Felix Fietkau <nbd@nbd.name>
package/network/config/wifi-scripts/files-ucode/usr/share/ucode/wifi/hostapd.uc

index f95f01e846807981f3877c4533098c489ff350f4..adbfc1b9781436c5b530f1302e9b939e82feb233 100644 (file)
@@ -437,7 +437,7 @@ function device_extended_features(data, flag) {
 }
 
 function device_capabilities(phy) {
-       let idx = +substr(phy, 3, 1);;
+       let idx = +fs.readfile(`/sys/class/ieee80211/${phy}/index`);
        phy = nl80211.request(nl80211.const.NL80211_CMD_GET_WIPHY, nl80211.const.NLM_F_DUMP, { wiphy: idx, split_wiphy_dump: true });
        if (!phy)
                return;