First Push
This commit is contained in:
39
NVIDIA-Linux-x86_64-535.161.07-grid/systemd/nvidia-sleep.sh
Executable file
39
NVIDIA-Linux-x86_64-535.161.07-grid/systemd/nvidia-sleep.sh
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ ! -f /proc/driver/nvidia/suspend ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
RUN_DIR="/var/run/nvidia-sleep"
|
||||
XORG_VT_FILE="${RUN_DIR}"/Xorg.vt_number
|
||||
|
||||
PATH="/bin:/usr/bin"
|
||||
|
||||
case "$1" in
|
||||
suspend|hibernate)
|
||||
mkdir -p "${RUN_DIR}"
|
||||
fgconsole > "${XORG_VT_FILE}"
|
||||
chvt 63
|
||||
if [[ $? -ne 0 ]]; then
|
||||
exit $?
|
||||
fi
|
||||
echo "$1" > /proc/driver/nvidia/suspend
|
||||
exit $?
|
||||
;;
|
||||
resume)
|
||||
echo "$1" > /proc/driver/nvidia/suspend
|
||||
#
|
||||
# Check if Xorg was determined to be running at the time
|
||||
# of suspend, and whether its VT was recorded. If so,
|
||||
# attempt to switch back to this VT.
|
||||
#
|
||||
if [[ -f "${XORG_VT_FILE}" ]]; then
|
||||
XORG_PID=$(cat "${XORG_VT_FILE}")
|
||||
rm "${XORG_VT_FILE}"
|
||||
chvt "${XORG_PID}"
|
||||
fi
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
esac
|
||||
7
NVIDIA-Linux-x86_64-535.161.07-grid/systemd/system-sleep/nvidia
Executable file
7
NVIDIA-Linux-x86_64-535.161.07-grid/systemd/system-sleep/nvidia
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
case "$1" in
|
||||
post)
|
||||
/usr/bin/nvidia-sleep.sh "resume"
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user