Merge "fix path for i2c peripheral device" into tm-dev am: f64f2d57c0

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

Change-Id: I82bc743a69307d2f423b856c90d51492e3632f0f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Chung-Kai (Michael) Mei 2022-04-07 10:30:36 +00:00 committed by Automerger Merge Worker
commit 3bd9c33181

View file

@ -26,6 +26,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::DisplayStateResidencyDataProvider;
using aidl::android::hardware::power::stats::EnergyConsumerType;
@ -54,6 +55,8 @@ void addDisplay(std::shared_ptr<PowerStats> p) {
}
int main() {
struct stat buffer;
LOG(INFO) << "Pixel PowerStats HAL AIDL Service is starting.";
// single thread
@ -63,8 +66,19 @@ int main() {
addGs101CommonDataProviders(p);
addDisplay(p);
addNFC(p, "/sys/devices/platform/10960000.hsi2c/i2c-3/i2c-st21nfc/power_stats");
if (!stat("/sys/devices/platform/10960000.hsi2c/i2c-3/i2c-st21nfc/power_stats", &buffer)) {
addNFC(p, "/sys/devices/platform/10960000.hsi2c/i2c-3/i2c-st21nfc/power_stats");
} else if (!stat("/sys/devices/platform/10960000.hsi2c/i2c-4/i2c-st21nfc/power_stats", &buffer)) {
addNFC(p, "/sys/devices/platform/10960000.hsi2c/i2c-4/i2c-st21nfc/power_stats");
} else if (!stat("/sys/devices/platform/10960000.hsi2c/i2c-5/i2c-st21nfc/power_stats", &buffer)) {
addNFC(p, "/sys/devices/platform/10960000.hsi2c/i2c-5/i2c-st21nfc/power_stats");
} else if (!stat("/sys/devices/platform/10960000.hsi2c/i2c-6/i2c-st21nfc/power_stats", &buffer)) {
addNFC(p, "/sys/devices/platform/10960000.hsi2c/i2c-6/i2c-st21nfc/power_stats");
} else if (!stat("/sys/devices/platform/10960000.hsi2c/i2c-7/i2c-st21nfc/power_stats", &buffer)) {
addNFC(p, "/sys/devices/platform/10960000.hsi2c/i2c-7/i2c-st21nfc/power_stats");
} else {
addNFC(p, "/sys/devices/platform/10960000.hsi2c/i2c-8/i2c-st21nfc/power_stats");
}
const std::string instance = std::string() + PowerStats::descriptor + "/default";
binder_status_t status = AServiceManager_addService(p->asBinder().get(), instance.c_str());
LOG_ALWAYS_FATAL_IF(status != STATUS_OK);