Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3003)

Unified Diff: chrome/browser/chromeos/policy/device_status_collector.cc

Issue 2115723003: Report all system temperatures, not just CPU (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 d731df43bf15008572b7ec328779f816b498680e..b530f56f032a48b2e7d156e69c89652adc734a6a 100644
--- a/chrome/browser/chromeos/policy/device_status_collector.cc
+++ b/chrome/browser/chromeos/policy/device_status_collector.cc
@@ -171,11 +171,12 @@ std::vector<em::CPUTempInfo> ReadCPUTempInfo() {
for (base::FilePath hwmon_path = hwmon_enumerator.Next(); !hwmon_path.empty();
hwmon_path = hwmon_enumerator.Next()) {
- // 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*/device/
+ 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.
@@ -185,11 +186,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);
Andrew T Wilson (Slow) 2016/09/06 18:10:45 I'm concerned that if ReadFileToString() returns a
Jay Lee 2016/09/14 15:24:54 As far as I can see at: https://chromium.googleso
+ } else if (base::PathExists(base::FilePath(name_path))) {
+ base::ReadFileToString(name_path, &label);
+ } else {
label = std::string();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698