mirror of
https://github.com/chararomandroid/android_device_samsung_a20
synced 2026-08-21 11:55:31 -04:00
universal7885: fm-aidl: Unlock and relock to thread
This commit is contained in:
parent
dc4fffda82
commit
5a70eb4ed3
2 changed files with 4 additions and 2 deletions
|
|
@ -123,9 +123,10 @@ namespace aidl::vendor::eureka::hardware::fmradio {
|
|||
svc->setParam(value ? "routing=2": "routing=8");
|
||||
break;
|
||||
case SetType::SET_TYPE_FM_SEARCH_START:
|
||||
lock.unlock();
|
||||
search_thread = std::thread([this] {
|
||||
const std::lock_guard<std::timed_mutex> guard(lock);
|
||||
freqs_list = fm_radio_slsi::get_freqs(fd);
|
||||
lock.unlock();
|
||||
});
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -99,14 +99,15 @@ constexpr const char *FM_FREQ_SEEK = FM_SYSFS_BASE "/radio_freq_seek";
|
|||
case SetType::SET_TYPE_FM_SPEAKER_ROUTE:
|
||||
NOT_SUPPORTED;
|
||||
case SetType::SET_TYPE_FM_SEARCH_START:
|
||||
lock.unlock();
|
||||
search_thread = std::thread([this] {
|
||||
const std::lock_guard<std::timed_mutex> guard(lock);
|
||||
for (int i = 0; i < TRACK_SIZE; i++) {
|
||||
FileIO::writeline(FM_FREQ_SEEK, "1 " + std::to_string(SYSFS_SPACING * 10));
|
||||
int freq = FileIO::readline(FM_FREQ_CTL);
|
||||
if (std::find(freqs_list.begin(), freqs_list.end(), freq) != freqs_list.end()) continue;
|
||||
freqs_list.push_back(freq);
|
||||
}
|
||||
lock.unlock();
|
||||
});
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
Loading…
Reference in a new issue