interface names, use udev's own firmware loader, and dropped the sndMode option (udev puts all audio devices in the "audio" group, so users can be added to that group if necessary). svn path=/nixos/trunk/; revision=16692wip/yesman
parent
25dbf1594e
commit
dc093b57dd
@ -1,51 +0,0 @@ |
||||
# This module provides support for automatic loading of firmware from |
||||
# kernel modules. |
||||
{pkgs, config, ...}: |
||||
|
||||
with pkgs.lib; |
||||
|
||||
let |
||||
|
||||
firmwareLoader = pkgs.substituteAll { |
||||
src = ./udev-firmware-loader.sh; |
||||
path = "${pkgs.coreutils}/bin"; |
||||
isExecutable = true; |
||||
firmwareDirs = config.hardware.firmware; |
||||
}; |
||||
|
||||
in |
||||
|
||||
{ |
||||
|
||||
###### interface |
||||
|
||||
options = { |
||||
|
||||
hardware.firmware = mkOption { |
||||
default = []; |
||||
example = ["/root/my-firmware"]; |
||||
merge = mergeListOption; |
||||
description = '' |
||||
List of directories containing firmware files. Such files |
||||
will be loaded automatically if the kernel asks for them |
||||
(i.e., when it has detected specific hardware that requires |
||||
firmware to function). |
||||
''; |
||||
}; |
||||
|
||||
}; |
||||
|
||||
|
||||
###### implementation |
||||
|
||||
config = { |
||||
|
||||
services.udev.extraRules = |
||||
'' |
||||
# Firmware loading. |
||||
SUBSYSTEM=="firmware", ACTION=="add", RUN+="${firmwareLoader}" |
||||
''; |
||||
|
||||
}; |
||||
|
||||
} |
@ -1,32 +0,0 @@ |
||||
#! @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 |
Loading…
Reference in new issue