chiark / gitweb /
delete all Makefiles and move udev source to udev/
[elogind.git] / extras / firmware / firmware.sh
1 #!/bin/sh -e
2
3 FIRMWARE_DIRS="/lib/firmware /usr/local/lib/firmware"
4
5 err() {
6         echo "$@" >&2
7         logger -t "${0##*/}[$$]" "$@" 2>/dev/null || true
8 }
9
10 if [ ! -e /sys$DEVPATH/loading ]; then
11         err "udev firmware loader misses sysfs directory"
12         exit 1
13 fi
14
15 for DIR in $FIRMWARE_DIRS; do
16         [ -e "$DIR/$FIRMWARE" ] || continue
17         echo 1 > /sys$DEVPATH/loading
18         cat "$DIR/$FIRMWARE" > /sys$DEVPATH/data
19         echo 0 > /sys$DEVPATH/loading
20         exit 0
21 done
22
23 echo -1 > /sys$DEVPATH/loading
24 err "Cannot find  firmware file '$FIRMWARE'"
25 exit 1