broadcom-wl: read channel using wlc on detect
[openwrt/staging/yousong.git] / package / broadcom-wl / files / lib / wifi / broadcom.sh
index 57e11e4b14c047720a1bfc284ac3a97a3b0d921e..72b85aaf88bde7f4243895cddca94b73c46ea0b7 100644 (file)
@@ -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