[package] base-files: Cancel firmware loading if file doesn't exist
[openwrt.git] / package / base-files / files / sbin / hotplug-call
1 #!/bin/sh
2 # Copyright (C) 2006 OpenWrt.org
3
4 export HOTPLUG_TYPE="$1"
5
6 # bypass the normal hotplug path for firmware loading
7 # would otherwise cause problems with drivers like bcm43xx
8 [ -d /sys/firmware -a "firmware" = "$HOTPLUG_TYPE" -a "add" = "$ACTION" ] && {
9 [ -f "/lib/firmware/$FIRMWARE" ] && {
10 echo 1 > "/sys$DEVPATH/loading"
11 dd if="/lib/firmware/$FIRMWARE" of="/sys$DEVPATH/data" bs=64k
12 echo 0 > "/sys$DEVPATH/loading"
13 } || echo -1 > "/sys$DEVPATH/loading"
14 exit 0
15 }
16
17 . /etc/functions.sh
18
19 PATH=/bin:/sbin:/usr/bin:/usr/sbin
20 LOGNAME=root
21 USER=root
22 export PATH LOGNAME USER
23
24 [ \! -z "$1" -a -d /etc/hotplug.d/$1 ] && {
25 for script in $(ls /etc/hotplug.d/$1/* 2>&-); do (
26 [ -f $script ] && . $script
27 ); done
28 }
This page took 0.04219 seconds and 5 git commands to generate.