Last active
January 4, 2018 14:06
-
-
Save robinmarlow/9ee9e231ba810b6a5769 to your computer and use it in GitHub Desktop.
/usr/lib/systemd/system-sleep/99-resume_script.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# run on wakeup | |
case "$1" in | |
hibernate|suspend) | |
;; | |
pre) | |
modprobe -r bcm5974 | |
echo '*disable XHC1' >/proc/acpi/wakeup | |
echo '*disable ARPT' >/proc/acpi/wakeup | |
if cat /proc/acpi/wakeup | grep -qE '^LID0.*enabled' | |
then | |
grep -qE '^state: *open$' /proc/acpi/button/lid/LID0/state \ | |
&& echo LID0 > /proc/acpi/wakeup | |
logger "lid open" | |
else | |
grep -qE '^state: *closed$' /proc/acpi/button/lid/LID0/state \ | |
&& echo LID0 > /proc/acpi/wakeup | |
logger "lid shut" | |
fi | |
#sleep 10 | |
logger "coffee needed, going to sleep" | |
;; | |
post) | |
modprobe bcm5974 | |
echo disable XHC1 >/proc/acpi/wakeup | |
echo disable ARPT >/proc/acpi/wakeup | |
#echo '*enable LID0' >/proc/acpi/wakeup | |
if cat /proc/acpi/wakeup | grep -qE '^LID0.*enabled' | |
then | |
grep -qE '^state: *open$' /proc/acpi/button/lid/LID0/state \ | |
&& echo LID0 > /proc/acpi/wakeup | |
logger "lid open" | |
else | |
grep -qE '^state: *closed$' /proc/acpi/button/lid/LID0/state \ | |
&& echo LID0 > /proc/acpi/wakeup | |
logger "lid shut" | |
fi | |
logger "coffee needed, waking up" | |
;; | |
*) | |
logger "script called but nor pre or post" | |
exit $NA | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment