nixpkgs-suyu/upstart-jobs/udev-firmware-loader.sh
Eelco Dolstra 2bff886ae1 * Udev rules/script to load device firmware automatically. The udev
job takes a list of firmware directories in which to search for
  firmware files.  Right now this is just the Intel 2200 firmware (if
  enabled).

svn path=/nixos/trunk/; revision=8162
2007-03-03 23:20:08 +00:00

30 lines
725 B
Bash
Executable file

#! @shell@
export PATH="@path@"
exec > /var/log/udev-fw 2>&1
if test "$ACTION" = "add"; then
ls -l /sys/$DEVPATH >> /tmp/fw 2>&1
if ! test -e /sys/$DEVPATH/loading; then
echo "Firmware loading is not supported by device \`DEVPATH'."
exit 1
fi
for dir in @firmwareDirs@; do
if test -e "$dir/$FIRMWARE"; then
echo "Loading \`$FIRMWARE' for device \`$DEVPATH' from $dir."
echo 1 > /sys/$DEVPATH/loading
cat "$dir/$FIRMWARE" > /sys/$DEVPATH/data
echo 0 > /sys/$DEVPATH/loading
exit 0
fi
done
echo "Firmware \`$FIRMWARE' for device \`$DEVPATH' not found."
echo -1 > /sys/$DEVPATH/loading
exit 1
fi