Index: chrome/browser/chromeos/policy/device_status_collector.cc |
diff --git a/chrome/browser/chromeos/policy/device_status_collector.cc b/chrome/browser/chromeos/policy/device_status_collector.cc |
index fdf71837622a40c30c5dd91fe7ad5fa26240213d..d24213879909f6c6a410e964ba5fa938fc0c7468 100644 |
--- a/chrome/browser/chromeos/policy/device_status_collector.cc |
+++ b/chrome/browser/chromeos/policy/device_status_collector.cc |
@@ -168,11 +168,12 @@ std::vector<em::CPUTempInfo> ReadCPUTempInfo() { |
for (base::FilePath hwmon_path = hwmon_enumerator.Next(); !hwmon_path.empty(); |
hwmon_path = hwmon_enumerator.Next()) { |
Polina Bondarenko
2016/07/01 15:22:26
s/devices/device
|
- // Get files /sys/class/hwmon/hwmon*/device/temp*_input |
- const base::FilePath hwmon_device_dir = hwmon_path.Append(kDeviceDir); |
- base::FileEnumerator enumerator(hwmon_device_dir, false, |
- base::FileEnumerator::FILES, |
- kCPUTempFilePattern); |
+ // Get temp*_input files in hwmon*/ and hwmon*/devices/ |
+ if (base::PathExists(hwmon_path.Append(kDeviceDir))) { |
+ hwmon_path = hwmon_path.Append(kDeviceDir); |
+ } |
+ base::FileEnumerator enumerator( |
+ hwmon_path, false, base::FileEnumerator::FILES, kCPUTempFilePattern); |
for (base::FilePath temperature_path = enumerator.Next(); |
!temperature_path.empty(); temperature_path = enumerator.Next()) { |
// Get appropriate temp*_label file. |
@@ -182,11 +183,16 @@ std::vector<em::CPUTempInfo> ReadCPUTempInfo() { |
continue; |
} |
base::ReplaceSubstringsAfterOffset(&label_path, 0, "input", "label"); |
+ base::FilePath name_path = hwmon_path.Append("name"); |
- // Read label. |
+ // Get the label describing this temperature. Use temp*_label |
+ // if present, fall back on name file or blank. |
std::string label; |
- if (!base::PathExists(base::FilePath(label_path)) || |
- !base::ReadFileToString(base::FilePath(label_path), &label)) { |
+ if (base::PathExists(base::FilePath(label_path))) { |
+ base::ReadFileToString(base::FilePath(label_path), &label); |
+ } else if (base::PathExists(base::FilePath(name_path))) { |
+ base::ReadFileToString(name_path, &label); |
+ } else { |
label = std::string(); |
} |