diff options
author | root <root@artemis.panaceas.org> | 2015-12-25 15:00:15 +0000 |
---|---|---|
committer | root <root@artemis.panaceas.org> | 2015-12-25 15:00:15 +0000 |
commit | ddd86436f4e3643c04b797f858dab95d5f2e4de9 (patch) | |
tree | bfe7a780cf9a2f4fc33aec32c82e625e79dece1f /udev/compat_firmware.sh | |
download | backports-3.10.19-1-ddd86436f4e3643c04b797f858dab95d5f2e4de9.tar.gz backports-3.10.19-1-ddd86436f4e3643c04b797f858dab95d5f2e4de9.tar.bz2 backports-3.10.19-1-ddd86436f4e3643c04b797f858dab95d5f2e4de9.zip |
Diffstat (limited to 'udev/compat_firmware.sh')
-rwxr-xr-x | udev/compat_firmware.sh | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/udev/compat_firmware.sh b/udev/compat_firmware.sh new file mode 100755 index 0000000..ef609e7 --- /dev/null +++ b/udev/compat_firmware.sh @@ -0,0 +1,35 @@ +#!/bin/sh -e + +# This is ported from Ubuntu but ubuntu uses these directories which +# other distributions don't care about: +# FIRMWARE_DIRS="/lib/firmware/updates/$(uname -r) /lib/firmware/updates \ +# /lib/firmware/$(uname -r) /lib/firmware" +# If your distribution looks for firmware in other directories +# feel free to extend this and add your own directory here. +# +FIRMWARE_DIRS="/lib/firmware" + +err() { + echo "$@" >&2 + logger -t "${0##*/}[$$]" "$@" 2>/dev/null || true +} + +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 + echo 1 > /sys$DEVPATH/loading + cat "$DIR/$FIRMWARE" > /sys$DEVPATH/data + echo 0 > /sys$DEVPATH/loading + exit 0 +done + +echo -1 > /sys$DEVPATH/loading +err "Cannot find firmware file '$FIRMWARE'" +mkdir -p /dev/.udev/firmware-missing +file=$(echo "$FIRMWARE" | sed 's:/:\\x2f:g') +ln -s -f "$DEVPATH" /dev/.udev/firmware-missing/$file +exit 1 |