add pci latency timer workaround for atheros cards (from #1546)
[openwrt.git] / package / madwifi / files / lib / wifi / madwifi.sh
index e7e227b..89ab83d 100755 (executable)
@@ -125,7 +125,11 @@ enable_atheros() {
                                        iwconfig "$ifname" enc "[$idx]" "${key:-off}"
                                done
                                config_get key "$vif" key
-                               iwconfig "$ifname" enc "${key:-1}"
+                               key="${key:-1}"
+                               case "$key" in
+                                       [1234]) iwconfig "$ifname" enc "[$key]";;
+                                       *) iwconfig "$ifname" enc "$key";;
+                               esac
                        ;;
                        PSK|psk|PSK2|psk2)
                                config_get key "$vif" key
@@ -140,6 +144,12 @@ enable_atheros() {
                        *)
                                config_get ssid "$vif" ssid
                        ;;
+                       adhoc)
+                               config_get addr "$vif" bssid
+                               [ -z "$addr" ] || { 
+                                       iwconfig "$ifname" ap "$addr"
+                               }
+                       ;;
                esac
 
                [ "$mode" = "sta" ] && {
@@ -214,11 +224,7 @@ EOF
                                                #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
+                               [ -z "$proto" ] || wpa_supplicant ${bridge:+ -b $bridge} -Bw -D wext -i "$ifname" -c /var/run/wpa_supplicant-$ifname.conf
                        ;;
                esac
                first=0
@@ -229,7 +235,7 @@ EOF
 detect_atheros() {
        cd /proc/sys/dev
        [ -d ath ] || return
-       for dev in wifi*; do
+       for dev in $(ls -d wifi* 2>&-); do
                config_get type "$dev" type
                [ "$type" = atheros ] && return
                cat <<EOF
@@ -240,10 +246,13 @@ config wifi-device  $dev
 #       option txantenna 0
 #       option rxantenna 0
 #       option distance  2000
+# disable radio to prevent an open ap after reflashing:
+       option disabled 1
+
 
 config wifi-iface
        option device   $dev
-#      option network  lan
+       option network  lan
        option mode     ap
        option ssid     OpenWrt
        option hidden   0
This page took 0.024601 seconds and 4 git commands to generate.