mirror of
https://github.com/chararomandroid/android_device_samsung_a20
synced 2026-08-21 19:55:33 -04:00
universal7885: FMRadio: jni: fix build errors
* Fix errors on FM HAL too Change-Id: I95885939d55efa0b400fe55d0a444f64d1f65a51 Signed-off-by: roynatech2544 <whiteshell2544@naver.com>
This commit is contained in:
parent
a51ae4d035
commit
6235756b90
3 changed files with 21 additions and 6 deletions
|
|
@ -7,7 +7,7 @@
|
|||
#include <unistd.h>
|
||||
#include <cerrno>
|
||||
#include <iostream>
|
||||
#include "fm.h"
|
||||
#include "s610_radio.h"
|
||||
#include "kernel_internal.h"
|
||||
#include <algorithm>
|
||||
#include <jni.h>
|
||||
|
|
@ -117,7 +117,7 @@ static int fm_radio_channel_searching(int fd, unsigned int upward, unsigned int
|
|||
{
|
||||
int ret;
|
||||
|
||||
ret = fm_radio_set_control(fd, V4L2_CID_S610_SEEK_MODE, FM_TUNER_AUTONOMOUS_SEARCH_MODE_NEXT);
|
||||
ret = fm_radio_set_control(fd, V4L2_CID_S610_SEEK_MODE, FM_TUNER_AUTONOMOUS_SEARCH_MODE);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
|
@ -194,6 +194,8 @@ bool contains(C&& c, T e) { return std::find(std::begin(c), std::end(c), e) != s
|
|||
static long fm_radio_get_freqs(int fd){
|
||||
long ret = 0;
|
||||
fm_radio_set_mute(fd, true);
|
||||
sp<IFMRadio> service = IFMRadio::getService();
|
||||
bool mSysfs = service->isAvailable() == Status::YES;
|
||||
for (long & track : tracks){
|
||||
if (mSysfs) {
|
||||
service->adjustFreqByStep(Direction::UP);
|
||||
|
|
@ -436,15 +438,28 @@ JNIEXPORT jint JNICALL
|
|||
Java_com_eurekateam_fmradio_NativeFMInterface_getNextChannel
|
||||
(__unused JNIEnv *env, __unused jobject thiz, jint fd) {
|
||||
long ret;
|
||||
fm_radio_channel_searching(fd, 1, 0, FM_CHANNEL_SPACING_100KHZ, &ret);
|
||||
sp<IFMRadio> service = IFMRadio::getService();
|
||||
bool mSysfs = service->isAvailable() == Status::YES;
|
||||
if (!mSysfs){
|
||||
fm_radio_channel_searching(fd, 1, 0, FM_CHANNEL_SPACING_100KHZ, &ret);
|
||||
} else {
|
||||
service->adjustFreqByStep(Direction::UP);
|
||||
ret = service->getFreqFromSysfs();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
extern "C"
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_eurekateam_fmradio_NativeFMInterface_getBeforeChannel
|
||||
(__unused JNIEnv *env, __unused jobject thiz, jint fd) {
|
||||
long ret;
|
||||
fm_radio_channel_searching(fd, 0, 0, FM_CHANNEL_SPACING_100KHZ, &ret);
|
||||
long ret;sp<IFMRadio> service = IFMRadio::getService();
|
||||
bool mSysfs = service->isAvailable() == Status::YES;
|
||||
if (!mSysfs){
|
||||
fm_radio_channel_searching(fd, 0, 0, FM_CHANNEL_SPACING_100KHZ, &ret);
|
||||
} else {
|
||||
service->adjustFreqByStep(Direction::DOWN);
|
||||
ret = service->getFreqFromSysfs();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ Return<void> FMRadio::adjustFreqByStep(fmradio::V1_0::Direction dir) {
|
|||
file.close();
|
||||
return Void();
|
||||
}
|
||||
Return<int32_t> IFMRadio::isAvailable(){
|
||||
Return<V1_1::Status> FMRadio::isAvailable(){
|
||||
struct stat info;
|
||||
if(stat("/sys/devices/virtual/s610_radio/s610_radio/", &info ) != 0) {
|
||||
return V1_1::Status::NO;
|
||||
|
|
|
|||
Loading…
Reference in a new issue