[packages] mac80211: Don't echo missing physical device errors to wireless config...
[openwrt.git] / package / mac80211 / files / lib / wifi / mac80211.sh
index f5c94a9..adfd948 100644 (file)
@@ -76,11 +76,13 @@ enable_mac80211() {
        config_get channel "$device" channel
        config_get vifs "$device" vifs
        config_get txpower "$device" txpower
+       config_get country "$device" country
        find_mac80211_phy "$device" || return 0
        config_get phy "$device" phy
        local i=0
        fixed=""
 
+       [ -n "$country" ] && iw reg set "$country"
        [ "$channel" = "auto" -o "$channel" = "0" ] || {
                fixed=1
        }
@@ -207,7 +209,7 @@ enable_mac80211() {
 
                config_get rts "$vif" rts
                if [ -n "$rts" ]; then
-                       iw phy "$phy" set rts "${frag%%.*}"
+                       iw phy "$phy" set rts "${rts%%.*}"
                fi
 
                ifconfig "$ifname" up
@@ -279,7 +281,7 @@ enable_mac80211() {
 check_device() {
        config_get phy "$1" phy
        [ -z "$phy" ] && {
-               find_mac80211_phy "$1" || return 0
+               find_mac80211_phy "$1" >/dev/null || return 0
                config_get phy "$1" phy
        }
        [ "$phy" = "$dev" ] && found=1