mirror of
				https://github.com/NixOS/nixos-hardware.git
				synced 2025-11-04 17:27:14 +08:00 
			
		
		
		
	gigabyte b550: suspend fix (#884)
fixes b550 suspend bug by setting up systemd services that disable GPP0 and GPP8 in /proc/acpi/wakeup Co-authored-by: Jörg Thalheim <Mic92@users.noreply.github.com>
This commit is contained in:
		
							
								
								
									
										35
									
								
								gigabyte/b550/b550-fix-suspend.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								gigabyte/b550/b550-fix-suspend.nix
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
			
		||||
{ pkgs, lib, ... } :
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
  systemd.services.bugfixSuspend-GPP0 = {
 | 
			
		||||
    enable            = lib.mkDefault true;
 | 
			
		||||
    description       = "Fix crash on wakeup from suspend/hibernate (b550 bugfix)";
 | 
			
		||||
    unitConfig = {
 | 
			
		||||
      Type            = "oneshot";
 | 
			
		||||
    };
 | 
			
		||||
    serviceConfig = {
 | 
			
		||||
      User            = "root"; # root may not be necessary
 | 
			
		||||
      # check for gppN, disable if enabled
 | 
			
		||||
      # lifted from  https://www.reddit.com/r/gigabyte/comments/p5ewjn/comment/ksbm0mb/ /u/Demotay
 | 
			
		||||
      ExecStart       = "-${pkgs.bash}/bin/bash -c 'if grep 'GPP0' /proc/acpi/wakeup | grep -q 'enabled'; then echo 'GPP0' > /proc/acpi/wakeup; fi'"; 
 | 
			
		||||
      RemainAfterExit = "yes";  # required to not toggle when `nixos-rebuild switch` is ran
 | 
			
		||||
      
 | 
			
		||||
    };
 | 
			
		||||
    wantedBy = ["multi-user.target"];
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  systemd.services.bugfixSuspend-GPP8 = {
 | 
			
		||||
    enable            = lib.mkDefault true;
 | 
			
		||||
    description       = "Fix crash on wakeup from suspend/hibernate (b550 bugfix)";
 | 
			
		||||
    unitConfig = {
 | 
			
		||||
      Type            = "oneshot";
 | 
			
		||||
    };
 | 
			
		||||
    serviceConfig = {
 | 
			
		||||
      User            = "root";
 | 
			
		||||
      ExecStart       = "-${pkgs.bash}/bin/bash -c 'if grep 'GPP8' /proc/acpi/wakeup | grep -q 'enabled'; then echo 'GPP8' > /proc/acpi/wakeup; fi''";
 | 
			
		||||
      RemainAfterExit = "yes";
 | 
			
		||||
    };
 | 
			
		||||
    wantedBy = ["multi-user.target"];
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user