M7350/external/compat-wireless/scripts/iwl-enable
2024-09-09 08:57:42 +00:00

48 lines
914 B
Bash
Executable File

#!/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-wireless/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 ]"
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
else
echo "$USAGE"
exit
fi