Skip to content

Commit 0f2424b

Browse files
committed
feat: autoselect freqency band if not specified
This commit is an addition to f0f68e9 where it fails when using config file. This patch allows `default` option for the FREQ_BAND config option. It also creates changes the `--mkconfig` option to detect whether or not one is using a specific frequency band.
1 parent f0f68e9 commit 0f2424b

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

src/scripts/create_ap

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,6 +1040,10 @@ write_config() {
10401040
PASSPHRASE="$4"
10411041
fi
10421042

1043+
if [[ $FREQ_BAND_SET -eq 0 ]]; then
1044+
FREQ_BAND="default"
1045+
fi
1046+
10431047
for config_opt in "${CONFIG_OPTS[@]}"; do
10441048
eval echo $config_opt=\$$config_opt
10451049
done >> "$STORE_CONFIG"
@@ -1068,7 +1072,7 @@ read_config() {
10681072
opt_name="${line%%=*}"
10691073
opt_val="${line#*=}"
10701074

1071-
if [[ $opt_name == "FREQ_BAND" ]] ; then
1075+
if [[ $opt_name == "FREQ_BAND" && $opt_val != "default" ]] ; then
10721076
FREQ_BAND_SET=1
10731077
fi
10741078

@@ -1397,9 +1401,11 @@ elif [[ $RUNNING_AS_DAEMON -eq 1 && -n "$DAEMON_PIDFILE" ]]; then
13971401
echo $$ >$DAEMON_PIDFILE
13981402
fi
13991403

1400-
if [[ $FREQ_BAND != 2.4 && $FREQ_BAND != 5 ]]; then
1401-
echo "ERROR: Invalid frequency band" >&2
1402-
exit 1
1404+
if [[ $FREQ_BAND_SET != 0 ]]; then
1405+
if [[ $FREQ_BAND != 2.4 && $FREQ_BAND != 5 ]]; then
1406+
echo "ERROR: Invalid frequency band" >&2
1407+
exit 1
1408+
fi
14031409
fi
14041410

14051411
if [[ $CHANNEL == default ]]; then

0 commit comments

Comments
 (0)