blob: c29b71eec4cad4548275c954e7bea7e106aa7523 [file] [log] [blame]
#!/bin/bash
#
# Copyright 2007 Luis R. Rodriguez <lrodriguez@atheros.com>
#
# Makes sure either iwlagn (new) or iwl4965 (old)
# 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
IWL_NEW="iwlagn"
IWL_OLD="iwl4965"
# Appended to module file at the end when we want to ignore one
USAGE="Usage: $0 [ $IWL_NEW | $IWL_OLD | iwlwifi ]"
function enable_iwlwifi {
for i in $IWL_OLD $IWL_NEW; do
module_disable $i
done
module_enable iwlwifi
}
function enable_iwlagn {
module_disable $IWL_OLD
for i in $IWL_NEW; do
module_enable $i
done
}
# Default behavior: disables the old iwl4965 driver and enables iwlagn
if [ $# -eq 0 ]; then
enable_iwlagn
exit
elif [ $# -ne 1 ]; then
echo "$USAGE"
exit
fi
MODULE=$1
if [ "$MODULE" == "iwl4965" ]; then
module_disable $IWL_NEW
module_enable $IWL_OLD
elif [ "$MODULE" == "iwlagn" ]; then
enable_iwlagn
elif [ "$MODULE" == "iwlwifi" ]; then
enable_iwlwifi
else
echo "$USAGE"
exit
fi