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

58 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
#
# Loads ath5k or madwifi
. /usr/lib/compat-wireless/modlib.sh
if [[ $UID -ne 0 ]]; then
echo "Run with root privileges"
exit
fi
USAGE="Usage: $0 [ ath5k | madwifi ]"
# Default behavior: unload MadWifi and load ath5k
if [ $# -eq 0 ]; then
athenable ath5k
exit
elif [ $# -ne 1 ]; then
echo "$USAGE"
exit
fi
MODULE=$1
if [ "$MODULE" == "ath5k" ]; then
madwifi-unload
athenable ath5k
modprobe ath5k
CHECK=`modprobe -l ath5k`
if [ ! -z $CHECK ]; then
echo "ath5k loaded successfully"
fi
modprobe ath9k
CHECK=`modprobe -l ath9k`
if [ ! -z $CHECK ]; then
echo "ath9k loaded successfully"
fi
elif [ "$MODULE" == "madwifi" ]; then
CHECK=`modprobe -l ath5k`
if [ ! -z $CHECK ]; then
echo "ath5k currently loaded, going to try to unload the module..."
modprobe -r --ignore-remove ath5k
fi
athenable madwifi
# MadWifi may be loaded, but it doesn't mean devices
# currently available were picked up
madwifi-unload 2>&1 > /dev/null
modprobe ath_pci
CHECK=`modprobe -l ath_pci`
if [ ! -z $CHECK ]; then
echo "MadWifi loaded successfully!"
fi
else
echo "$USAGE"
exit
fi