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

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

Change-Id: I22748212c2fae0626be8a6b3cef1d4e819c5c301
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot 2023-05-04 11:33:53 +00:00 committed by Automerger Merge Worker
commit 003a20cdbd

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);