OLD | NEW |
---|---|
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium 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 """Provides an interface to communicate with the device via the adb command. | 5 """Provides an interface to communicate with the device via the adb command. |
6 | 6 |
7 Assumes adb binary is currently on system path. | 7 Assumes adb binary is currently on system path. |
8 """ | 8 """ |
9 # pylint: disable-all | 9 # pylint: disable-all |
10 | 10 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
71 PIE_WRAPPER_PATH = constants.TEST_EXECUTABLE_DIR + '/run_pie' | 71 PIE_WRAPPER_PATH = constants.TEST_EXECUTABLE_DIR + '/run_pie' |
72 | 72 |
73 CONTROL_USB_CHARGING_COMMANDS = [ | 73 CONTROL_USB_CHARGING_COMMANDS = [ |
74 { | 74 { |
75 # Nexus 4 | 75 # Nexus 4 |
76 'witness_file': '/sys/module/pm8921_charger/parameters/disabled', | 76 'witness_file': '/sys/module/pm8921_charger/parameters/disabled', |
77 'enable_command': 'echo 0 > /sys/module/pm8921_charger/parameters/disabled', | 77 'enable_command': 'echo 0 > /sys/module/pm8921_charger/parameters/disabled', |
78 'disable_command': | 78 'disable_command': |
79 'echo 1 > /sys/module/pm8921_charger/parameters/disabled', | 79 'echo 1 > /sys/module/pm8921_charger/parameters/disabled', |
80 }, | 80 }, |
81 { | |
82 # Nexus 5 | |
83 # Setting the HIZ bit of the bq24192 causes the charger to actually ignore | |
pasko
2014/10/14 09:16:22
Wow! Cool! How do I discover similar things for ne
| |
84 # energy coming from USB. Setting the power_supply offline just updates the | |
85 # Android system to reflect that. | |
86 'witness_file': '/sys/kernel/debug/bq24192/INPUT_SRC_CONT', | |
87 'enable_command': ( | |
88 'echo 0x4A > /sys/kernel/debug/bq24192/INPUT_SRC_CONT && ' | |
89 'echo 1 > /sys/class/power_supply/usb/online'), | |
90 'disable_command': ( | |
91 'echo 0xCA > /sys/kernel/debug/bq24192/INPUT_SRC_CONT && ' | |
92 'chmod 644 /sys/class/power_supply/usb/online && ' | |
93 'echo 0 > /sys/class/power_supply/usb/online'), | |
94 }, | |
81 ] | 95 ] |
82 | 96 |
83 class DeviceTempFile(object): | 97 class DeviceTempFile(object): |
84 def __init__(self, android_commands, prefix='temp_file', suffix=''): | 98 def __init__(self, android_commands, prefix='temp_file', suffix=''): |
85 """Find an unused temporary file path in the devices external directory. | 99 """Find an unused temporary file path in the devices external directory. |
86 | 100 |
87 When this object is closed, the file will be deleted on the device. | 101 When this object is closed, the file will be deleted on the device. |
88 """ | 102 """ |
89 self.android_commands = android_commands | 103 self.android_commands = android_commands |
90 while True: | 104 while True: |
(...skipping 1860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1951 """ | 1965 """ |
1952 def __init__(self, output): | 1966 def __init__(self, output): |
1953 self._output = output | 1967 self._output = output |
1954 | 1968 |
1955 def write(self, data): | 1969 def write(self, data): |
1956 data = data.replace('\r\r\n', '\n') | 1970 data = data.replace('\r\r\n', '\n') |
1957 self._output.write(data) | 1971 self._output.write(data) |
1958 | 1972 |
1959 def flush(self): | 1973 def flush(self): |
1960 self._output.flush() | 1974 self._output.flush() |
OLD | NEW |