pkgs/openwrt/uci-config: add automatic option band to combat wrong defaults in openwrt
This commit is contained in:
parent
0ae5e86f08
commit
6e9ee9c1fe
|
@ -432,8 +432,17 @@ let
|
|||
wifi = mkOption {
|
||||
default = {};
|
||||
type = with types; attrsOf (submodule (
|
||||
{ ... }: {
|
||||
{ config, ... }: {
|
||||
options = {
|
||||
band = mkOption {
|
||||
type = enum [ "2g" "5g" ];
|
||||
default =
|
||||
if config.channel >= 1 && config.channel <= 14
|
||||
then "2g"
|
||||
else if config.channel >= 32 && config.channel <= 177
|
||||
then "5g"
|
||||
else throw "What band is channel ${toString config.channel}?";
|
||||
};
|
||||
htmode = mkOption {
|
||||
type = enum [ "HT20" "HT40-" "HT40+" "HT40" "VHT80" ];
|
||||
};
|
||||
|
|
|
@ -342,6 +342,7 @@ in
|
|||
uci set wireless.radio${toString index}=wifi-device
|
||||
uci set wireless.radio${toString index}.type=mac80211
|
||||
uci set wireless.radio${toString index}.country=DE
|
||||
uci set wireless.radio${toString index}.band=${radioConfig.band}
|
||||
uci set wireless.radio${toString index}.channel=${toString radioConfig.channel}
|
||||
uci set wireless.radio${toString index}.path=${path}
|
||||
uci set wireless.radio${toString index}.htmode=${radioConfig.htmode}
|
||||
|
|
Loading…
Reference in New Issue