3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/upstart-jobs/udev-firmware-loader.sh
Eelco Dolstra cfed953b5f * Option to enable the Intel 3945 firmware. (It's enabled by
default since it doesn't seem to have the legal issues of
  the Intel 2200 firmware.)
* Firmware loader: don't write in /tmp.  Also a hack to quickly
  test new firmwares.
* Revert r10105 since the build fails if configuration.nix 
  is a symlink.  Anyway copying configuration.nix does not
  necessarily make sense since it can import other expressions,
  which would also have to be copied.  Perhaps a better 
  approach would be to write a serialisation of the config
  to a file (maybe with builtins.toXML).

svn path=/nixos/trunk/; revision=10127
2008-01-12 22:53:13 +00:00

33 lines
820 B
Bash
Executable file

#! @shell@
export PATH="@path@"
exec > /var/log/udev-fw 2>&1
if test "$ACTION" = "add"; then
ls -l /sys/$DEVPATH
if ! test -e /sys/$DEVPATH/loading; then
echo "Firmware loading is not supported by device \`DEVPATH'."
exit 1
fi
# /root/test-firmware is an impure location allowing quick testing
# of firmwares.
for dir in /root/test-firmware @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