Merge "powerstats: update NFC sysfs path" into udc-dev am: 1aef63a513

Original change: https://googleplex-android-review.googlesource.com/c/device/google/felix/+/23012899

Change-Id: I37cabb1e24a982b0193004a47ee609bc783d60f5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot 2023-05-04 10:09:53 +00:00 committed by Automerger Merge Worker
commit 504988d7a2

View file

@ -28,6 +28,7 @@
#include <android/binder_manager.h>
#include <android/binder_process.h>
#include <log/log.h>
#include <sys/stat.h>
using aidl::android::hardware::power::stats::DevfreqStateResidencyDataProvider;
using aidl::android::hardware::power::stats::DisplayStateResidencyDataProvider;
@ -140,6 +141,18 @@ void addGPU(std::shared_ptr<PowerStats> p) {
stateCoeffs));
}
std::string getNfcPath() {
struct stat buffer;
int size = 128;
char path[size];
for (int i = 0; i < 10; i++) {
std::snprintf(path, size,
"/sys/devices/platform/10970000.hsi2c/i2c-%d/i2c-st21nfc/power_stats", i);
if (!stat(path, &buffer)) break;
}
return std::string(path);
}
int main() {
LOG(INFO) << "Pixel PowerStats HAL AIDL Service is starting.";
@ -160,7 +173,7 @@ int main() {
addWifi(p);
addTPU(p);
addUfs(p);
addNFC(p, "/sys/devices/platform/10970000.hsi2c/i2c-4/i2c-st21nfc/power_stats");
addNFC(p, getNfcPath());
addUwb(p);
addPowerDomains(p);
addDevfreq(p);