mirror of
https://github.com/chararomandroid/android_device_samsung_a20
synced 2026-08-21 19:55:33 -04:00
universal7885: aidl-support: Adapt to liblogfmt changes
This commit is contained in:
parent
917fc7ecf1
commit
8957783333
3 changed files with 15 additions and 16 deletions
|
|
@ -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")));
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#define LOG_TAG "FMHAL-impl-lib"
|
||||
|
||||
#include <LogFormat.h>
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/poll.h>
|
||||
|
|
@ -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) \
|
||||
({ \
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
#define LOG_TAG "libFileIO"
|
||||
|
||||
#include <log/log.h>
|
||||
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
||||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue