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

59 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# Copyright 2008 Luis R. Rodriguez <lrodriguez@atheros.com>
#
# Loads new Intel iwl (iwlagn) or the old ones (iwl4965)
. /usr/lib/compat-wireless/modlib.sh
IWL_OLD="iwl4965"
IWL_NEW="iwlagn"
if [[ $UID -ne 0 ]]; then
echo "Run with root privileges"
exit
fi
USAGE="Usage: $0 [ iwlagn | iwl4965 ]"
# Default behavior: unload iwl4965 and load iwlagn
if [ $# -eq 0 ]; then
1=iwlagn
elif [ $# -ne 1 ]; then
echo "$USAGE"
exit
fi
MODULE=$1
if [ "$MODULE" == "iwlagn" ]; then
grep iwl4965 /proc/modules 2>&1 > /dev/null
if [ $? -eq 0 ]; then
echo Unloading $i...
modprobe -r --ignore-remove iwl4965
fi
# Enables both b43 and b43legacy
iwl-enable iwlagn
modprobe iwlagn
CHECK=`modprobe -l iwlagn`
if [ ! -z $CHECK ]; then
echo "iwlagn loaded successfully"
fi
elif [ "$MODULE" == "iwl4965" ]; then
CHECK=`modprobe -l iwlagn`
if [ ! -z $CHECK ]; then
echo "iwlagn currently loaded, going to try to unload the module..."
modprobe -r --ignore-remove iwlagn
fi
iwl-enable iwl4965
# iwl4965 may be loaded already lets remove it first
modprobe -r --ignore-remov iwl4965 2>&1 > /dev/null
modprobe iwl4965
CHECK=`modprobe -l iwl4965`
if [ ! -z $CHECK ]; then
echo "iwl4965 loaded successfully!"
fi
else
echo "$USAGE"
exit
fi