Hardcoding channel number to 11 is a bad idea, it may be even not
available on some devices. If there are two single-band radios, the
one for 5GHz doesn't have 11 channel.

Signed-off-by: Rafał Miłecki <zaj...@gmail.com>
---
Changes from RFC: use channel "11" as fallback (default value). See:
${channel:-11}
---
 package/broadcom-wl/files/lib/wifi/broadcom.sh |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/package/broadcom-wl/files/lib/wifi/broadcom.sh 
b/package/broadcom-wl/files/lib/wifi/broadcom.sh
index 57e11e4..72b85aa 100644
--- a/package/broadcom-wl/files/lib/wifi/broadcom.sh
+++ b/package/broadcom-wl/files/lib/wifi/broadcom.sh
@@ -370,12 +370,15 @@ detect_broadcom() {
        local i=-1
 
        while grep -qs "^ *wl$((++i)):" /proc/net/dev; do
+               local channel
+
                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  11
+       option channel  ${channel:-11}
 
        # REMOVE THIS LINE TO ENABLE WIFI:
        option disabled 1
-- 
1.7.10.4

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to