M7350/external/compat-wireless/scripts/alx-enable

48 lines
882 B
Plaintext
Raw Normal View History

2024-09-09 08:57:42 +00:00
#!/bin/bash
#
# Copyright 2012 Luis R. Rodriguez <mcgrof@frijolero.org>
#
# Makes sure either alx (new) or atl1c (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
ALX_NEW="alx"
ALX_OLD="atl1c"
# Appended to module file at the end when we want to ignore one
USAGE="Usage: $0 [ $ALX_NEW | $ALX_OLD ]"
function enable_alx {
module_disable $ALX_OLD
for i in $ALX_NEW; do
module_enable $i
done
}
# Default behavior: disables the old atl1c driver and enables alx
if [ $# -eq 0 ]; then
enable_alx
exit
elif [ $# -ne 1 ]; then
echo "$USAGE"
exit
fi
MODULE=$1
if [ "$MODULE" == "atl1c" ]; then
module_disable $ALX_NEW
module_enable $ALX_OLD
elif [ "$MODULE" == "alx" ]; then
enable_alx
else
echo "$USAGE"
exit
fi