Advertising
- Someone
- Monday, April 9th, 2007 at 3:47:11pm MDT
- #!/bin/sh
- #
- # Firmware-specific hotplug policy agent.
- #
- # Kernel firmware hotplug params include:
- #
- # ACTION=%s [add or remove]
- # DEVPATH=%s [in 2.5 kernels, /sys/$DEVPATH]
- # FIRMWARE=%s
- #
- # HISTORY:
- #
- # 24-Jul-2003 Initial version of new hotplug agent.
- #
- # $Id: firmware.agent,v 1.3 2004/03/14 15:52:56 ukai Exp $
- #
- cd /etc/hotplug
- . ./hotplug.functions
- load() {
- echo 1 > $SYSFS/$DEVPATH/loading
- cat $1″ > $SYSFS/$DEVPATH/data
- echo 0 > $SYSFS/$DEVPATH/loading
- exit
- }
- # DEBUG=yes export DEBUG
- # directories with the firmware files
- FIRMWARE_DIRS=/lib/hotplug/firmware /usr/local/lib/hotplug/firmware /usr/lib/hotplug/firmware
- # mountpoint of sysfs
- SYSFS=$(sed -n s/^.* \([^ ]*\) sysfs .*$/\1/p /proc/mounts | sed -e 2,$d)
- # use /proc for 2.4 kernels
- if [ $SYSFS = ]; then
- SYSFS=/proc
- fi
- VERSION=$(uname -r)
- #
- # What to do with this firmware hotplug event?
- #
- case $ACTION in
- add)
- counter=5
- while [ ! -e $SYSFS/$DEVPATH/loading -a $counter -gt 0 ]; do
- sleep 1
- counter=$(($counter - 1))
- done
- if [ $counter -eq 0 ]; then
- mesg $SYSFS/$DEVPATH/ does not exist
- exit 1
- fi
- for DIR in $FIRMWARE_DIRS; do
- if [ -e $DIR/$FIRMWARE-$VERSION ]; then
- load $DIR/$FIRMWARE-$VERSION
- elif [ -e $DIR/$FIRMWARE ]; then
- load $DIR/$FIRMWARE
- fi
- done
- # the firmware was not found
- echo -1 > $SYSFS/$DEVPATH/loading
- ;;
- remove)
- ;;
- *)
- mesg Firmware $ACTION event not supported
- exit 1
- ;;
- esac
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.