home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2007 January, February, March & April
/
Chip-Cover-CD-2007-02.iso
/
boot
/
i386
/
rescue
/
lib
/
udev
/
trigger_firmware_loading.sh
< prev
next >
Wrap
Linux/UNIX/POSIX Shell Script
|
2006-11-29
|
971b
|
40 lines
#! /bin/bash
. /etc/sysconfig/hardware/scripts/functions
NOMAC_HACK_APPLIED=no
trap 'echo NOMAC_HACK_APPLIED=$NOMAC_HACK_APPLIED
echo ADDRESS=$MAC_ADDRESS' EXIT
case "$1" in
eth*|ath*|wlan*|ra*) : ;;
*) exit 0 ;;
esac
MAC_ADDRESS=
if ls /sys/class/net/$1 2>/dev/null 1>&2; then
MAC_ADDRESS=`cat /sys/class/net/$INTERFACE/address`
fi
if [ -z "$MAC_ADDRESS" ] ; then
exit 0
fi
if [ "${MAC_ADDRESS%00:00:00}" != "$MAC_ADDRESS" ] ; then
# Workaround for some drivers which don't request their
# firmware before beeing set up and don't have a mac address
# before firmware was loaded.
ip link set up dev $INTERFACE
ip link set down dev $INTERFACE
# Do we have to wait some time?
for i in 0 1 2 3 4 5 6 7 8 9; do
MAC_ADDRESS=`cat /sys/class/net/$INTERFACE/address`
info_mesg "waiting for a usefull mac address: $MAC_ADDRESS"
if [ "${MAC_ADDRESS%00:00:00}" != "$MAC_ADDRESS" ] ; then
NOMAC_HACK_APPLIED=yes
break
fi
sleep 1
done
fi
exit 0