mirror of
https://github.com/chararomandroid/android_device_samsung_a20
synced 2026-08-22 20:15:32 -04:00
universal7885: fm-aidl: Add missing dep to liblogformat
- Also fix errors
This commit is contained in:
parent
633809a397
commit
0be8f2929f
3 changed files with 15 additions and 13 deletions
|
|
@ -26,7 +26,10 @@ cc_binary {
|
||||||
"vendor.eureka.hardware.fmradio-V3-ndk",
|
"vendor.eureka.hardware.fmradio-V3-ndk",
|
||||||
"vendor.eureka.hardware.audio_route-V1-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"],
|
init_rc: ["vendor.eureka.hardware.fmradio-service.rc"],
|
||||||
vintf_fragments: ["vendor.eureka.hardware.fmradio.xml"],
|
vintf_fragments: ["vendor.eureka.hardware.fmradio.xml"],
|
||||||
required: [
|
required: [
|
||||||
|
|
|
||||||
|
|
@ -130,10 +130,11 @@ namespace aidl::vendor::eureka::hardware::fmradio {
|
||||||
case SetType::SET_TYPE_FM_SEARCH_CANCEL:
|
case SetType::SET_TYPE_FM_SEARCH_CANCEL:
|
||||||
fm_radio_slsi::stop_search(fd);
|
fm_radio_slsi::stop_search(fd);
|
||||||
break;
|
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")));
|
auto svc = IAudioRoute::fromBinder(ndk::SpAIBinder(AServiceManager_waitForService("vendor.eureka.hardware.audio_route.IAudioRoute/default")));
|
||||||
svc->setParam(value ? "routing=2": "routing=8");
|
svc->setParam(value ? "routing=2": "routing=8");
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case SetType::SET_TYPE_FM_SEARCH_START:
|
case SetType::SET_TYPE_FM_SEARCH_START:
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
search_thread = std::thread([this] {
|
search_thread = std::thread([this] {
|
||||||
|
|
@ -142,25 +143,24 @@ namespace aidl::vendor::eureka::hardware::fmradio {
|
||||||
});
|
});
|
||||||
search_thread.detach();
|
search_thread.detach();
|
||||||
break;
|
break;
|
||||||
case SetType::SET_TYPE_FM_APP_PID:
|
case SetType::SET_TYPE_FM_APP_PID: {
|
||||||
client_observe_thread = std::thread([=] {
|
client_observe_thread = std::thread([=] {
|
||||||
pid_t pid = value;
|
pid_t pid = value;
|
||||||
|
|
||||||
LOG_D("%s: FM_APP_PID: recieved value %d", __func__, pid);
|
LOG_D("%s: FM_APP_PID: recieved value %d", __func__, pid);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (kill(pid, 0) < 0 && errno == ESRCH) break;
|
if (kill(pid, 0) < 0 && errno == ESRCH) break;
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(2));
|
std::this_thread::sleep_for(std::chrono::seconds(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_W("%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);
|
fm_radio_slsi::fm_thread_set(fd, 0);
|
||||||
auto svc = IAudioRoute::fromBinder(ndk::SpAIBinder(AServiceManager_waitForService("vendor.eureka.hardware.audio_route.IAudioRoute/default")));
|
auto svc = IAudioRoute::fromBinder(ndk::SpAIBinder(AServiceManager_waitForService("vendor.eureka.hardware.audio_route.IAudioRoute/default")));
|
||||||
svc->setParam("l_fmradio_mode=off");
|
svc->setParam("l_fmradio_mode=off");
|
||||||
close();
|
close();
|
||||||
}
|
});
|
||||||
client_observe_thread.detach();
|
client_observe_thread.detach();
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -42,11 +42,10 @@ constexpr const char *FM_DEV_PATH = "/dev/radio0";
|
||||||
int open_device(void) {
|
int open_device(void) {
|
||||||
int fd;
|
int fd;
|
||||||
if ((fd = open(FM_DEV_PATH, O_RDWR | O_CLOEXEC)) < 0) {
|
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,
|
LOG_E("Failed to open %s, %d (%s)", FM_DEV_PATH, errno, strerror(-errno));
|
||||||
strerror(-errno));
|
|
||||||
return -1;
|
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;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -66,7 +65,7 @@ int get_frequency(const int fd, int *channel) {
|
||||||
|
|
||||||
*channel = static_cast<int>(freq.frequency) / 16000;
|
*channel = static_cast<int>(freq.frequency) / 16000;
|
||||||
|
|
||||||
LOG(DEBUG) << make_str("Channel freq: %d", *channel);
|
LOG_D("Channel freq: %d", *channel);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -74,7 +73,7 @@ void set_frequency(const int fd, int channel) {
|
||||||
struct v4l2_frequency freq {};
|
struct v4l2_frequency freq {};
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
LOG(DEBUG) << make_str("Channel freq: %d", channel);
|
LOG_D("Channel freq: %d", channel);
|
||||||
|
|
||||||
freq.tuner = 0;
|
freq.tuner = 0;
|
||||||
freq.type = V4L2_TUNER_RADIO;
|
freq.type = V4L2_TUNER_RADIO;
|
||||||
|
|
@ -90,7 +89,7 @@ static int set_control(const int fd, unsigned int id, int val) {
|
||||||
int ret;
|
int ret;
|
||||||
ctrl.id = id;
|
ctrl.id = id;
|
||||||
|
|
||||||
LOG(DEBUG) << make_str("Control value: %d", val);
|
LOG_D("Control value: %d", val);
|
||||||
|
|
||||||
if (val)
|
if (val)
|
||||||
ctrl.value = static_cast<unsigned int>(val);
|
ctrl.value = static_cast<unsigned int>(val);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue