aboutsummarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott B2021-10-26 02:45:20 -0700
committerScott B2021-10-29 03:47:50 -0700
commit5c6319b009780efb789f5ef4229912e1c1ecd620 (patch)
tree724f072f0e62cd5b98ded39328e74349be341bf0
parentbcfee5ff4ccfd9732303dc1f6669d334f5b117c9 (diff)
downloadaur-5c6319b009780efb789f5ef4229912e1c1ecd620.tar.gz
include helper script for STB captures
-rw-r--r--capture_stb.sh21
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
+