Merge pull request #21227 from lheckemann/vgaswitcheroo

amd-hybrid-graphics: fix race condition
This commit is contained in:
Joachim F 2017-04-28 12:47:00 +01:00 committed by GitHub
commit 0c40ea7340
1 changed files with 11 additions and 4 deletions

View File

@ -25,15 +25,22 @@
path = [ pkgs.bash ]; path = [ pkgs.bash ];
description = "Disable AMD Card"; description = "Disable AMD Card";
after = [ "sys-kernel-debug.mount" ]; after = [ "sys-kernel-debug.mount" ];
requires = [ "sys-kernel-debug.mount" ]; before = [ "systemd-vconsole-setup.service" "display-manager.service" ];
wantedBy = [ "multi-user.target" ]; requires = [ "sys-kernel-debug.mount" "vgaswitcheroo.path" ];
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
RemainAfterExit = true; RemainAfterExit = true;
ExecStart = "${pkgs.bash}/bin/sh -c 'echo -e \"IGD\\nOFF\" > /sys/kernel/debug/vgaswitcheroo/switch; exit 0'"; ExecStart = "${pkgs.bash}/bin/sh -c 'echo -e \"IGD\\nOFF\" > /sys/kernel/debug/vgaswitcheroo/switch'";
ExecStop = "${pkgs.bash}/bin/sh -c 'echo ON >/sys/kernel/debug/vgaswitcheroo/switch; exit 0'"; ExecStop = "${pkgs.bash}/bin/sh -c 'echo ON >/sys/kernel/debug/vgaswitcheroo/switch'";
}; };
}; };
systemd.paths."vgaswitcheroo" = {
pathConfig = {
PathExists = "/sys/kernel/debug/vgaswitcheroo/switch";
Unit = "amd-hybrid-graphics.service";
};
wantedBy = ["multi-user.target"];
};
}; };
} }