mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-19 20:23:02 +00:00
9802ed58ee
automatically. Of course this should be triggered when a USB device is plugged in (from udev). svn path=/nixos/trunk/; revision=10451
29 lines
723 B
Nix
29 lines
723 B
Nix
{modprobe, doHardwareScan, kernelModules}:
|
|
|
|
{
|
|
name = "hardware-scan";
|
|
|
|
job = ''
|
|
start on udev
|
|
|
|
script
|
|
for i in ${toString kernelModules}; do
|
|
echo "Loading kernel module $i..."
|
|
${modprobe}/sbin/modprobe $i || true
|
|
done
|
|
|
|
if test -n "${toString doHardwareScan}" -a ! -e /var/run/safemode; then
|
|
|
|
# Try to load modules for all PCI and USB devices.
|
|
for i in /sys/bus/pci/devices/*/modalias /sys/bus/usb/devices/*/modalias; do
|
|
echo "Trying to load a module for $(basename $(dirname $i))..."
|
|
${modprobe}/sbin/modprobe $(cat $i) || true
|
|
echo ""
|
|
done
|
|
|
|
fi
|
|
end script
|
|
'';
|
|
|
|
}
|