[LEDE-DEV] [PATCH v2 3/5] broadcom-wl: use uci to generate wireless config file
Christian Lamparter
chunkeey at googlemail.com
Tue Oct 11 04:37:38 PDT 2016
Previously, wifi detect simply dumped its generated wireless
configuration out to STDOUT. A second step was needed to
append the configuration to /etc/config/wireless (or create
it, if it didn't exist).
With this patch, The wifi detection script will now use uci
to update the wireless configuration directly.
Note: uci writes a "cfg123456" printout to stdout when it
generates a name for the unnamed section ("add wireless wifi-iface").
Since we currently pipe wifi detect into /etc/config/wireless, we
have to redirected this output, so it doesn't end up in the wireless
configuration file.
Signed-off-by: Christian Lamparter <chunkeey at gmail.com>
---
.../kernel/broadcom-wl/files/lib/wifi/broadcom.sh | 30 +++++++++++-----------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh b/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
index deb4ddf..1881b46 100644
--- a/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
+++ b/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
@@ -456,22 +456,22 @@ detect_broadcom() {
config_get type wl${i} type
[ "$type" = broadcom ] && continue
channel=`wlc ifname wl${i} channel`
- cat <<EOF
-config wifi-device wl${i}
- option type broadcom
- option channel ${channel:-11}
- option txantenna 3
- option rxantenna 3
- # REMOVE THIS LINE TO ENABLE WIFI:
- option disabled 1
-
-config wifi-iface
- option device wl${i}
- option network lan
- option mode ap
- option ssid Lede${i#0}
- option encryption none
+ uci -q batch > /dev/null <<-EOF
+ set wireless.wl${i}=wifi-device
+ set wireless.wl${i}.type=broadcom
+ set wireless.wl${i}.channel=${channel:-11}
+ set wireless.wl${i}.txantenna=3
+ set wireless.wl${i}.rxantenna=3
+ set wireless.wl${i}.disabled=1
+
+ add wireless wifi-iface
+ set wireless. at wifi-iface[-1].device=wl${i}
+ set wireless. at wifi-iface[-1].network=lan
+ set wireless. at wifi-iface[-1].mode=ap
+ set wireless. at wifi-iface[-1].ssid=Lede${i#0}
+ set wireless. at wifi-iface[-1].encryption=none
EOF
+ uci commit &> /dev/null
done
}
--
2.9.3
More information about the Lede-dev
mailing list