1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-11-01 09:21:11 +03:00
systemd-stable/extras/firmware/firmware.sh

28 lines
563 B
Bash
Raw Normal View History

#!/bin/sh -e
FIRMWARE_DIRS="/lib/firmware /usr/local/lib/firmware"
err() {
echo "$@" >&2
if type logger >/dev/null; then
logger -t "${0##*/}[$$]" "$@"
fi
}
if [ ! -e /sys$DEVPATH/loading ]; then
err "udev firmware loader misses sysfs directory"
exit 1
fi
for DIR in $FIRMWARE_DIRS; do
[ -e "$DIR/$FIRMWARE" ] || continue
2006-07-11 16:16:59 +04:00
echo 1 > /sys$DEVPATH/loading
cat "$DIR/$FIRMWARE" > /sys$DEVPATH/data
echo 0 > /sys$DEVPATH/loading
exit 0
done
2006-07-11 16:16:59 +04:00
echo -1 > /sys$DEVPATH/loading
err "Cannot find firmware file '$FIRMWARE'"
exit 1