Created
April 13, 2016 12:40
-
-
Save baszoetekouw/291a7d4898a77822861fd6d3bd3f57b5 to your computer and use it in GitHub Desktop.
script that works both in /etc/pm/sleep.d and /lib/systemd/system-sleep
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 | |
set -e | |
# support both /etc/pm/sleep.d and /lib/systemd/system/sleep arguments | |
if [ -z "$2" ] | |
then | |
# old-style /etc/pm format | |
if [ "$1" = "suspend" ]; then STAGE="pre"; TYPE="sleep"; fi | |
if [ "$1" = "sleep" ]; then STAGE="pre"; TYPE="sleep"; fi | |
if [ "$1" = "hibernate" ]; then STAGE="pre"; TYPE="hibernate"; fi | |
if [ "$1" = "resume" ]; then STAGE="post"; TYPE="sleep"; fi | |
if [ "$1" = "thaw" ]; then STAGE="post"; TYPE="hibernate"; fi | |
else | |
STAGE=$1 | |
TYPE=$2 | |
fi | |
echo "$(date) $0 $STAGE $TYPE" >> /tmp/pmlog | |
awk '/^ktime / {print $3; q}' /proc/sched_debug >> /tmp/pmlog | |
case "$STAGE" in | |
pre) | |
modprobe -r bcm5974 | |
;; | |
post) | |
modprobe bcm5974 | |
#env -i XAUTHORITY=/var/run/sddm/:0 DISPLAY=:0 /bin/sh -c " | |
# sleep 3; | |
# awk '/^ktime / {print $3; q}' /proc/sched_debug >> /tmp/pmlog; | |
# xinput enable bcm5974 >> /tmp/pmlog 2>&1 | |
# " & | |
sleep 1 | |
su -l -c 'env DISPLAY=:0 xinput enable bcm5974' bas | |
;; | |
esac | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment