2006-05-28 15:23:32 +07:00
|
|
|
#!/bin/sh -e
|
|
|
|
|
2008-08-30 02:00:43 +07:00
|
|
|
FIRMWARE_DIRS="/lib/firmware/$(uname -r) /lib/firmware"
|
2006-05-28 15:23:32 +07:00
|
|
|
|
|
|
|
err() {
|
2007-10-16 05:54:14 +07:00
|
|
|
echo "$@" >&2
|
|
|
|
logger -t "${0##*/}[$$]" "$@" 2>/dev/null || true
|
2006-05-28 15:23:32 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
if [ ! -e /sys$DEVPATH/loading ]; then
|
2007-10-16 05:54:14 +07:00
|
|
|
err "udev firmware loader misses sysfs directory"
|
|
|
|
exit 1
|
2006-05-28 15:23:32 +07:00
|
|
|
fi
|
|
|
|
|
|
|
|
for DIR in $FIRMWARE_DIRS; do
|
2007-10-16 05:54:14 +07:00
|
|
|
[ -e "$DIR/$FIRMWARE" ] || continue
|
|
|
|
echo 1 > /sys$DEVPATH/loading
|
|
|
|
cat "$DIR/$FIRMWARE" > /sys$DEVPATH/data
|
|
|
|
echo 0 > /sys$DEVPATH/loading
|
|
|
|
exit 0
|
2006-05-28 15:23:32 +07:00
|
|
|
done
|
|
|
|
|
2006-07-11 19:16:59 +07:00
|
|
|
echo -1 > /sys$DEVPATH/loading
|
2006-05-28 15:23:32 +07:00
|
|
|
err "Cannot find firmware file '$FIRMWARE'"
|
2008-11-05 00:38:06 +07:00
|
|
|
mkdir -p /dev/.udev/firmware-missing
|
|
|
|
file=$(echo "$FIRMWARE" | sed 's:/:\\x2f:g')
|
|
|
|
ln -s -f "$DEVPATH" /dev/.udev/firmware-missing/$file
|
2006-05-28 15:23:32 +07:00
|
|
|
exit 1
|