Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: server/site_system_suspend.py

Issue 3471015: Suspend- function for site_wifitest (Closed) Base URL: ssh://gitrw.chromium.org/autotest.git
Patch Set: Fixed linespacing Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | server/site_wifitest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/python
2
3 """Tell system to suspend, and resume some number of seconds later.
4
5 Use the RTC to generate a wakeup some number of seconds into the
6 future, then go to sleep. Note that this module is not aware of
7 the actual time when the system will suspend. Depending on other
8 system activities, there may be several seconds between when this
9 script runs until when the system actually goes to sleep. In fact
10 that time may be after the wakeup has been scheduled, and the
11 system may never wake up! It is up to the caller to make prudent
12 decisions as to upper bound of delay before going to sleep, and to
13 choose a wakeup time greater than this interval.
14 """
15
16 import os, re, subprocess, sys
17 import rtc, sys_power
18
19 time_to_sleep = 30
20 if len(sys.argv) > 1:
21 time_to_sleep = int(sys.argv[1])
22
23 if len(sys.argv) > 2:
24 after_command = ' '.join(sys.argv[2:])
25 else:
26 after_command = None
27
28 rtc.set_wake_alarm(rtc.get_seconds() + time_to_sleep)
29 sys_power.suspend_to_ram()
30
31 if after_command:
32 os.system(after_command)
OLDNEW
« no previous file with comments | « no previous file | server/site_wifitest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698