[openwrt/openwrt] wifi-scripts: update phys after rename_phy_by_name call

LEDE Commits lede-commits at lists.infradead.org
Tue Dec 16 11:23:32 PST 2025


robimarko pushed a commit to openwrt/openwrt.git, branch openwrt-25.12:
https://git.openwrt.org/c432647d180b0176ec806ee8d91f4252e20b350b

commit c432647d180b0176ec806ee8d91f4252e20b350b
Author: Rany Hany <rany_hany at riseup.net>
AuthorDate: Mon Dec 15 19:11:24 2025 +0200

    wifi-scripts: update phys after rename_phy_by_name call
    
    This fixes a failed bring up of the radio on bootup
    if the model defines a rename of phy in its /etc/board.json.
    This specifically impacts Redmi AX6S and any router that does so
    in its /etc/board.json. The fix fortunately is simple, just update
    phy name in phys after rename.
    
    The entry that specifically causes this issue is the following:
    
    {
            <omitted>
            "wlan": {
                    "wl0": {
                            "path": "platform/18000000.wmac",
                            "info": {
                                    "antenna_rx": 15,
                                    "antenna_tx": 15,
                                    "bands": {
                                            "2G": {
                                                    "ht": true,
                                                    "max_width": 40,
                                                    "modes": [
                                                            "NOHT",
                                                            "HT20",
                                                            "HT40"
                                                    ],
                                                    "default_channel": 1
                                            }
                                    },
                                    "radios": [
                                    ]
                            }
                    },
            ...
    }
    
    The issue is that after rename, referenced phy in config is going to be
    wl0 but in phys array it is still phy0; and so it fails to find phy
    and does not bring up radio.
    
    Fixes: https://github.com/openwrt/openwrt/issues/20250
    Fixes: https://github.com/openwrt/openwrt/issues/20339
    Signed-off-by: Rany Hany <rany_hany at riseup.net>
    Link: https://github.com/openwrt/openwrt/pull/21175
    Signed-off-by: Robert Marko <robimarko at gmail.com>
    (cherry picked from commit e4d5e76af059d9c7fe295bbd144a39a77fbb5491)
---
 .../network/config/wifi-scripts/files/usr/share/ucode/wifi/utils.uc  | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/package/network/config/wifi-scripts/files/usr/share/ucode/wifi/utils.uc b/package/network/config/wifi-scripts/files/usr/share/ucode/wifi/utils.uc
index 0ec8505670..7ecfd2d204 100644
--- a/package/network/config/wifi-scripts/files/usr/share/ucode/wifi/utils.uc
+++ b/package/network/config/wifi-scripts/files/usr/share/ucode/wifi/utils.uc
@@ -57,6 +57,11 @@ function rename_phy_by_name(phys, name, rename) {
 		wiphy: idx,
 		wiphy_name: name
 	});
+
+	let prev_idx = index(phys, prev_name);
+	if (prev_idx >= 0)
+		phys[prev_idx] = name;
+
 	return true;
 }
 




More information about the lede-commits mailing list