wl1251: make local symbols static
[pandora-wifi.git] / scripts / b43load
1 #!/bin/bash
2 # Copyright 2007        Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
3 #
4 # Loads new broadcom drivers (b43 and b43legacy) or the old ones (bcm43xx)
5
6 . /usr/lib/compat-wireless/modlib.sh
7
8 if [[ $UID -ne 0 ]]; then
9         echo "Run with root privileges"
10         exit
11 fi
12
13
14 USAGE="Usage: $0 [ b43 | bcm43xx ]"
15
16 # Default behavior: unload bcm43xx and load b43 and b43legacy
17 if [ $# -eq 0 ]; then
18         1=b43
19 elif [ $# -ne 1 ]; then
20         echo "$USAGE"
21         exit
22 fi
23
24 MODULE=$1
25 if [ "$MODULE" == "b43" ]; then
26         grep bcm43xx /proc/modules 2>&1 > /dev/null
27         if [ $? -eq 0 ]; then
28                 echo Unloading $i...
29                 modprobe -r --ignore-remove bcm43xx
30         fi
31         # Enables both b43 and b43legacy
32         b43enable b43
33         modprobe b43
34         modprobe b43legacy
35         CHECK=`modprobe -l b43`
36         if [ ! -z $CHECK ]; then
37                 echo "b43 loaded successfully"
38         fi
39         CHECK=`modprobe -l b43legacy`
40         if [ ! -z $CHECK ]; then
41                 echo "b43legacy loaded successfully"
42         fi
43 elif [ "$MODULE" == "bcm43xx" ]; then
44         CHECK=`modprobe -l b43`
45         if [ ! -z $CHECK ]; then
46                 echo "b43 currently loaded, going to try to unload the module..."
47                 modprobe -r --ignore-remove b43
48         fi
49         CHECK=`modprobe -l b43legacy`
50         if [ ! -z $CHECK ]; then
51                 echo "b43legacy currently loaded, going to try to unload the module..."
52                 modprobe -r --ignore-remove b43legacy
53         fi
54         b43enable bcm43xx
55         # bcm43xx may be loaded already lets remove them first
56         modprobe -r --ignore-remov bcm43xx 2>&1 > /dev/null
57         modprobe bcm43xx
58         CHECK=`modprobe -l bcm43xx`
59         if [ ! -z $CHECK ]; then
60                 echo "bcm43xx loaded successfully!"
61         fi
62 else
63         echo "$USAGE"
64         exit
65 fi