Lines 5-10
AddConfigHandler USuspendConfigEnabler
Link Here
|
5 |
AddOptionHandler USuspendOptionHandler |
5 |
AddOptionHandler USuspendOptionHandler |
6 |
|
6 |
|
7 |
AddConfigHelp "USuspendMethod <disk|ram|both>" "Enables use of the uswsusp suspend method of newer kernels (>= 2.6.17rc1)" |
7 |
AddConfigHelp "USuspendMethod <disk|ram|both>" "Enables use of the uswsusp suspend method of newer kernels (>= 2.6.17rc1)" |
|
|
8 |
AddConfigHelp "USuspendBothForce <boolean>" "Passes the --force flag to s2both to force suspending even if the machine is not recognised (s2ram -n)" |
8 |
AddConfigHelp "USuspendRamForce <boolean>" "Passes the -f flag to s2ram to force suspending even if the machine is not recognised" |
9 |
AddConfigHelp "USuspendRamForce <boolean>" "Passes the -f flag to s2ram to force suspending even if the machine is not recognised" |
9 |
AddConfigHelp "USuspendRamUnsureOk <boolean>" "Instructs s2ram to continue when it's unsure about the system type, thus not requiring -f to be passed" |
10 |
AddConfigHelp "USuspendRamUnsureOk <boolean>" "Instructs s2ram to continue when it's unsure about the system type, thus not requiring -f to be passed" |
10 |
AddConfigHelp "USuspendRamVbeSave <boolean>" "Passes the -s flag to s2ram to save VBE state before suspending and restore after resume" |
11 |
AddConfigHelp "USuspendRamVbeSave <boolean>" "Passes the -s flag to s2ram to save VBE state before suspending and restore after resume" |
Lines 20-25
AddLongOption "no-suspend"
Link Here
|
20 |
USUSPEND_STATE_FILE=/sys/power/state |
21 |
USUSPEND_STATE_FILE=/sys/power/state |
21 |
USUSPEND_DEVICE=/dev/snapshot |
22 |
USUSPEND_DEVICE=/dev/snapshot |
22 |
USUSPEND_PROG=s2disk |
23 |
USUSPEND_PROG=s2disk |
|
|
24 |
USUSPEND_BOTH_FORCE=0 |
23 |
USUSPEND_RAM_FORCE=0 |
25 |
USUSPEND_RAM_FORCE=0 |
24 |
USUSPEND_RAM_UNSUREOK=0 |
26 |
USUSPEND_RAM_UNSUREOK=0 |
25 |
USUSPEND_RAM_VBESAVE=0 |
27 |
USUSPEND_RAM_VBESAVE=0 |
Lines 52-57
USuspendConfigEnabler() {
Link Here
|
52 |
fi |
54 |
fi |
53 |
;; |
55 |
;; |
54 |
|
56 |
|
|
|
57 |
ususpendbothforce) |
58 |
BoolIsOn "$1" "$2" && USUSPEND_BOTH_FORCE=1 || return 0 |
59 |
;; |
55 |
ususpendramforce) |
60 |
ususpendramforce) |
56 |
BoolIsOn "$1" "$2" && USUSPEND_RAM_FORCE=1 || return 0 |
61 |
BoolIsOn "$1" "$2" && USUSPEND_RAM_FORCE=1 || return 0 |
57 |
;; |
62 |
;; |
Lines 104-109
USuspendOptionHandler() {
Link Here
|
104 |
DoUSuspend() { |
109 |
DoUSuspend() { |
105 |
if [ -z "$USUSPEND_NO_SUSPEND" ] ; then |
110 |
if [ -z "$USUSPEND_NO_SUSPEND" ] ; then |
106 |
ARGS= |
111 |
ARGS= |
|
|
112 |
if [ "$USUSPEND_PROG" = s2both ]; then |
113 |
[ $USUSPEND_BOTH_FORCE -eq 1 ] && ARGS="$ARGS --force" |
114 |
fi |
107 |
if [ "$USUSPEND_PROG" = s2ram ]; then |
115 |
if [ "$USUSPEND_PROG" = s2ram ]; then |
108 |
[ $USUSPEND_RAM_FORCE -eq 1 ] && ARGS="$ARGS -f" |
116 |
[ $USUSPEND_RAM_FORCE -eq 1 ] && ARGS="$ARGS -f" |
109 |
[ $USUSPEND_RAM_VBESAVE -eq 1 ] && ARGS="$ARGS -s" |
117 |
[ $USUSPEND_RAM_VBESAVE -eq 1 ] && ARGS="$ARGS -s" |
Lines 127-134
EnsureUSuspendCapable() {
Link Here
|
127 |
vecho 0 "$USUSPEND_PROG not installed." |
135 |
vecho 0 "$USUSPEND_PROG not installed." |
128 |
return 2 |
136 |
return 2 |
129 |
fi |
137 |
fi |
130 |
if [ "$USUSPEND_PROG" = s2ram ] && [ $USUSPEND_RAM_FORCE -eq 0 ]; then |
138 |
if [ "$USUSPEND_PROG" = s2ram ] && [ $USUSPEND_RAM_FORCE -eq 0 ] || \ |
131 |
$USUSPEND_PROG -n >/dev/null |
139 |
[ "$USUSPEND_PROG" = s2both ] && [ $USUSPEND_BOTH_FORCE -eq 0 ]; then |
|
|
140 |
s2ram -n >/dev/null |
132 |
ret=$? |
141 |
ret=$? |
133 |
case "$ret/$USUSPEND_RAM_UNSUREOK" in |
142 |
case "$ret/$USUSPEND_RAM_UNSUREOK" in |
134 |
0/*) :;; |
143 |
0/*) :;; |
Lines 138-144
EnsureUSuspendCapable() {
Link Here
|
138 |
return 2 |
147 |
return 2 |
139 |
;; |
148 |
;; |
140 |
*) |
149 |
*) |
141 |
vecho 0 "$USUSPEND_PROG: unknown machine, see s2ram(8) and the USuspendRamForce option" |
150 |
vecho 0 "$USUSPEND_PROG: unknown machine, see s2ram(8) and the USuspendRamForce and UsuspendBothForce options" |
142 |
return 2 |
151 |
return 2 |
143 |
;; |
152 |
;; |
144 |
esac |
153 |
esac |