blob: 40673a7b74e2291877170e8c6a823a375b67d03c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#!/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.d/firmware
. ./hotplug.functions
# DEBUG=yes export DEBUG
# directory of the firmware files
FIRMWARE_DIR=/lib/firmware
# mountpoint of sysfs
SYSFS=$(sed -n 's/^.* \([^ ]*\) sysfs .*$/\1/p' /proc/mounts)
# use /proc for 2.4 kernels
if [ "$SYSFS" = "" ]; then
SYSFS=/proc
fi
#
# What to do with this firmware hotplug event?
#
case "$ACTION" in
add)
if [ ! -e $SYSFS/$DEVPATH/loading ]; then
sleep 1
fi
if [ -f "$FIRMWARE_DIR/$FIRMWARE" ]; then
echo 1 > $SYSFS/$DEVPATH/loading
cp "$FIRMWARE_DIR/$FIRMWARE" $SYSFS/$DEVPATH/data
echo 0 > $SYSFS/$DEVPATH/loading
else
echo -1 > $SYSFS/$DEVPATH/loading
fi
;;
remove)
;;
*)
mesg "Firmware '$ACTION' event not supported"
exit 1
;;
esac
|