scripts/netifd-wireless.sh: add support for specifying the operating band
authorFelix Fietkau <nbd@nbd.name>
Mon, 24 May 2021 10:37:55 +0000 (12:37 +0200)
committerFelix Fietkau <nbd@nbd.name>
Mon, 24 May 2021 10:37:56 +0000 (12:37 +0200)
Add the new 'band' option, which supports the following values: 2g, 5g, 6g, 60g

Signed-off-by: Felix Fietkau <nbd@nbd.name>
scripts/netifd-wireless.sh

index d915402a8d3ff38925efaf6664d7dcc55747ce30..b920296a9764ab61e513644c31694ab037668956 100644 (file)
@@ -39,13 +39,12 @@ prepare_key_wep() {
 }
 
 _wdev_prepare_channel() {
-       json_get_vars channel hwmode
+       json_get_vars channel band hwmode
 
        auto_channel=0
        enable_ht=0
        htmode=
        hwmode="${hwmode##11}"
-       hwmode_n="${hwmode##n}"
 
        case "$channel" in
                ""|0|auto)
@@ -58,17 +57,6 @@ _wdev_prepare_channel() {
                ;;
        esac
 
-       [[ "$hwmode_n" = "$hwmode" ]] || {
-               enable_ht=1
-               hwmode="$hwmode_n"
-
-               json_get_vars htmode
-               case "$htmode" in
-                       HT20|HT40+|HT40-);;
-                       *) htmode= ;;
-               esac
-       }
-
        case "$hwmode" in
                a|b|g|ad) ;;
                *)
@@ -79,6 +67,18 @@ _wdev_prepare_channel() {
                        fi
                ;;
        esac
+
+       case "$band" in
+               2g) hwmode=g;;
+               5g|6g|60g) hwmode=a;;
+               *)
+                       case "$hwmode" in
+                               *a) band=5g;;
+                               *ad) band=60g;;
+                               *b|*g) band=2g;;
+                       esac
+               ;;
+       esac
 }
 
 _wdev_handler() {
@@ -362,7 +362,7 @@ for_each_station() {
 }
 
 _wdev_common_device_config() {
-       config_add_string channel hwmode htmode noscan
+       config_add_string channel hwmode band htmode noscan
 }
 
 _wdev_common_iface_config() {