blob: 8a5ee3bfa78f576369ef294961406676019bb8c7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
#!/bin/sh
# disable processing of 99video
before_hooks()
{
disablehook 00clear "disabled by uswsusp"
disablehook 99video "disabled by uswsusp"
}
get_quirks()
{
OPTS=""
ACPI_SLEEP=0
for opt in $PM_CMDLINE; do
case "${opt##--quirk-}" in # just quirks, please
dpms-on) ;; # no-op
dpms-suspend) ;; # no-op
radeon-off) OPTS="$OPTS --radeontool" ;;
reset-brightness) ;; # no-op
s3-bios) ACPI_SLEEP=$(($ACPI_SLEEP + 1)) ;;
s3-mode) ACPI_SLEEP=$(($ACPI_SLEEP + 2)) ;;
vbe-post) OPTS="$OPTS --vbe_post" ;;
vbemode-restore) OPTS="$OPTS --vbe_mode" ;;
vbestate-restore) OPTS="$OPTS --vbe_save" ;;
vga-mode3) ;; # no-op
save-pci) OPTS="$OPTS --pci_save" ;;
none) QUIRK_NONE="true" ;;
*) continue ;;
esac
done
[ $ACPI_SLEEP -ne 0 ] && OPTS="$OPTS --acpi_sleep $ACPI_SLEEP"
# if we were told to ignore quirks, do so.
[ "$QUIRK_NONE" = "true" ] && OPTS=""
}
check_suspend()
{
command_exists s2ram || return 1
[ -c /dev/pmu ] && return 0
grep -q mem /sys/power/state && return 0
}
do_suspend()
{
get_quirks
s2ram --force $OPTS
}
check_hibernate()
{
[ -f /sys/power/disk ] && \
grep -q disk /sys/power/state && \
[ -c /dev/snapshot ] &&
command_exists s2disk
}
do_hibernate()
{
s2disk
}
check_suspend_hybrid()
{
grep -q mem /sys/power/state && \
command_exists s2both && \
check_hibernate
}
do_suspend_hybrid()
{
get_quirks
s2both --force $OPTS
}
sleep_method_help()
{
echo # first echo makes it look nicer.
echo "Video quirk handler options:"
echo
echo " --quirk-dpms-on"
echo " --quirk-dpms-suspend"
echo " --quirk-radeon-off"
echo " --quirk-reset-brightness"
echo " --quirk-s3-bios"
echo " --quirk-s3-mode"
echo " --quirk-vbe-post"
echo " --quirk-vbemode-restore"
echo " --quirk-vbestate-restore"
echo " --quirk-vga-mode3"
echo " --quirk-save-pci"
echo " --quirk-none"
}
|