OLD | NEW |
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import logging, os, re, shutil, time | 5 import logging, os, re, shutil, time |
6 from autotest_lib.client.bin import site_ui_test | 6 from autotest_lib.client.bin import site_ui_test |
7 from autotest_lib.client.common_lib import error, site_httpd, \ | 7 from autotest_lib.client.common_lib import error, site_httpd, \ |
8 site_power_status, site_ui, utils | 8 site_power_status, site_ui, utils |
9 | 9 |
10 params_dict = { | 10 params_dict = { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 # record the current and max backlight levels | 82 # record the current and max backlight levels |
83 cmd = 'backlight-tool --get_max_brightness' | 83 cmd = 'backlight-tool --get_max_brightness' |
84 self._tmp_keyvals['level_backlight_max'] = int( | 84 self._tmp_keyvals['level_backlight_max'] = int( |
85 utils.system_output(cmd).rstrip()) | 85 utils.system_output(cmd).rstrip()) |
86 | 86 |
87 cmd = 'backlight-tool --get_brightness' | 87 cmd = 'backlight-tool --get_brightness' |
88 self._tmp_keyvals['level_backlight_current'] = int( | 88 self._tmp_keyvals['level_backlight_current'] = int( |
89 utils.system_output(cmd).rstrip()) | 89 utils.system_output(cmd).rstrip()) |
90 | 90 |
91 # disable screen locker | 91 # disable screen locker and powerd |
92 os.system('stop screen-locker') | 92 os.system('stop screen-locker') |
| 93 os.system('stop powerd') |
93 | 94 |
94 # disable screen blanking. Stopping screen-locker isn't | 95 # disable screen blanking. Stopping screen-locker isn't |
95 # synchronous :(. Add a sleep for now, till powerd comes around | 96 # synchronous :(. Add a sleep for now, till powerd comes around |
96 # and fixes all this for us. | 97 # and fixes all this for us. |
97 time.sleep(5) | 98 time.sleep(5) |
98 site_ui.xsystem(os.path.join(self.bindir, 'xset') + ' s off') | 99 site_ui.xsystem(os.path.join(self.bindir, 'xset') + ' s off') |
99 site_ui.xsystem(os.path.join(self.bindir, 'xset') + ' dpms 0 0 0') | 100 site_ui.xsystem(os.path.join(self.bindir, 'xset') + ' dpms 0 0 0') |
100 site_ui.xsystem(os.path.join(self.bindir, 'xset') + ' -dpms') | 101 site_ui.xsystem(os.path.join(self.bindir, 'xset') + ' -dpms') |
101 | 102 |
102 # fix up file perms for the power test extension so that chrome | 103 # fix up file perms for the power test extension so that chrome |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 | 193 |
193 keyvals['a_current_rate'] = keyvals['ah_charge_used'] * 60 / \ | 194 keyvals['a_current_rate'] = keyvals['ah_charge_used'] * 60 / \ |
194 keyvals['minutes_battery_life'] | 195 keyvals['minutes_battery_life'] |
195 keyvals['w_energy_rate'] = keyvals['wh_energy_used'] * 60 / \ | 196 keyvals['w_energy_rate'] = keyvals['wh_energy_used'] * 60 / \ |
196 keyvals['minutes_battery_life'] | 197 keyvals['minutes_battery_life'] |
197 | 198 |
198 self.write_perf_keyval(keyvals) | 199 self.write_perf_keyval(keyvals) |
199 | 200 |
200 | 201 |
201 def cleanup(self): | 202 def cleanup(self): |
202 # re-enable screen locker. This also re-enables dpms. | 203 # re-enable screen locker and powerd. This also re-enables dpms. |
| 204 os.system('start powerd') |
203 os.system('start screen-locker') | 205 os.system('start screen-locker') |
204 | 206 |
205 | 207 |
206 def _is_network_iface_running(self, name): | 208 def _is_network_iface_running(self, name): |
207 try: | 209 try: |
208 out = utils.system_output('ifconfig %s' % name) | 210 out = utils.system_output('ifconfig %s' % name) |
209 except error.CmdError, e: | 211 except error.CmdError, e: |
210 logging.info(e) | 212 logging.info(e) |
211 return False | 213 return False |
212 | 214 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 for e in form_data: | 267 for e in form_data: |
266 key = 'ext_' + e | 268 key = 'ext_' + e |
267 if key in self._tmp_keyvals: | 269 if key in self._tmp_keyvals: |
268 self._tmp_keyvals[key] += form_data[e] | 270 self._tmp_keyvals[key] += form_data[e] |
269 else: | 271 else: |
270 self._tmp_keyvals[key] = form_data[e] | 272 self._tmp_keyvals[key] = form_data[e] |
271 else: | 273 else: |
272 logging.debug("Didn't get status back from power extension") | 274 logging.debug("Didn't get status back from power extension") |
273 | 275 |
274 return low_battery | 276 return low_battery |
OLD | NEW |