summaryrefslogtreecommitdiffstats
path: root/abs/core/wlan-ng26-utils/wlan
blob: 6b3252dfbaddc41c80fd1fc31c132a2d09fda4aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/sh

if [ ! -f /etc/wlan/shared ] ; then
  echo "/etc/wlan/shared not present"
  exit 0
fi

. /etc/wlan/shared
. /etc/rc.conf
. /etc/rc.d/functions

case "$1" in
  start)
    # This will implicitly fire off wland via hotplug.
    stat_busy "Starting WLAN Devices"
    if ! $MODPROBE p80211; then
      echo "Failed to load p80211.o."
      exit 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.

    for DEVICE in $WLAN_DEVICES; do
      $MODPROBE $DEVICE
      # if we don't have hotplug.. do things the old-fashioned way.
      if [ $HAS_HOTPLUG = 'n' ] ; then
        wlan_bring_it_up $DEVICE
      fi
    done

    # And hotplug will take care of the rest, namely device 
    # initialization and whatnot.

    add_daemon wlan
    stat_done

   ;;

  stop)
    stat_busy "Shutting Down WLAN Devices"
    # Do a reset on each device to make sure none of them are still
    #  trying to generate interrupts.
    for DEVICE in $WLAN_DEVICES; do
      wlan_disable $DEVICE
      ifconfig $DEVICE down
      $MODPROBE -r $DEVICE
    done

    # remove p80211, which will implictly kill wland.
    $MODPROBE -r p80211

    rm_daemon wlan
    stat_done
    ;;

  restart)
    $0 stop
    $0 start
    EXITCODE=$?
    ;;

  *)
    echo "usage: $0 {start|stop|restart}"
    ;;

esac
exit 0