#!/sbin/runscript source_config() { if [ -f /etc/wlan/shared ] then source /etc/wlan/shared else return 1 fi return 0 } start() { ebegin "Starting WLAN devices" if ! source_config then eerror "Error loading /etc/wlan/shared" eend 1 return 1 fi # NOTE: We don't explicitly insmod the card driver here. The # best thing to do is to specify an alias in /etc/modules.conf. # Then, the first time we call wlanctl with the named device, # the kernel module autoload stuff will take over. for DEVICE in $WLAN_DEVICES; do #=======ENABLE======================================== # Do we want to init the card at all? eval 'WLAN_ENABLE=$ENABLE_'$DEVICE if ! is_true $WLAN_ENABLE ; then continue fi if is_true $WLAN_DOWNLOAD; then wlan_download $DEVICE fi wlan_enable $DEVICE #=======MAC STARTUP========================================= wlan_supports_scan $DEVICE if [ $? = 0 ] ; then wlan_scan $DEVICE if [ $? = 0 ] ; then wlan_source_config_for_ssid "$ssid" "$bssid" wlan_user_mibs $DEVICE # make it quiet error=`eval wlan_wep $DEVICE` grep 'autojoin' /proc/net/p80211/$DEVICE/wlandev > /dev/null if [ $? = 0 ]; then wlan_infra $DEVICE else wlan_dot11_join $DEVICE fi else echo "network not found. maybe start IBSS?" fi else wlan_source_config $DEVICE wlan_user_mibs $DEVICE # make it quiet error=`eval wlan_wep $DEVICE` if is_true $IS_ADHOC ; then wlan_adhoc $DEVICE else wlan_infra $DEVICE fi fi done eend 0 } stop() { ebegin "Shutting Down WLAN Devices" if ! source_config then eerror "Error loading /etc/wlan/shared" eend 1 return 1 fi # Do a reset on each device to make sure none of them are still # trying to generate interrupts. for DEVICE in $WLAN_DEVICES; do # This just makes it quiet... error="$(eval wlan_disable $DEVICE)" done eend 0 }