mirror of
https://github.com/chararomandroid/android_device_samsung_a20
synced 2026-08-23 20:45:31 -04:00
universal7885: interfaces: Implement FMRadio HAL V1.2
* Also, track our fork of OneUI theme lib
* Implement read from sysfs interface which can fix channel searching on some cases
* Commit link: fead45ba0e
Change-Id: I81532b7f8169637fdcad0f678790a2b1f1888ecc
Signed-off-by: roynatech2544 <whiteshell2544@naver.com>
This commit is contained in:
parent
02eded67c8
commit
e07865c670
14 changed files with 140 additions and 25 deletions
|
|
@ -17,5 +17,6 @@ package vendor.eureka.hardware.fmradio@1.1;
|
|||
import @1.0::IFMRadio;
|
||||
|
||||
interface IFMRadio extends @1.0::IFMRadio {
|
||||
getFreqFromSysfs() generates (int32_t freq);
|
||||
isAvailable() generates (Status status);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,20 +0,0 @@
|
|||
// FIXME: your file license if you have one
|
||||
|
||||
cc_binary {
|
||||
name: "vendor.eureka.hardware.fmradio@1.1-service",
|
||||
relative_install_path: "hw",
|
||||
proprietary: true,
|
||||
srcs: [
|
||||
"FMRadio.cpp",
|
||||
"service.cpp",
|
||||
],
|
||||
shared_libs: [
|
||||
"libhidlbase",
|
||||
"libutils",
|
||||
"liblog",
|
||||
"vendor.eureka.hardware.fmradio@1.0",
|
||||
"vendor.eureka.hardware.fmradio@1.1",
|
||||
],
|
||||
init_rc: [ "vendor.eureka.hardware.fmradio@1.1-service.rc" ],
|
||||
vintf_fragments: [ "vendor.eureka.hardware.fmradio@1.1.xml" ],
|
||||
}
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
// Copyright (C) 2021 Eureka Team
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "FMRadio.h"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
namespace vendor::eureka::hardware::fmradio::V1_1 {
|
||||
|
||||
Return<void> IFMRadio::setManualFreq(float freq) {
|
||||
std::ofstream file;
|
||||
file.open("/sys/devices/virtual/s610_radio/s610_radio/radio_freq_ctrl");
|
||||
file << freq * 1000;
|
||||
file.close();
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> IFMRadio::adjustFreqByStep(fmradio::V1_0::Direction dir) {
|
||||
std::ofstream file;
|
||||
std::string value = "";
|
||||
if (dir == Direction::UP){
|
||||
value = "1 50";
|
||||
} else if (dir == Direction::DOWN){
|
||||
value = "0 50";
|
||||
}
|
||||
file.open("/sys/devices/virtual/s610_radio/s610_radio/radio_freq_seek");
|
||||
file << value;
|
||||
file.close();
|
||||
return Void();
|
||||
}
|
||||
Return<int32_t> IFMRadio::isAvailable(){
|
||||
struct stat info;
|
||||
if(stat("/sys/devices/virtual/s610_radio/s610_radio/", &info ) != 0) {
|
||||
return Status::NO;
|
||||
else
|
||||
return Status::YES;
|
||||
}
|
||||
}
|
||||
IFMRadio* IFMRadio::getInstance(void) {
|
||||
return new FMRadio();
|
||||
}
|
||||
} // namespace vendor::eureka::hardware::fmradio::V1_0
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
// Copyright (C) 2021 Eureka Team
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <hidl/MQDescriptor.h>
|
||||
#include <hidl/Status.h>
|
||||
#include <vendor/eureka/hardware/fmradio/1.1/IFMRadio.h>
|
||||
|
||||
namespace vendor::eureka::hardware::fmradio::V1_1 {
|
||||
|
||||
using ::android::sp;
|
||||
using ::android::hardware::hidl_array;
|
||||
using ::android::hardware::hidl_memory;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::Return;
|
||||
using ::android::hardware::Void;
|
||||
|
||||
struct FMRadio : public IFMRadio {
|
||||
// Methods from ::vendor::eureka::hardware::fmradio::V1_0::IFMRadio follow.
|
||||
Return<void> setManualFreq(float freq);
|
||||
Return<void> adjustFreqByStep(Direction dir);
|
||||
// Methods from ::vendor::eureka::hardware::fmradio::V1_1::IFMRadio follow.
|
||||
Return<int32_t> isAvailable();
|
||||
// Methods from ::android::hidl::base::V1_0::IBase follow.
|
||||
static IFMRadio* getInstance(void);
|
||||
};
|
||||
} // namespace vendor::eureka::hardware::parts::V1_0
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
// Copyright (C) 2021 Eureka Team
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#define LOG_TAG "vendor.eureka.hardware.fmradio@1.0-service"
|
||||
|
||||
#include <vendor/eureka/hardware/fmradio/1.1/IFMRadio.h>
|
||||
|
||||
#include <hidl/LegacySupport.h>
|
||||
|
||||
#include "FMRadio.h"
|
||||
|
||||
using android::sp;
|
||||
using android::hardware::configureRpcThreadpool;
|
||||
using android::hardware::joinRpcThreadpool;
|
||||
using vendor::eureka::hardware::fmradio::V1_1::FMRadio;
|
||||
using vendor::eureka::hardware::fmradio::V1_1::IFMRadio;
|
||||
|
||||
int main() {
|
||||
int ret;
|
||||
android::sp<IFMRadio> mFMService = FMRadio::getInstance();
|
||||
configureRpcThreadpool(1, true /*callerWillJoin*/);
|
||||
|
||||
if (mFMService != nullptr) {
|
||||
ret = mFMService->registerAsService();
|
||||
if (ret != 0) {
|
||||
ALOGE("Can't register instance of FMRadio HAL, nullptr");
|
||||
} else {
|
||||
ALOGI("registered FMRadio HAL");
|
||||
}
|
||||
} else {
|
||||
ALOGE("Can't create instance of FMRadio HAL, nullptr");
|
||||
}
|
||||
joinRpcThreadpool();
|
||||
|
||||
return -1; // should never get here
|
||||
}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
service vendor.parts-hal /vendor/bin/hw/vendor.eureka.hardware.fmradio@1.1-service
|
||||
interface vendor.eureka.hardware.fmradio@1.0::IFMRadio default
|
||||
interface vendor.eureka.hardware.fmradio@1.1::IFMRadio default
|
||||
class hal
|
||||
user root
|
||||
group root
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
<manifest version="1.0" type="device">
|
||||
<hal format="hidl">
|
||||
<name>vendor.eureka.hardware.fmradio</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>1.1</version>
|
||||
<interface>
|
||||
<name>IFMRadio</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
</manifest>
|
||||
Loading…
Reference in a new issue