summaryrefslogtreecommitdiff
path: root/scripts/athenable
blob: 3ec16ad28f8c52d87449365da428bcf62432241d (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
#!/bin/bash
#
# Copyright 2007	Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
#
# Makes sure either ath5k or MadWifi are ready 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

ATH5K="ath5k"
ATH9K="ath9k"
MADWIFI="ath_pci"
# Appended to module file at the end when we want to ignore one
IGNORE_SUFFIX=".ignore"
USAGE="Usage: $0 [ ath5k | madwifi ]"

# Default behavior: disables any MadWifi driver present and makes sure
# ath5k is enabled
if [ $# -eq 0 ]; then
	module_disable $MADWIFI
	module_enable $ATH5K
	module_enable $ATH9K
	exit
elif [ $# -ne 1 ]; then
	echo "$USAGE"
	exit
fi

MODULE=$1
if [ "$MODULE" == "ath5k" ]; then
	module_disable $MADWIFI
	module_enable $ATH5K
	module_enable $ATH9K
elif [ "$MODULE" == "madwifi" ]; then
	module_disable $ATH5K
	module_disable $ATH9K
	module_enable $MADWIFI
else
	echo "$USAGE"
	exit
fi