diff options
-rw-r--r-- | capture_stb.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/capture_stb.sh b/capture_stb.sh new file mode 100644 index 000000000000..329d74b8a5c8 --- /dev/null +++ b/capture_stb.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +if (( EUID != 0 )); then + echo "This script must be run as root, and is intended to be run by systemd during suspend/resume" + echo "to use place this script in /usr/lib/systemd/system-sleep/ and make it executable" + exit 1 +fi + +mkdir -p /root/amd-stb-captures + +case "$1" in + "pre") + echo "taking STB capture pre suspend at $(date)..." >/root/amd-stb-captures/capture.log + cat /sys/kernel/debug/amd_pmc/stb_read >"/root/amd-stb-captures/$(/usr/bin/date +%s)-pre.stb" && /usr/bin/sync + ;; + "post") + echo "taking STB capture post suspend at $(date)..." >>/root/amd-stb-captures/capture.log + cat /sys/kernel/debug/amd_pmc/stb_read >"/root/amd-stb-captures/$(/usr/bin/date +%s)-post.stb" && /usr/bin/sync + ;; +esac + |