OLD | NEW |
1 # -*- coding: utf-8 -*- | 1 # -*- coding: utf-8 -*- |
2 # | 2 # |
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 __author__ = 'nsanders@chromium.org (Nick Sanders)' | 7 __author__ = 'nsanders@chromium.org (Nick Sanders)' |
8 | 8 |
9 import logging, os | 9 import logging, os |
10 | 10 |
11 from autotest_lib.client.bin import test, utils | 11 from autotest_lib.client.bin import test, utils |
12 from autotest_lib.client.common_lib import error, site_gpio | 12 from autotest_lib.client.common_lib import error |
| 13 from autotest_lib.client.cros import gpio |
13 | 14 |
14 class hardware_GPIOSwitches(test.test): | 15 class hardware_GPIOSwitches(test.test): |
15 version = 4 | 16 version = 4 |
16 | 17 |
17 def initialize(self): | 18 def initialize(self): |
18 self._gpio = site_gpio.Gpio(error.TestError) | 19 self._gpio = gpio.Gpio(error.TestError) |
19 | 20 |
20 def gpio_read(self, name): | 21 def gpio_read(self, name): |
21 try: | 22 try: |
22 return self._gpio.read(name) | 23 return self._gpio.read(name) |
23 except: | 24 except: |
24 raise error.TestError( | 25 raise error.TestError( |
25 'Unable to read gpio value "%s"\n' | 26 'Unable to read gpio value "%s"\n' |
26 '測試程式無法讀取 gpio 數值 "%s"' % (name, name)) | 27 '測試程式無法讀取 gpio 數值 "%s"' % (name, name)) |
27 | 28 |
28 def run_once(self): | 29 def run_once(self): |
29 self._gpio.setup() | 30 self._gpio.setup() |
30 keyvals = {} | 31 keyvals = {} |
31 keyvals['level_recovery'] = self.gpio_read('recovery_button') | 32 keyvals['level_recovery'] = self.gpio_read('recovery_button') |
32 keyvals['level_developer'] = self.gpio_read('developer_switch') | 33 keyvals['level_developer'] = self.gpio_read('developer_switch') |
33 keyvals['level_firmware_writeprotect'] = self.gpio_read('write_protect') | 34 keyvals['level_firmware_writeprotect'] = self.gpio_read('write_protect') |
34 | 35 |
35 self.write_perf_keyval(keyvals) | 36 self.write_perf_keyval(keyvals) |
OLD | NEW |