From 788122c3c5dcd146f65fbd587972b22f5ff8481e Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Thu, 21 Apr 2016 21:35:41 -0500 Subject: [PATCH] facetimehd: Only unload module if it is loaded The pre-sleep service exits if any command fails. Unloading facetimehd without it being loaded blocks subsequent commands from running. Note: `modprobe -r` works a bit better when unloading unused modules, and is preferrable to `rmmod`. However, the facetimehd module does not support suspending. In this case, it seems preferable to forcefully unload the module. `modprobe` does not support a `--force` flag when removing, so we are left with `rmmod`. See: - https://github.com/NixOS/nixpkgs/pull/14883 - https://github.com/patjak/bcwc_pcie/wiki#known-issues --- nixos/modules/hardware/video/webcam/facetimehd.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/hardware/video/webcam/facetimehd.nix b/nixos/modules/hardware/video/webcam/facetimehd.nix index 309cedca48ba..2a2fcf3057d4 100644 --- a/nixos/modules/hardware/video/webcam/facetimehd.nix +++ b/nixos/modules/hardware/video/webcam/facetimehd.nix @@ -31,7 +31,7 @@ in # unload module during suspend/hibernate as it crashes the whole system powerManagement.powerDownCommands = '' - ${pkgs.kmod}/bin/rmmod -f facetimehd + ${pkgs.kmod}/bin/lsmod | ${pkgs.gnugrep}/bin/grep -q "^facetimehd" && ${pkgs.kmod}/bin/rmmod -f -v facetimehd ''; # and load it back on resume