Use the 2008-04-07 snapshot, also mirrored to downloads.openwrt.org
[openwrt-10.03/.git] / package / mac80211 / files / lib / wifi / mac80211.sh
index 58fa1be492fac15703efda74ac0181c9a2949fe9..a2e6c685c06fcb6113f56cfedf71825e89f0f157 100644 (file)
@@ -66,10 +66,15 @@ enable_mac80211() {
 
                [ "$first" = 1 ] && {
                        # only need to change freq band and channel on the first vif
-                       iwconfig "$ifname" channel "$channel" >/dev/null 2>/dev/null 
+                       iwconfig "$ifname" channel "$channel" >/dev/null 2>/dev/null
+                       if [ "$mode" = adhoc ]; then
+                               iwlist "$ifname" scan >/dev/null 2>/dev/null
+                               sleep 1
+                               iwconfig "$ifname" mode ad-hoc >/dev/null 2>/dev/null
+                       fi
                        ifconfig "$ifname" up
                        sleep 1
-                       iwconfig "$ifname" channel "$channel" >/dev/null 2>/dev/null 
+                       iwconfig "$ifname" channel "$channel" >/dev/null 2>/dev/null
                }
        
                wpa=