OLD | NEW |
(Empty) | |
| 1 import os |
| 2 |
| 3 |
| 4 def set_state(state): |
| 5 """ |
| 6 Set the system power state to 'state'. |
| 7 """ |
| 8 file('/sys/power/state', 'w').write("%s\n" % state) |
| 9 |
| 10 |
| 11 def suspend_to_ram(): |
| 12 """ |
| 13 Suspend the system to RAM (S3) |
| 14 """ |
| 15 if os.path.exists('/usr/bin/powerd_suspend'): |
| 16 os.system('/usr/bin/powerd_suspend') |
| 17 else: |
| 18 set_power_state('mem') |
| 19 |
| 20 |
| 21 def suspend_to_disk(): |
| 22 """ |
| 23 Suspend the system to disk (S4) |
| 24 """ |
| 25 set_power_state('disk') |
| 26 |
| 27 def standby(): |
| 28 """ |
| 29 Power-on suspend (S1) |
| 30 """ |
| 31 set_power_state('standby') |
| 32 |
OLD | NEW |