From 89577833334168bae9a66e258f716e607cc5b1b1 Mon Sep 17 00:00:00 2001 From: roynatech2544 Date: Tue, 1 Nov 2022 13:28:00 +0900 Subject: [PATCH] universal7885: aidl-support: Adapt to liblogfmt changes --- .../apps/aidl-support/fm/default/FMDevControl.cpp | 10 +++++----- .../fm/default/libfm_slsi-impl/FMDeviceControl.cpp | 7 ++++--- .../apps/aidl-support/libfileio/FileIO.cpp | 14 ++++++-------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/universal7885-common/apps/aidl-support/fm/default/FMDevControl.cpp b/universal7885-common/apps/aidl-support/fm/default/FMDevControl.cpp index daa0c75..9937ca1 100644 --- a/universal7885-common/apps/aidl-support/fm/default/FMDevControl.cpp +++ b/universal7885-common/apps/aidl-support/fm/default/FMDevControl.cpp @@ -43,7 +43,7 @@ namespace aidl::vendor::eureka::hardware::fmradio { } ::ndk::ScopedAStatus FMDevControl::getValue(GetType type, int *_aidl_return) { - ALOGD(make_str("%s: type %d", __func__, type)); + LOG_D("%s: type %d", __func__, type); if (type != GetType::GET_TYPE_FM_MUTEX_LOCKED) { RETURN_IF_FAILED_LOCK; } @@ -97,7 +97,7 @@ namespace aidl::vendor::eureka::hardware::fmradio { if (type != GetType::GET_TYPE_FM_MUTEX_LOCKED) { lock.unlock(); } - ALOGD(make_str("%s: returning %d", __func__, *_aidl_return)); + LOG_D("%s: returning %d", __func__, *_aidl_return); return ::ndk::ScopedAStatus::ok(); } @@ -105,7 +105,7 @@ namespace aidl::vendor::eureka::hardware::fmradio { ::ndk::ScopedAStatus FMDevControl::setValue(SetType type, int value) { using audio_route::IAudioRoute; - ALOGD(make_str("%s: type %d, value %d", __func__, type, value)); + LOG_D("%s: type %d, value %d", __func__, type, value); RETURN_IF_FAILED_LOCK; assert(fd > 0); @@ -146,14 +146,14 @@ namespace aidl::vendor::eureka::hardware::fmradio { client_observe_thread = std::thread([=] { pid_t pid = value; - ALOGD(make_str("%s: FM_APP_PID: recieved value %d", __func__, pid)); + LOG_D("%s: FM_APP_PID: recieved value %d", __func__, pid); while (true) { if (kill(pid, 0) < 0 && errno == ESRCH) break; std::this_thread::sleep_for(std::chrono::seconds(2)); } - ALOGW(make_str("%s: FM_APP_PID: Starting client death receiver", __func__)); + LOG_W("%s: FM_APP_PID: Starting client death receiver", __func__); fm_radio_slsi::fm_thread_set(fd, 0); auto svc = IAudioRoute::fromBinder(ndk::SpAIBinder(AServiceManager_waitForService("vendor.eureka.hardware.audio_route.IAudioRoute/default"))); diff --git a/universal7885-common/apps/aidl-support/fm/default/libfm_slsi-impl/FMDeviceControl.cpp b/universal7885-common/apps/aidl-support/fm/default/libfm_slsi-impl/FMDeviceControl.cpp index 96dd009..9570043 100644 --- a/universal7885-common/apps/aidl-support/fm/default/libfm_slsi-impl/FMDeviceControl.cpp +++ b/universal7885-common/apps/aidl-support/fm/default/libfm_slsi-impl/FMDeviceControl.cpp @@ -1,5 +1,7 @@ +#define LOG_TAG "FMHAL-impl-lib" + #include -#include + #include #include #include @@ -20,8 +22,7 @@ static bool FMThread = false; constexpr const char *FM_DEV_PATH = "/dev/radio0"; #define LOG_IOCTL_ERR(cmd) \ - LOG(ERROR) << make_str(std::string("Failed to call" cmd "ioctl(), %d (%s)"), \ - errno, strerror(-errno)) + LOG_E(std::string("Failed to call" cmd "ioctl(), %d (%s)"), errno, strerror(-errno)) #define LOG_IOCTL_ERR_ON_COND_NORETURN(cmd, cond) \ ({ \ diff --git a/universal7885-common/apps/aidl-support/libfileio/FileIO.cpp b/universal7885-common/apps/aidl-support/libfileio/FileIO.cpp index c40a081..a2817f8 100644 --- a/universal7885-common/apps/aidl-support/libfileio/FileIO.cpp +++ b/universal7885-common/apps/aidl-support/libfileio/FileIO.cpp @@ -1,7 +1,5 @@ #define LOG_TAG "libFileIO" -#include - #include #include @@ -15,20 +13,20 @@ int readline(const char *path) { std::ifstream file; std::string value; file.open(path); - ALOGD(make_str("%s: Opening %s", __func__, path)); + LOG_D("%s: Opening %s", __func__, path); if (file.is_open()) { getline(file, value); file.close(); } else { - ALOGE(make_str("%s: Failed to open %s", __func__, path)); + LOG_E("%s: Failed to open %s", __func__, path); return EXIT_ERR; } try { return stoi(value); } catch (std::invalid_argument const &ex) { - ALOGE(make_str("%s: stoi(): invalid argument: for %s", __func__, value.c_str())); + LOG_E("%s: stoi(): invalid argument: for %s", __func__, value.c_str()); } catch (std::out_of_range const &ex) { - ALOGE(make_str("%s: stoi(): out of range: for %s", __func__, value.c_str())); + LOG_E("%s: stoi(): out of range: for %s", __func__, value.c_str()); } return EXIT_ERR; } @@ -36,13 +34,13 @@ int readline(const char *path) { void writeline(const char *path, const std::string& data) { std::ofstream file; file.open(path); - ALOGD(make_str("%s: Opening %s, will write '%s'", __func__, path, data.c_str())); + LOG_D("%s: Opening %s, will write '%s'", __func__, path, data.c_str()); if (file.is_open()) { file << data; file.close(); return; } - ALOGE(make_str("%s: Failed to open %s", __func__, path)); + LOG_E("%s: Failed to open %s", __func__, path); } void writeline(const char *path, const int data) {