From 5e35b4562fb73aaa1c75a3404fed2efb6afe03f8 Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Mon, 17 Oct 2016 15:59:13 +0200 Subject: [PATCH] base-files, mac80211, broadcom-wl: use uci to populate wireless config Previously, wifi detect simply dumped its generated wireless configuration 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. This patch also makes the initially created wifi-iface a named section ('default_radio$X' for mac80211 and 'default_wl$X' for broadcom). With this change, uci will not print the cfgHASH to STDOUT (which would now corrupt the wireless configuration). It will also prevent adding duplicated wifi interface configurations, if the wifi configuration is run concurrently. Signed-off-by: Christian Lamparter --- package/base-files/files/etc/init.d/boot | 6 +-- .../broadcom-wl/files/lib/wifi/broadcom.sh | 30 ++++++------- .../mac80211/files/lib/wifi/mac80211.sh | 43 +++++++++---------- 3 files changed, 37 insertions(+), 42 deletions(-) diff --git a/package/base-files/files/etc/init.d/boot b/package/base-files/files/etc/init.d/boot index 904f7db75e..03b0fa0419 100755 --- a/package/base-files/files/etc/init.d/boot +++ b/package/base-files/files/etc/init.d/boot @@ -41,11 +41,7 @@ boot() { # allow wifi modules time to settle sleep 1 - /sbin/wifi detect > /tmp/wireless.tmp - [ -s /tmp/wireless.tmp ] && { - cat /tmp/wireless.tmp >> /etc/config/wireless - } - rm -f /tmp/wireless.tmp + /sbin/wifi detect /bin/config_generate uci_apply_defaults diff --git a/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh b/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh index deb4ddf1d2..2780fa1679 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 <