From 2f23879bc165ac0100ccb0ad105358616099d992 Mon Sep 17 00:00:00 2001 From: Cole Deck Date: Sat, 8 Aug 2020 03:50:58 +0000 Subject: [PATCH] Update systemd suspend hook --- acpigpu | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/acpigpu b/acpigpu index 4a1b654..f81cd6f 100755 --- a/acpigpu +++ b/acpigpu @@ -1,15 +1,13 @@ #!/bin/bash -#case "$1" in -# pre) -# /home/cole/g14gpu/gpuon.sh ;; -# post) -# /home/cole/g14gpu/gpuoff.sh ;; -#esac - - if [ "${1}" == "pre" ]; then - bash /home/cole/g14gpu/gpuon.sh + sudo sh -c 'echo "\\_SB.PCI0.GPP0.PG00._ON" > /proc/acpi/call' + sleep 1 # The GPU needs a bit of time to ensure that it's on before suspend elif [ "${1}" == "post" ]; then - bash /home/cole/g14gpu/gpuoff.sh -fi + if xrandr --listproviders | grep NVIDIA; then + echo "GPU is in use for PRIME, keeping on" + else + sudo sh -c 'echo "\\_SB.PCI0.GPP0.PG00._OFF" > /proc/acpi/call' + echo "GPU powered off" + fi +fi \ No newline at end of file