2005-11-07 03:12:51 +02:00
|
|
|
#!/bin/sh
|
2006-06-27 03:36:13 +03:00
|
|
|
# Copyright (C) 2006 OpenWrt.org
|
2006-04-05 05:09:22 +03:00
|
|
|
|
2007-03-31 03:59:49 +03:00
|
|
|
export HOTPLUG_TYPE="$1"
|
|
|
|
|
2006-04-05 05:09:22 +03:00
|
|
|
# bypass the normal hotplug path for firmware loading
|
|
|
|
# would otherwise cause problems with drivers like bcm43xx
|
2009-10-03 14:28:02 +03:00
|
|
|
[ -d /sys/firmware -a "firmware" = "$HOTPLUG_TYPE" -a "add" = "$ACTION" ] && {
|
2006-01-05 03:20:44 +02:00
|
|
|
[ -f "/lib/firmware/$FIRMWARE" ] && {
|
|
|
|
echo 1 > "/sys$DEVPATH/loading"
|
2009-12-08 22:04:38 +02:00
|
|
|
dd if="/lib/firmware/$FIRMWARE" of="/sys$DEVPATH/data" bs=64k
|
2006-01-05 03:20:44 +02:00
|
|
|
echo 0 > "/sys$DEVPATH/loading"
|
2010-04-01 18:22:13 +03:00
|
|
|
} || echo -1 > "/sys$DEVPATH/loading"
|
2006-01-05 03:20:44 +02:00
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
2005-11-07 04:18:59 +02:00
|
|
|
. /etc/functions.sh
|
|
|
|
|
2005-11-07 03:12:51 +02:00
|
|
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin
|
|
|
|
LOGNAME=root
|
|
|
|
USER=root
|
|
|
|
export PATH LOGNAME USER
|
|
|
|
|
|
|
|
[ \! -z "$1" -a -d /etc/hotplug.d/$1 ] && {
|
|
|
|
for script in $(ls /etc/hotplug.d/$1/* 2>&-); do (
|
|
|
|
[ -f $script ] && . $script
|
|
|
|
); done
|
|
|
|
}
|