M7350/external/compat-wireless/scripts/b43load
2024-09-09 08:52:07 +00:00

66 lines
1.5 KiB
Bash
Executable File

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