mirror of
https://github.com/PixelExperience-Devices/device_xiaomi_sm6250-common.git
synced 2025-07-01 07:19:53 +09:00
sm6250-common: Update thermal HAL
* From hardware/google/pixel at d774cbb949e98627e4172bf8fc11e8d954599aa7. Change-Id: I3a3a0c29575d0595e71a30f1e64e33ca34d2eb27
This commit is contained in:
@ -19,6 +19,7 @@
|
||||
|
||||
#include <android-base/file.h>
|
||||
#include <android-base/logging.h>
|
||||
#include <android-base/stringprintf.h>
|
||||
#include <android-base/strings.h>
|
||||
#include "thermal_files.h"
|
||||
|
||||
@ -45,6 +46,7 @@ bool ThermalFiles::readThermalFile(std::string_view thermal_name, std::string *d
|
||||
std::string file_path = getThermalFilePath(std::string_view(thermal_name));
|
||||
*data = "";
|
||||
if (file_path.empty()) {
|
||||
PLOG(WARNING) << "Failed to find " << thermal_name << "'s path";
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -58,6 +60,18 @@ bool ThermalFiles::readThermalFile(std::string_view thermal_name, std::string *d
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ThermalFiles::writeCdevFile(std::string_view cdev_name, std::string_view data) {
|
||||
std::string file_path =
|
||||
getThermalFilePath(android::base::StringPrintf("%s_%s", cdev_name.data(), "w"));
|
||||
|
||||
if (!android::base::WriteStringToFile(data.data(), file_path)) {
|
||||
PLOG(WARNING) << "Failed to write cdev: " << cdev_name << " to " << data.data();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V2_0
|
||||
} // namespace thermal
|
||||
|
Reference in New Issue
Block a user