universal7885: fm-aidl: Add missing dep to liblogformat

- Also fix errors
This commit is contained in:
roynatech2544 2022-11-01 17:03:24 +09:00
commit 0be8f2929f
3 changed files with 15 additions and 13 deletions

View file

@ -26,7 +26,10 @@ cc_binary {
"vendor.eureka.hardware.fmradio-V3-ndk",
"vendor.eureka.hardware.audio_route-V1-ndk",
],
header_libs: ["libaudioclient_headers"],
header_libs: [
"libaudioclient_headers",
"logformat"
],
init_rc: ["vendor.eureka.hardware.fmradio-service.rc"],
vintf_fragments: ["vendor.eureka.hardware.fmradio.xml"],
required: [

View file

@ -130,10 +130,11 @@ namespace aidl::vendor::eureka::hardware::fmradio {
case SetType::SET_TYPE_FM_SEARCH_CANCEL:
fm_radio_slsi::stop_search(fd);
break;
case SetType::SET_TYPE_FM_SPEAKER_ROUTE:
case SetType::SET_TYPE_FM_SPEAKER_ROUTE: {
auto svc = IAudioRoute::fromBinder(ndk::SpAIBinder(AServiceManager_waitForService("vendor.eureka.hardware.audio_route.IAudioRoute/default")));
svc->setParam(value ? "routing=2": "routing=8");
break;
}
case SetType::SET_TYPE_FM_SEARCH_START:
lock.unlock();
search_thread = std::thread([this] {
@ -142,25 +143,24 @@ namespace aidl::vendor::eureka::hardware::fmradio {
});
search_thread.detach();
break;
case SetType::SET_TYPE_FM_APP_PID:
case SetType::SET_TYPE_FM_APP_PID: {
client_observe_thread = std::thread([=] {
pid_t pid = value;
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));
}
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")));
svc->setParam("l_fmradio_mode=off");
close();
}
});
client_observe_thread.detach();
break;
}
default:
break;
};

View file

@ -42,11 +42,10 @@ constexpr const char *FM_DEV_PATH = "/dev/radio0";
int open_device(void) {
int fd;
if ((fd = open(FM_DEV_PATH, O_RDWR | O_CLOEXEC)) < 0) {
LOG(ERROR) << make_str("Failed to open %s, %d (%s)", FM_DEV_PATH, errno,
strerror(-errno));
LOG_E("Failed to open %s, %d (%s)", FM_DEV_PATH, errno, strerror(-errno));
return -1;
}
LOG(DEBUG) << make_str("Opened %s, fd %d", FM_DEV_PATH, fd);
LOG_D("Opened %s, fd %d", FM_DEV_PATH, fd);
return fd;
}
@ -66,7 +65,7 @@ int get_frequency(const int fd, int *channel) {
*channel = static_cast<int>(freq.frequency) / 16000;
LOG(DEBUG) << make_str("Channel freq: %d", *channel);
LOG_D("Channel freq: %d", *channel);
return ret;
}
@ -74,7 +73,7 @@ void set_frequency(const int fd, int channel) {
struct v4l2_frequency freq {};
int ret;
LOG(DEBUG) << make_str("Channel freq: %d", channel);
LOG_D("Channel freq: %d", channel);
freq.tuner = 0;
freq.type = V4L2_TUNER_RADIO;
@ -90,7 +89,7 @@ static int set_control(const int fd, unsigned int id, int val) {
int ret;
ctrl.id = id;
LOG(DEBUG) << make_str("Control value: %d", val);
LOG_D("Control value: %d", val);
if (val)
ctrl.value = static_cast<unsigned int>(val);