aboutsummarylogtreecommitdiffstats
path: root/capture_stb.sh
blob: 35d6564e515d5911bc165178da8d29409dc8673a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/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 /root/amd-stb-captures/*
    ;;
  "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 /root/amd-stb-captures/*
    ;;
esac