mirror of
https://github.com/chararomandroid/android_device_samsung_a20
synced 2026-08-23 12:35:33 -04:00
universal7885: Remove LineageOS hardware samsung deps
And track it with vendorsetup.sh
This commit is contained in:
parent
a7ef8f2b7e
commit
e53d5db120
101 changed files with 3 additions and 3387 deletions
|
|
@ -0,0 +1,12 @@
|
|||
hidl_interface {
|
||||
name: "vendor.eureka.hardware.fmradio@1.0",
|
||||
root: "vendor.eureka",
|
||||
srcs: [
|
||||
"types.hal",
|
||||
"IFMRadio.hal",
|
||||
],
|
||||
interfaces: [
|
||||
"android.hidl.base@1.0",
|
||||
],
|
||||
gen_java: true,
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
// 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.
|
||||
|
||||
package vendor.eureka.hardware.fmradio@1.0;
|
||||
|
||||
interface IFMRadio {
|
||||
setManualFreq(float freq);
|
||||
adjustFreqByStep(Direction dir);
|
||||
};
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
// 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.
|
||||
|
||||
package vendor.eureka.hardware.fmradio@1.0;
|
||||
|
||||
enum Direction : int32_t {
|
||||
UP,
|
||||
DOWN,
|
||||
};
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
hidl_interface {
|
||||
name: "vendor.eureka.hardware.fmradio@1.1",
|
||||
root: "vendor.eureka",
|
||||
srcs: [
|
||||
"types.hal",
|
||||
"IFMRadio.hal",
|
||||
],
|
||||
interfaces: [
|
||||
"android.hidl.base@1.0",
|
||||
"vendor.eureka.hardware.fmradio@1.0",
|
||||
],
|
||||
gen_java: true,
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
// 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.
|
||||
|
||||
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);
|
||||
};
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
// 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.
|
||||
|
||||
package vendor.eureka.hardware.fmradio@1.1;
|
||||
|
||||
enum Status : int32_t {
|
||||
YES,
|
||||
NO,
|
||||
};
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
hidl_interface {
|
||||
name: "vendor.eureka.hardware.fmradio@1.2",
|
||||
root: "vendor.eureka",
|
||||
srcs: [
|
||||
"types.hal",
|
||||
"IFMRadio.hal",
|
||||
],
|
||||
interfaces: [
|
||||
"android.hidl.base@1.0",
|
||||
"vendor.eureka.hardware.fmradio@1.1",
|
||||
"vendor.eureka.hardware.fmradio@1.0",
|
||||
],
|
||||
gen_java: true,
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
// 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.
|
||||
|
||||
package vendor.eureka.hardware.fmradio@1.2;
|
||||
|
||||
import @1.1::IFMRadio;
|
||||
|
||||
interface IFMRadio extends @1.1::IFMRadio {
|
||||
setChannelSpacing(Space space);
|
||||
getChannelSpacing() generates (Space space);
|
||||
};
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
// FIXME: your file license if you have one
|
||||
|
||||
cc_binary {
|
||||
name: "vendor.eureka.hardware.fmradio@1.2-service",
|
||||
srcs: [
|
||||
"FMRadio.cpp",
|
||||
"service.cpp",
|
||||
],
|
||||
shared_libs: [
|
||||
"libhidlbase",
|
||||
"libutils",
|
||||
"liblog",
|
||||
"vendor.eureka.hardware.fmradio@1.0",
|
||||
"vendor.eureka.hardware.fmradio@1.1",
|
||||
"vendor.eureka.hardware.fmradio@1.2",
|
||||
],
|
||||
init_rc: [ "vendor.eureka.hardware.fmradio@1.2-service.rc" ],
|
||||
vintf_fragments: [ "vendor.eureka.hardware.fmradio@1.2.xml" ],
|
||||
}
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
// 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/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
static int mChannelSpacing = 3;
|
||||
|
||||
namespace vendor::eureka::hardware::fmradio::V1_2 {
|
||||
|
||||
Return<void> FMRadio::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> FMRadio::adjustFreqByStep(fmradio::V1_0::Direction dir) {
|
||||
std::ofstream file;
|
||||
std::string value = "";
|
||||
if (dir == V1_0::Direction::UP) {
|
||||
value = "1 " + std::to_string(mChannelSpacing * 10);
|
||||
} else if (dir == V1_0::Direction::DOWN) {
|
||||
value = "0 " + std::to_string(mChannelSpacing * 10);
|
||||
}
|
||||
file.open("/sys/devices/virtual/s610_radio/s610_radio/radio_freq_seek");
|
||||
file << value;
|
||||
file.close();
|
||||
return Void();
|
||||
}
|
||||
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;
|
||||
} else {
|
||||
return V1_1::Status::YES;
|
||||
}
|
||||
}
|
||||
Return<void> FMRadio::setChannelSpacing(V1_2::Space space) {
|
||||
mChannelSpacing = (int)space;
|
||||
return Void();
|
||||
}
|
||||
Return<int32_t> FMRadio::getFreqFromSysfs() {
|
||||
std::ifstream file;
|
||||
std::string value;
|
||||
file.open("/sys/devices/virtual/s610_radio/s610_radio/radio_freq_ctrl");
|
||||
std::getline(file, value);
|
||||
file.close();
|
||||
return std::stoi(value);
|
||||
}
|
||||
Return<V1_2::Space> FMRadio::getChannelSpacing() {
|
||||
switch (mChannelSpacing) {
|
||||
case 1:
|
||||
return V1_2::Space::CHANNEL_SPACING_10HZ;
|
||||
case 2:
|
||||
return V1_2::Space::CHANNEL_SPACING_20HZ;
|
||||
case 3:
|
||||
return V1_2::Space::CHANNEL_SPACING_30HZ;
|
||||
case 4:
|
||||
return V1_2::Space::CHANNEL_SPACING_40HZ;
|
||||
case 5:
|
||||
return V1_2::Space::CHANNEL_SPACING_50HZ;
|
||||
default:
|
||||
return V1_2::Space::CHANNEL_SPACING_30HZ;
|
||||
}
|
||||
}
|
||||
IFMRadio *FMRadio::getInstance(void) { return new FMRadio(); }
|
||||
} // namespace vendor::eureka::hardware::fmradio::V1_2
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
// 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.2/IFMRadio.h>
|
||||
|
||||
namespace vendor::eureka::hardware::fmradio::V1_2 {
|
||||
|
||||
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(V1_0::Direction dir);
|
||||
// Methods from ::vendor::eureka::hardware::fmradio::V1_1::IFMRadio follow.
|
||||
Return<V1_1::Status> isAvailable();
|
||||
Return<int32_t> getFreqFromSysfs();
|
||||
// Methods from ::vendor::eureka::hardware::fmradio::V1_2::IFMRadio follow.
|
||||
Return<void> setChannelSpacing(V1_2::Space space);
|
||||
Return<V1_2::Space> getChannelSpacing();
|
||||
// Methods from ::android::hidl::base::V1_0::IBase follow.
|
||||
static IFMRadio *getInstance(void);
|
||||
};
|
||||
} // namespace vendor::eureka::hardware::fmradio::V1_2
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
// 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.2-service"
|
||||
|
||||
#include <vendor/eureka/hardware/fmradio/1.2/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_2::FMRadio;
|
||||
using vendor::eureka::hardware::fmradio::V1_2::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
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
service fm-hal /system/bin/vendor.eureka.hardware.fmradio@1.2-service
|
||||
interface vendor.eureka.hardware.fmradio@1.0::IFMRadio default
|
||||
interface vendor.eureka.hardware.fmradio@1.1::IFMRadio default
|
||||
interface vendor.eureka.hardware.fmradio@1.2::IFMRadio default
|
||||
class hal
|
||||
user root
|
||||
group root
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
<manifest version="1.0" type="framework">
|
||||
<hal>
|
||||
<name>vendor.eureka.hardware.fmradio</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>1.2</version>
|
||||
<interface>
|
||||
<name>IFMRadio</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
</manifest>
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
// 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.
|
||||
|
||||
package vendor.eureka.hardware.fmradio@1.2;
|
||||
|
||||
enum Space : int32_t {
|
||||
CHANNEL_SPACING_10HZ = 1,
|
||||
CHANNEL_SPACING_20HZ,
|
||||
CHANNEL_SPACING_30HZ,
|
||||
CHANNEL_SPACING_40HZ,
|
||||
CHANNEL_SPACING_50HZ = 5,
|
||||
};
|
||||
Loading…
Reference in a new issue