Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # coding=utf-8 | 1 # coding=utf-8 |
| 2 # Copyright 2015 Google Inc. All rights reserved. | 2 # Copyright 2015 Google Inc. All rights reserved. |
| 3 # | 3 # |
| 4 # Licensed under the Apache License, Version 2.0 (the "License"); | 4 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 # you may not use this file except in compliance with the License. | 5 # you may not use this file except in compliance with the License. |
| 6 # You may obtain a copy of the License at | 6 # You may obtain a copy of the License at |
| 7 # | 7 # |
| 8 # http://www.apache.org/licenses/LICENSE-2.0 | 8 # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 # | 9 # |
| 10 # Unless required by applicable law or agreed to in writing, software | 10 # Unless required by applicable law or agreed to in writing, software |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 631 # Assumes it's in °C. | 631 # Assumes it's in °C. |
| 632 value = float(temp) | 632 value = float(temp) |
| 633 if value > 1000: | 633 if value > 1000: |
| 634 # Then assumes it's in m°C. | 634 # Then assumes it's in m°C. |
| 635 # TODO(maruel): Discern near cold temperature, e.g. 0.1°C. | 635 # TODO(maruel): Discern near cold temperature, e.g. 0.1°C. |
| 636 value = value / 1000. | 636 value = value / 1000. |
| 637 if value <= 0.: | 637 if value <= 0.: |
| 638 # TODO(maruel): Support cold temperatures below 0°C. | 638 # TODO(maruel): Support cold temperatures below 0°C. |
| 639 continue | 639 continue |
| 640 sensor_type = self.PullContent(path + '/type') | 640 sensor_type = self.PullContent(path + '/type') |
| 641 if sensor_type and not sensor_type.startswith('tsens_tz_sensor'): | 641 if sensor_type: |
|
bpastene
2017/04/28 00:19:51
Would you happen to remember why they were ignored
M-A Ruel
2017/04/28 17:15:13
Yes. It was quite spammy but I don't recall exactl
bpastene
2017/04/29 00:24:08
Will do.
| |
| 642 out[sensor_type.strip()] = value | 642 out[sensor_type.strip()] = value |
| 643 # Filter out unnecessary stuff. | 643 # Filter out unnecessary stuff. |
| 644 return out | 644 return out |
| 645 | 645 |
| 646 def GetBattery(self): | 646 def GetBattery(self): |
| 647 """Returns details about the battery's state.""" | 647 """Returns details about the battery's state.""" |
| 648 props = {} | 648 props = {} |
| 649 out = self.Dumpsys('battery') | 649 out = self.Dumpsys('battery') |
| 650 if not out: | 650 if not out: |
| 651 return props | 651 return props |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1007 return out | 1007 return out |
| 1008 | 1008 |
| 1009 @classmethod | 1009 @classmethod |
| 1010 def _Connect(cls, constructor, **kwargs): | 1010 def _Connect(cls, constructor, **kwargs): |
| 1011 """Called by either ConnectDevice or Connect.""" | 1011 """Called by either ConnectDevice or Connect.""" |
| 1012 if not kwargs.get('rsa_keys'): | 1012 if not kwargs.get('rsa_keys'): |
| 1013 with _ADB_KEYS_LOCK: | 1013 with _ADB_KEYS_LOCK: |
| 1014 kwargs['rsa_keys'] = _ADB_KEYS[:] | 1014 kwargs['rsa_keys'] = _ADB_KEYS[:] |
| 1015 device = constructor(**kwargs) | 1015 device = constructor(**kwargs) |
| 1016 return HighDevice(device, _InitCache(device)) | 1016 return HighDevice(device, _InitCache(device)) |
| OLD | NEW |