summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJames Rayner <james@archlinux.org>2008-05-30 15:24:19 +0200
committerJames Rayner <james@archlinux.org>2008-05-30 15:24:19 +0200
commitcd374f02c9f54b53ac3dd023ac2b698023c00192 (patch)
treeeae79fb88f631125a08840f3dd96527ab509529a /src
parentf45d6873679bd1baa8425c3ee23f3890feb283c3 (diff)
downloadnetctl-cd374f02c9f54b53ac3dd023ac2b698023c00192.tar.gz
netctl-cd374f02c9f54b53ac3dd023ac2b698023c00192.tar.xz
Sort out various wireless quirks and improve wireless reliability
Diffstat (limited to 'src')
-rw-r--r--src/network.subr18
-rw-r--r--src/wireless.subr25
2 files changed, 30 insertions, 13 deletions
diff --git a/src/network.subr b/src/network.subr
index 8af51b8..a99363f 100644
--- a/src/network.subr
+++ b/src/network.subr
@@ -160,6 +160,24 @@ profile_down()
stat_done
}
+# Check if variable is a member of an array
+inarray()
+{
+search=$1
+shift
+for item in $*; do
+ if [[ "$item" == "$search" ]]; then
+ return 0
+ fi
+done
+return 1
+}
+
+quirk() {
+inarray $1 ${QUIRKS[@]}
+return $?
+}
+
# interface_down interface
# take interface down
#
diff --git a/src/wireless.subr b/src/wireless.subr
index b121af0..94796c9 100644
--- a/src/wireless.subr
+++ b/src/wireless.subr
@@ -43,13 +43,13 @@ wep_check()
# find_essid interface essid
find_essid()
{
- INTERFACE=$1; ESSID=$2; RETRIES=4
+ INTERFACE=$1; ESSID=$2; RETRIES=5
try=0;
while [[ $try -ne $RETRIES ]]; do
if iwlist $INTERFACE scan|sed "s/ESSID://g"|grep -q "\"$ESSID\""; then
return 0 # network found
fi
- sleep 0.5
+ sleep 1
let try++
done
return 1
@@ -105,21 +105,23 @@ wireless_up() {
err_append "Interface $INTERFACE is not a wireless interface"
return 1
fi
-
- # Was required by broadcom
- # iwlist $INTERFACE scan &> /dev/null
-
- # Required by atheros to enable device
+
+ # Required by atheros and others (mac80211?) to enable device
ifconfig $INTERFACE up
+ # Hack that has been required by some broadcom
+ quirk "prescan" && iwlist $INTERFACE scan &> /dev/null
+ quirk "test" && echo "TESTWORKS!"
# Required by ipw3945 to properly re-associate
- eval "iwconfig $INTERFACE mode managed essid \"$ESSID\""
+ quirk "preessid" && eval "iwconfig $INTERFACE mode managed essid \"$ESSID\""
# Kill any lingering wpa_supplicants.
if [[ -f /var/run/wpa_supplicant_$INTERFACE.pid ]]; then
kill $(cat /var/run/wpa_supplicant_$INTERFACE.pid)
fi
+ # Default scan off as it won't see hidden networks and some hardware's scanning is dodgy
+ [[ ! "$SCAN" ]] && SCAN="no"
if checkyesno $SCAN; then
if ! find_essid $INTERFACE "$ESSID"; then
err_append "Network unavailable"
@@ -152,11 +154,8 @@ wireless_up() {
wpa)
local WPA_CONF=`mktemp /tmp/wpa.XXXXXXXX`
- # Temporary bugfix for broken drivers... http://bbs.archlinux.org/viewtopic.php?id=36384
- if ! eval iwconfig $INTERFACE mode managed essid "\"$ESSID\""; then
- err_append "Could not set wireless configuration"
- return 1
- fi
+ # Quirk for broken drivers... http://bbs.archlinux.org/viewtopic.php?id=36384
+ quirk "wpaessid" && eval iwconfig $INTERFACE mode managed essid "\"$ESSID\""
# Create a random file to store configuration, make it root only.
chmod 600 $WPA_CONF