| Index: client/common_lib/sys_power.py
|
| diff --git a/client/common_lib/sys_power.py b/client/common_lib/sys_power.py
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..3ddcfee237b217f93dfc04e85c0bd6a497f0222d
|
| --- /dev/null
|
| +++ b/client/common_lib/sys_power.py
|
| @@ -0,0 +1,32 @@
|
| +import os
|
| +
|
| +
|
| +def set_state(state):
|
| + """
|
| + Set the system power state to 'state'.
|
| + """
|
| + file('/sys/power/state', 'w').write("%s\n" % state)
|
| +
|
| +
|
| +def suspend_to_ram():
|
| + """
|
| + Suspend the system to RAM (S3)
|
| + """
|
| + if os.path.exists('/usr/bin/powerd_suspend'):
|
| + os.system('/usr/bin/powerd_suspend')
|
| + else:
|
| + set_power_state('mem')
|
| +
|
| +
|
| +def suspend_to_disk():
|
| + """
|
| + Suspend the system to disk (S4)
|
| + """
|
| + set_power_state('disk')
|
| +
|
| +def standby():
|
| + """
|
| + Power-on suspend (S1)
|
| + """
|
| + set_power_state('standby')
|
| +
|
|
|