blob: 60bb187f5a991fefdadf6dfbdd839eb13c3cc91d (
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
if [ -x /bin/cat ]; then
cat="/bin/cat"
else
exit 3
fi
if [ -x /usr/bin/logger ]; then
out="/usr/bin/logger"
else
out="echo"
fi
if [ -z "${SUBSYSTEM}" -o -z "${ACTION}" -o -z "${FIRMWARE}" -o -z "${DEVPATH}" ]; then
$out "$0: Missing essential enviroment variable(s)"
exit 1
fi
$out "$0: Running firmware script"
$out "$0: FIRMWARE(${FIRMWARE}) ACTION(${ACTION}) SUBSYSTEM(${SUBSYSTEM})"
FW_NAME=${FIRMWARE}
FW_PATH=
case $FW_NAME in
/lib/firmware/*)
break;;
*.bin|*.hex)
FW_PATH="/lib/firmware/${FW_NAME}"
break;;
*)
FW_PATH="/lib/firmware/${FW_NAME}.bin"
break;;
esac
if [ ! -r ${FW_PATH} ]; then
$out "$0: Firmware ${FW_PATH} does not exist"
exit 2
fi
case $SUBSYSTEM in
firmware)
break;;
*)
exit 1
break;;
esac
case $ACTION in
add)
$out "$0: Loading ${FW_PATH} -> /sys${DEVPATH} .."
echo 1 > /sys${DEVPATH}/loading
$cat ${FW_PATH} > /sys${DEVPATH}/data
echo 0 > /sys${DEVPATH}/loading
break;;
esac
exit 0
|