mirror of
https://github.com/pentoo/pentoo-overlay
synced 2026-04-30 10:41:01 +02:00
added in athload to control madwifi vs ath5k battles
This commit is contained in:
parent
66c0454096
commit
6bbfdd9a26
6 changed files with 274 additions and 0 deletions
5
net-wireless/athload/Manifest
Normal file
5
net-wireless/athload/Manifest
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
AUX athenable 895 RMD160 d7f30626f1c411cabfdf8b5c8f4a08a15abe0886 SHA1 fe8209a9444354052717a3b3f61362e0cf41c33f SHA256 aacf46d8729f1392b2cf15d99312aae5a73d81f563e9adb4e0e1481e567b7a24
|
||||
AUX athload 1070 RMD160 fd394d7e83b16986ea326fbd34422faf9e6a7806 SHA1 78198f080b94a3a85b3cc3990e425e784a873ead SHA256 5253a09e975e0eeb107a4d4273912ede2437087c908e283654708862cab95027
|
||||
AUX madwifi-unload 1146 RMD160 afb04cc417badafed28265e9453d834ff67fb842 SHA1 8f129ffc2d417152ca8427cbe96f2630fb816fbc SHA256 c0b74eab3a6496187d03124aca0892a5ccc3ea9eaf008ab668bd21f17ef70404
|
||||
AUX modlib.sh 2564 RMD160 d4489e8f1af55bd9664dacc79abf9201b1f695a2 SHA1 3a73049d1fe5a92d1a0c79bc4dce303bfc676bdf SHA256 449ac7a3dc4fe75b6ac16a8e992d772eba2a89898c67298e17e33f6a17a96ec0
|
||||
EBUILD athload-2009.01.23.ebuild 696 RMD160 9a74c0d300a14cdaf75b5dffa130ac9613ea4183 SHA1 925ec2d23f6905d4fc8e65584b3d25b78df91419 SHA256 b0a711d404a02ebde8223b4df99be438ba912bc2d20fbb733e21a7c305a05df3
|
||||
29
net-wireless/athload/athload-2009.01.23.ebuild
Normal file
29
net-wireless/athload/athload-2009.01.23.ebuild
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
# Copyright 1999-2005 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: $
|
||||
|
||||
DESCRIPTION="athload scripts ripped from compat-wireless"
|
||||
HOMEPAGE="http://wireless.kernel.org/"
|
||||
#SRC_URI="${FILESDIR}/athload \
|
||||
# ${FILESDIR}/modlib.sh \
|
||||
# ${FILESDIR}/athenable \
|
||||
# ${FILESDIR}/madwifi-unload \
|
||||
# "
|
||||
|
||||
LICENSE="GPL-2"
|
||||
SLOT="0"
|
||||
KEYWORDS="x86 amd64"
|
||||
IUSE=""
|
||||
|
||||
src_install() {
|
||||
# einstall || die "einstall failed"
|
||||
dodir /usr/sbin
|
||||
insinto /usr/sbin
|
||||
doins ${FILESDIR}/athload
|
||||
doins ${FILESDIR}/athenable
|
||||
doins ${FILESDIR}/madwifi-unload
|
||||
|
||||
dodir /usr/lib/compat-wireless
|
||||
insinto /usr/lib/compat-wireless
|
||||
doins ${FILESDIR}/modlib.sh
|
||||
}
|
||||
42
net-wireless/athload/files/athenable
Normal file
42
net-wireless/athload/files/athenable
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
|
||||
#
|
||||
# Makes sure either ath5k or MadWifi are ready 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
|
||||
|
||||
ATH5K="ath5k"
|
||||
MADWIFI="ath_pci"
|
||||
# Appended to module file at the end when we want to ignore one
|
||||
IGNORE_SUFFIX=".ignore"
|
||||
USAGE="Usage: $0 [ ath5k | madwifi ]"
|
||||
|
||||
# Default behavior: disables any MadWifi driver present and makes sure
|
||||
# ath5k is enabled
|
||||
if [ $# -eq 0 ]; then
|
||||
module_disable $MADWIFI
|
||||
module_enable $ATH5K
|
||||
exit
|
||||
elif [ $# -ne 1 ]; then
|
||||
echo "$USAGE"
|
||||
exit
|
||||
fi
|
||||
|
||||
MODULE=$1
|
||||
if [ "$MODULE" == "ath5k" ]; then
|
||||
module_disable $MADWIFI
|
||||
module_enable $ATH5K
|
||||
elif [ "$MODULE" == "madwifi" ]; then
|
||||
module_disable $ATH5K
|
||||
module_enable $MADWIFI
|
||||
else
|
||||
echo "$USAGE"
|
||||
exit
|
||||
fi
|
||||
52
net-wireless/athload/files/athload
Normal file
52
net-wireless/athload/files/athload
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
#!/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
|
||||
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
|
||||
58
net-wireless/athload/files/madwifi-unload
Normal file
58
net-wireless/athload/files/madwifi-unload
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
#!/bin/sh
|
||||
# Copyright 2006 Kel Modderman <kelrin@tpg.com.au>
|
||||
#
|
||||
# Taken from madwifi scripts. This unloads madwifi
|
||||
|
||||
: ${PATTERN='\(ath_.*\|wlan_.*\|wlan\)$'}
|
||||
: ${MAX_TRIES=10}
|
||||
|
||||
test "`id -u`" = 0 || {
|
||||
echo "ERROR: You must be root to run this script" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
test -r /proc/modules || {
|
||||
echo "ERROR: Cannot read /proc/modules" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
tries="$MAX_TRIES"
|
||||
while test "$tries" != "0"; do
|
||||
skipped=0
|
||||
IFS='
|
||||
'
|
||||
for line in `cat /proc/modules`; do
|
||||
IFS=' '
|
||||
set x $line
|
||||
name="$2"
|
||||
size="$3"
|
||||
use_count="$4"
|
||||
use_name="$5"
|
||||
state="$6"
|
||||
expr "$name" : "$PATTERN" >/dev/null || continue
|
||||
|
||||
# Compatibility for Linux 2.4.x
|
||||
test -z "$state" && { use_name="-"; state="Live"; }
|
||||
|
||||
if test "$state" != "Live" || test "$use_count" != "0" || \
|
||||
test "$use_name" != "-"; then
|
||||
# Don't skip unload in the last run
|
||||
if test "$tries" != "1"; then
|
||||
skipped=1
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Unloading \"$name\""
|
||||
sync # to be safe
|
||||
/sbin/rmmod "$name" || {
|
||||
echo "ERROR: cannot unload module \"$name\"" >&2
|
||||
exit 1
|
||||
}
|
||||
sync # to be even safer
|
||||
done
|
||||
test "$skipped" = "0" && break
|
||||
tries=$(($tries - 1))
|
||||
done
|
||||
|
||||
exit 0
|
||||
88
net-wireless/athload/files/modlib.sh
Normal file
88
net-wireless/athload/files/modlib.sh
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
|
||||
#
|
||||
# You can use these to enable/disable modules without blacklisting them
|
||||
|
||||
# Make sure our imporant paths are included
|
||||
PATH=$PATH:/usr/sbin:/sbin
|
||||
|
||||
# Appended to module file at the end when we want to ignore one
|
||||
IGNORE_SUFFIX=".ignore"
|
||||
VER=`uname -r`
|
||||
|
||||
# If 'module' is found, its renamed to 'module.ignore'
|
||||
function module_disable {
|
||||
# Basic check to see if this is a module available for loading
|
||||
MODULE_CHECK=`modprobe -l $1`
|
||||
if [ -z $MODULE_CHECK ]; then
|
||||
echo "Module $1 not detected -- this is fine"
|
||||
return
|
||||
fi
|
||||
MODULE=$1
|
||||
MODULE_KO=${MODULE}.ko
|
||||
# In case there are more than one of these modules. This can
|
||||
# happen, for example if your distribution provides one and you have
|
||||
# compiled one in yourself later.
|
||||
MODULE_COUNT=`find /lib/modules/$VER/ -name $MODULE_KO | wc -l`
|
||||
ALL_MODULES=`find /lib/modules/$VER/ -name $MODULE_KO`
|
||||
COUNT=1
|
||||
CHECK=`modprobe -l $MODULE`
|
||||
while [ ! -z $CHECK ]; do
|
||||
if [[ $MODULE_COUNT -gt 1 ]]; then
|
||||
if [[ $COUNT -eq 1 ]]; then
|
||||
echo -en "$MODULE_COUNT $MODULE modules found "
|
||||
echo -e "we'll disable all of them"
|
||||
fi
|
||||
echo -en "Disabling $MODULE ($COUNT) ..."
|
||||
else
|
||||
echo -en "Disabling $MODULE ..."
|
||||
fi
|
||||
mv -f $CHECK ${CHECK}${IGNORE_SUFFIX}
|
||||
depmod -ae
|
||||
CHECK_AGAIN=`modprobe -l $MODULE`
|
||||
if [ "$CHECK" != "$CHECK_AGAIN" ]; then
|
||||
echo -e "\t[OK]\tModule disabled:"
|
||||
echo "$CHECK"
|
||||
else
|
||||
echo -e "[ERROR]\tModule is still being detected:"
|
||||
echo "$CHECK"
|
||||
fi
|
||||
let COUNT=$COUNT+1
|
||||
CHECK=$CHECK_AGAIN
|
||||
done
|
||||
}
|
||||
|
||||
# If 'module.ignore' is found, rename it back to 'module'
|
||||
function module_enable {
|
||||
MODULE=$1
|
||||
MODULE_KO=${MODULE}.ko
|
||||
IGNORED_MODULE=${MODULE_KO}${IGNORE_SUFFIX}
|
||||
# In case there are more than one of these modules. This can
|
||||
# happen, for example if your distribution provides one and you have
|
||||
# compiled one in yourself later.
|
||||
ALL_MODULES=`find /lib/modules/$VER/ -name $IGNORED_MODULE`
|
||||
for i in $ALL_MODULES; do
|
||||
echo -en "Enabling $MODULE ..."
|
||||
DIR=`dirname $i`
|
||||
mv $i $DIR/$MODULE_KO
|
||||
depmod -ae
|
||||
CHECK=`modprobe -l $MODULE`
|
||||
if [ "$DIR/$MODULE_KO" != $CHECK ]; then
|
||||
if [ -z $CHECK ]; then
|
||||
echo -e "\t[ERROR]\tModule could not be enabled"
|
||||
else
|
||||
echo -en "\t[OK]\tModule renamed but another "
|
||||
echo "module file is being preferred"
|
||||
echo -e "Renamed module:\t\t$DIR/$MODULE_KO"
|
||||
echo -e "Preferred module:\t$CHECK"
|
||||
fi
|
||||
else
|
||||
echo -e "\t[OK]\tModule enabled: "
|
||||
echo "$DIR/$MODULE_KO"
|
||||
fi
|
||||
# Lets only do this for the first module found
|
||||
break
|
||||
done
|
||||
}
|
||||
|
||||
Loading…
Reference in a new issue