]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
wifi-scripts: ucode: add support for the legacy hwmode option
authorFelix Fietkau <nbd@nbd.name>
Thu, 25 Sep 2025 07:40:47 +0000 (09:40 +0200)
committerFelix Fietkau <nbd@nbd.name>
Thu, 25 Sep 2025 07:41:25 +0000 (09:41 +0200)
Some configs that are many years old still have it set instead of band

Signed-off-by: Felix Fietkau <nbd@nbd.name>
package/network/config/wifi-scripts/files-ucode/lib/netifd/wireless/mac80211.sh

index ab8b2d15f9387c6810133a5b027291941ba8a7df..7acff9be8f323c7a2eecc01a088ee7f22c5f0fb0 100755 (executable)
@@ -175,7 +175,30 @@ function setup() {
 
        log('Starting');
 
-       validate('device', data.config);
+       let config = data.config;
+
+       if (!config.band) {
+               switch (config.hwmode) {
+               case 'a':
+               case '11a':
+                       config.band = '5g';
+                       break;
+               case 'ad':
+               case '11ad':
+                       config.band = '60g';
+                       break;
+               case 'b':
+               case 'g':
+               case '11b':
+               case '11g':
+               default:
+                       config.band = '2g';
+                       break;
+               }
+       }
+       delete config.hwmode;
+
+       validate('device', config);
        setup_phy(data.phy, data.config, data.data);
 
        let supplicant_mesh;