summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthepeople <thepeople@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-03-15 03:21:35 +0000
committerthepeople <thepeople@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-03-15 03:21:35 +0000
commit2c83d00ba13bcc59bc15e13d0e1856976f63cff6 (patch)
tree60b01c3be39bd0f881bec76053966c292b819f1d
parent4eb3ce394ee2c5208c856646f05b96cc7484c0e4 (diff)
added TXpower, antenna diversity, distance, backround scan, PSK and PSK2 settings, from #1287 #1255
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@6567 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rwxr-xr-xpackage/madwifi/files/lib/wifi/madwifi.sh78
1 files changed, 71 insertions, 7 deletions
diff --git a/package/madwifi/files/lib/wifi/madwifi.sh b/package/madwifi/files/lib/wifi/madwifi.sh
index 10e8ab1c0..e7e227bb7 100755
--- a/package/madwifi/files/lib/wifi/madwifi.sh
+++ b/package/madwifi/files/lib/wifi/madwifi.sh
@@ -127,6 +127,9 @@ enable_atheros() {
config_get key "$vif" key
iwconfig "$ifname" enc "${key:-1}"
;;
+ PSK|psk|PSK2|psk2)
+ config_get key "$vif" key
+ ;;
esac
case "$mode" in
@@ -138,8 +141,37 @@ enable_atheros() {
config_get ssid "$vif" ssid
;;
esac
+
+ [ "$mode" = "sta" ] && {
+ config_get_bool bgscan "$vif" bgscan 1
+ iwpriv "$ifname" bgscan "$bgscan"
+ }
+
+ config_get_bool antdiv "$device" diversity 1
+ sysctl -w dev."$device".diversity="$antdiv" >&-
+
+ config_get antrx "$device" rxantenna
+ if [ -n "$antrx" ]; then
+ sysctl -w dev."$device".rxantenna="$antrx" >&-
+ fi
+
+ config_get anttx "$device" txantenna
+ if [ -n "$anttx" ]; then
+ sysctl -w dev."$device".txantenna="$anttx" >&-
+ fi
+
+ config_get distance "$device" distance
+ if [ -n "$distance" ]; then
+ athctrl -i "$device" -d "$distance" >&-
+ fi
+
+ config_get txpwr "$vif" txpower
+ if [ -n "$txpwr" ]; then
+ iwconfig "$ifname" txpower "${txpwr%%.*}"
+ fi
+
ifconfig "$ifname" up
-
+
local net_cfg bridge
net_cfg="$(find_net_config "$vif")"
[ -z "$net_cfg" ] || {
@@ -159,7 +191,34 @@ enable_atheros() {
}
;;
wds|sta)
- # FIXME: implement wpa_supplicant calls here
+ case "$enc" in
+ PSK|psk|PSK2|psk2)
+ case "$enc" in
+ PSK|psk)
+ proto='proto=WPA';;
+ PSK2|psk2)
+ proto='proto=RSN';;
+ esac
+ cat > /var/run/wpa_supplicant-$ifname.conf <<EOF
+ctrl_interface=/var/run/wpa_supplicant
+network={
+ scan_ssid=1
+ ssid="$ssid"
+ key_mgmt=WPA-PSK
+ $proto
+ psk="$key"
+}
+EOF
+ ;;
+ WPA|wpa|WPA2|wpa2)
+ #add wpa_supplicant calls here
+ ;;
+ esac
+ net_cfg="$(find_net_config "$vif")"
+ [ -z "$net_cfg" ] || {
+ bridge="$(bridge_interface "$net_cfg")"
+ }
+ wpa_supplicant ${bridge:+ -b $bridge} -Bw -D wext -i "$ifname" -c /var/run/wpa_supplicant-$ifname.conf
;;
esac
first=0
@@ -177,16 +236,21 @@ detect_atheros() {
config wifi-device $dev
option type atheros
option channel 5
+# option diversity 1
+# option txantenna 0
+# option rxantenna 0
+# option distance 2000
config wifi-iface
- option device $dev
+ option device $dev
# option network lan
- option mode ap
- option ssid OpenWrt
- option hidden 0
+ option mode ap
+ option ssid OpenWrt
+ option hidden 0
+# option txpower 15
+# option bgscan enable
option encryption none
EOF
done
}
-