summaryrefslogtreecommitdiff
path: root/pm/module.d/uswsusp
blob: ca87a3021fb0b25103912eb207cefaa8147237c4 (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
#!/bin/sh

# disable processing of 99video
before_hooks()
{
	disablehook 99video "disabled by uswsusp"
}

check_suspend()
{
	[ -e /dev/pmu ] && return 0
	grep -q mem /sys/power/state && return 0
}

do_suspend()
{
	echo "mem" >/sys/power/state
}

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()
{
	# a brief perusal of the source indicates that -f bypasses
	# quirks application and the whitelist.
	s2both -f
}