summary refs log tree commit diff
path: root/nixos/modules/hardware/video
diff options
context:
space:
mode:
authorGraham Christensen <graham@grahamc.com>2016-04-21 21:35:41 -0500
committerGraham Christensen <graham@grahamc.com>2016-04-23 09:37:01 -0500
commit788122c3c5dcd146f65fbd587972b22f5ff8481e (patch)
tree730600d47c24ee9aa60966aca6eab0c2001b8a80 /nixos/modules/hardware/video
parenta1b39b9990f2c23f31875a5993441ea686885df3 (diff)
downloadnixlib-788122c3c5dcd146f65fbd587972b22f5ff8481e.tar
nixlib-788122c3c5dcd146f65fbd587972b22f5ff8481e.tar.gz
nixlib-788122c3c5dcd146f65fbd587972b22f5ff8481e.tar.bz2
nixlib-788122c3c5dcd146f65fbd587972b22f5ff8481e.tar.lz
nixlib-788122c3c5dcd146f65fbd587972b22f5ff8481e.tar.xz
nixlib-788122c3c5dcd146f65fbd587972b22f5ff8481e.tar.zst
nixlib-788122c3c5dcd146f65fbd587972b22f5ff8481e.zip
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
Diffstat (limited to 'nixos/modules/hardware/video')
-rw-r--r--nixos/modules/hardware/video/webcam/facetimehd.nix2
1 files changed, 1 insertions, 1 deletions
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