@@ -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.@wifi-iface[-1].device=wl${i}
+ set wireless.@wifi-iface[-1].network=lan
+ set wireless.@wifi-iface[-1].mode=ap
+ set wireless.@wifi-iface[-1].ssid=Lede${i#0}
+ set wireless.@wifi-iface[-1].encryption=none
EOF
+ uci commit &> /dev/null
done
}
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@gmail.com> --- .../kernel/broadcom-wl/files/lib/wifi/broadcom.sh | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-)