summaryrefslogtreecommitdiff
path: root/scripts/b43enable
blob: 2d2d22cb349fdb36191d8eea7c369fac71871ff9 (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
#!/bin/bash
#
# Copyright 2007	Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
#
# Makes sure either b43, b43legacy (new mac80211 drivers) or bcm43xx 
# is enabled to be used. This allows us to choose any driver without 
# blacklisting each other.

. /usr/lib/compat-drivers/modlib.sh

if [[ $UID -ne 0 ]]; then
	echo "Run with root privileges"
	exit
fi

B43S="b43 b43legacy"
B43_OLD="bcm43xx"
B43_PROP="wl"

# Appended to module file at the end when we want to ignore one
USAGE="Usage: $0 [ b43 | bcm43xx | wl ]"

function enable_b43 {
	module_disable $B43_OLD
	module_disable $B43_PROP
	for i in $B43S; do
		module_enable $i
	done
}

# Default behavior: disables the old bcm43xx driver and enables b43
# and b43legacy
if [ $# -eq 0 ]; then
	enable_b43
	exit
elif [ $# -ne 1 ]; then
	echo "$USAGE"
	exit
fi

MODULE=$1
if [ "$MODULE" == "bcm43xx" ]; then
	for i in $B43S; do
		module_disable $i
	done
	module_disable $B43_PROP
	module_enable $B43_OLD
elif [ "$MODULE" == "wl" ]; then
	for i in $B43S; do
		module_disable $i
	done
	module_disable $B43_OLD
	module_enable $B43_PROP
elif [ "$MODULE" == "b43" ]; then
	enable_b43
else
	echo "$USAGE"
	exit
fi