Compare commits
70 Commits
android-15
...
android-14
Author | SHA1 | Date | |
---|---|---|---|
|
aae877dbf2 | ||
|
855377ee7b | ||
|
f9d6193d48 | ||
|
57db924c6f | ||
|
16a8f39afe | ||
|
a4011dd87b | ||
|
b6920bdf66 | ||
|
85f42d2b4d | ||
|
90ac461e90 | ||
|
62eb1144d2 | ||
|
77d8790ce1 | ||
|
a01ce599e7 | ||
|
94c7ada425 | ||
|
866bf15787 | ||
|
d6b9ffa0a7 | ||
|
c163d769fd | ||
|
efd4ccabbe | ||
|
8d1405c02b | ||
|
12cca4b6d9 | ||
|
0356cfa6cb | ||
|
75789c00c9 | ||
|
39e664fbae | ||
|
966588f8a6 | ||
|
203595a7e3 | ||
|
3013eb147b | ||
|
17ce2e5af8 | ||
|
d3724efd6d | ||
|
d032c4dd63 | ||
|
1c66db5f75 | ||
|
94162a0ec8 | ||
|
9bf3646dc7 | ||
|
4445fb6814 | ||
|
e56edf1c7b | ||
|
f13adde9c0 | ||
|
599a4858f5 | ||
|
c2723ef018 | ||
|
9a884b980e | ||
|
83404b1c04 | ||
|
6ed5200894 | ||
|
f1dd2ce2df | ||
|
3674a40bcc | ||
|
637bc3f0cd | ||
|
5b869ecb56 | ||
|
701855aaac | ||
|
625166b4d3 | ||
|
bbfd9e6e92 | ||
|
defbbe6ab4 | ||
|
0151cc35c1 | ||
|
e8e50c8c90 | ||
|
7c4843cf48 | ||
|
20c58262fd | ||
|
edafb8762a | ||
|
827581e630 | ||
|
357c27c66a | ||
|
193a130304 | ||
|
6847630ded | ||
|
cab82fc38b | ||
|
a91af8e006 | ||
|
73f0cd203e | ||
|
bb3e644c33 | ||
|
916defaa99 | ||
|
0bd20356b5 | ||
|
f46a3147b5 | ||
|
19ef389da0 | ||
|
636758597a | ||
|
326970f4a3 | ||
|
0e1881ba62 | ||
|
ab13933b14 | ||
|
e678256e73 | ||
|
634793829f |
@@ -6,12 +6,7 @@
|
||||
|
||||
DEVICE_PATH := device/brcm/rpi4
|
||||
|
||||
# Platform
|
||||
TARGET_NO_BOOTLOADER := true
|
||||
TARGET_NO_RECOVERY := true
|
||||
|
||||
TARGET_BOARD_PLATFORM := rpi
|
||||
|
||||
# Architecture
|
||||
TARGET_ARCH := arm64
|
||||
TARGET_ARCH_VARIANT := armv8-a
|
||||
TARGET_CPU_ABI := arm64-v8a
|
||||
@@ -25,9 +20,11 @@ TARGET_2ND_CPU_ABI2 := armeabi
|
||||
TARGET_2ND_CPU_VARIANT := generic
|
||||
|
||||
# Bluetooth
|
||||
BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := $(DEVICE_PATH)/bluetooth
|
||||
BOARD_HAVE_BLUETOOTH := true
|
||||
|
||||
# Bootloader
|
||||
TARGET_NO_BOOTLOADER := true
|
||||
|
||||
# Camera
|
||||
BOARD_LIBCAMERA_IPAS := rpi/vc4
|
||||
BOARD_LIBCAMERA_PIPELINES := rpi/vc4
|
||||
@@ -55,24 +52,29 @@ DEVICE_MATRIX_FILE := $(DEVICE_PATH)/compatibility_matrix.xml
|
||||
# Partition sizes
|
||||
BOARD_FLASH_BLOCK_SIZE := 4096
|
||||
BOARD_BOOTIMAGE_PARTITION_SIZE := 134217728 # 128M
|
||||
BOARD_SYSTEMIMAGE_PARTITION_SIZE := 2147483648 # 2048M
|
||||
BOARD_SYSTEMIMAGE_PARTITION_SIZE := 2684354560 # 2560M
|
||||
BOARD_USERDATAIMAGE_PARTITION_SIZE := 134217728 # 128M
|
||||
BOARD_VENDORIMAGE_PARTITION_SIZE := 268435456 # 256M
|
||||
BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
|
||||
TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true
|
||||
TARGET_USERIMAGES_USE_EXT4 := true
|
||||
|
||||
# Platform
|
||||
TARGET_BOARD_PLATFORM := bcm2711
|
||||
TARGET_BOOTLOADER_BOARD_NAME := bcm2711
|
||||
|
||||
# Properties
|
||||
TARGET_VENDOR_PROP += $(DEVICE_PATH)/vendor.prop
|
||||
|
||||
# Recovery
|
||||
TARGET_NO_RECOVERY := true
|
||||
|
||||
# SELinux
|
||||
BOARD_SEPOLICY_DIRS += device/brcm/rpi4/sepolicy
|
||||
BOARD_KERNEL_CMDLINE += androidboot.selinux=permissive
|
||||
|
||||
# Treble
|
||||
BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true
|
||||
BOARD_VNDK_VERSION := current
|
||||
PRODUCT_FULL_TREBLE_OVERRIDE := true
|
||||
TARGET_COPY_OUT_VENDOR := vendor
|
||||
|
||||
# Virtualization
|
||||
|
@@ -1 +1 @@
|
||||
Raspberry Vanilla AOSP 15 device configuration for Raspberry Pi 4.
|
||||
Raspberry Vanilla AOSP 14 device configuration for Raspberry Pi 4.
|
||||
|
@@ -15,9 +15,8 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/full_base.mk)
|
||||
# Overlays
|
||||
PRODUCT_PACKAGES += \
|
||||
AndroidRpiOverlay \
|
||||
BluetoothRpiOverlay \
|
||||
SettingsProviderRpiOverlay \
|
||||
SettingsRpiOverlay \
|
||||
SettingsProviderRpiOverlay \
|
||||
SystemUIRpiOverlay \
|
||||
WifiRpiOverlay
|
||||
|
||||
@@ -29,6 +28,5 @@ PRODUCT_COPY_FILES += \
|
||||
PRODUCT_DEVICE := rpi4
|
||||
PRODUCT_NAME := aosp_rpi4
|
||||
PRODUCT_BRAND := Raspberry
|
||||
PRODUCT_MODEL := Raspberry Pi 4
|
||||
PRODUCT_MODEL := Pi 4
|
||||
PRODUCT_MANUFACTURER := Raspberry
|
||||
PRODUCT_RELEASE_NAME := Raspberry Pi 4
|
||||
|
@@ -7,7 +7,7 @@
|
||||
# Inherit device configuration
|
||||
$(call inherit-product, device/brcm/rpi4/device.mk)
|
||||
|
||||
DEVICE_CAR_PATH := device/brcm/rpi4/car
|
||||
DEVICE_PATH_CAR := device/brcm/rpi4/car
|
||||
|
||||
PRODUCT_AAPT_CONFIG := normal mdpi hdpi
|
||||
PRODUCT_AAPT_PREF_CONFIG := hdpi
|
||||
@@ -20,12 +20,14 @@ PRODUCT_PACKAGES += \
|
||||
android.hardware.automotive.audiocontrol-service.example
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
$(DEVICE_CAR_PATH)/car_audio_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/car_audio_configuration.xml
|
||||
$(DEVICE_PATH_CAR)/car_audio_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/car_audio_configuration.xml
|
||||
|
||||
# Bluetooth
|
||||
PRODUCT_VENDOR_PROPERTIES += \
|
||||
bluetooth.device.class_of_device=38,4,8 \
|
||||
bluetooth.profile.a2dp.source.enabled=false \
|
||||
bluetooth.profile.asha.central.enabled=false \
|
||||
bluetooth.profile.avrcp.target.enabled=false \
|
||||
bluetooth.profile.bap.broadcast.assist.enabled=false \
|
||||
bluetooth.profile.bap.unicast.client.enabled=false \
|
||||
bluetooth.profile.bas.client.enabled=false \
|
||||
@@ -35,7 +37,6 @@ PRODUCT_VENDOR_PROPERTIES += \
|
||||
bluetooth.profile.hfp.ag.enabled=false \
|
||||
bluetooth.profile.hid.device.enabled=false \
|
||||
bluetooth.profile.hid.host.enabled=false \
|
||||
bluetooth.profile.map.client.enabled=false \
|
||||
bluetooth.profile.map.server.enabled=false \
|
||||
bluetooth.profile.mcp.server.enabled=false \
|
||||
bluetooth.profile.opp.enabled=false \
|
||||
@@ -64,7 +65,7 @@ PRODUCT_PACKAGES += \
|
||||
|
||||
# Display
|
||||
PRODUCT_COPY_FILES += \
|
||||
$(DEVICE_CAR_PATH)/display_settings.xml:$(TARGET_COPY_OUT_VENDOR)/etc/display_settings.xml
|
||||
$(DEVICE_PATH_CAR)/display_settings.xml:$(TARGET_COPY_OUT_VENDOR)/etc/display_settings.xml
|
||||
|
||||
# EVS
|
||||
ENABLE_CAREVSSERVICE_SAMPLE := true
|
||||
@@ -73,7 +74,7 @@ ENABLE_EVS_SERVICE := true
|
||||
ENABLE_REAR_VIEW_CAMERA_SAMPLE := true
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
$(DEVICE_CAR_PATH)/evs_config_override.json:${TARGET_COPY_OUT_VENDOR}/etc/automotive/evs/config_override.json
|
||||
$(DEVICE_PATH_CAR)/evs_config_override.json:${TARGET_COPY_OUT_VENDOR}/etc/automotive/evs/config_override.json
|
||||
|
||||
# Occupant awareness
|
||||
PRODUCT_PACKAGES += \
|
||||
@@ -84,7 +85,6 @@ include packages/services/Car/car_product/occupant_awareness/OccupantAwareness.m
|
||||
# Overlays
|
||||
PRODUCT_PACKAGES += \
|
||||
AndroidRpiOverlay \
|
||||
BluetoothRpiOverlay \
|
||||
CarServiceRpiOverlay \
|
||||
SettingsProviderRpiOverlay \
|
||||
WifiRpiOverlay
|
||||
@@ -102,6 +102,5 @@ PRODUCT_PACKAGES += \
|
||||
PRODUCT_DEVICE := rpi4
|
||||
PRODUCT_NAME := aosp_rpi4_car
|
||||
PRODUCT_BRAND := Raspberry
|
||||
PRODUCT_MODEL := Raspberry Pi 4
|
||||
PRODUCT_MODEL := Pi 4
|
||||
PRODUCT_MANUFACTURER := Raspberry
|
||||
PRODUCT_RELEASE_NAME := Raspberry Pi 4
|
||||
|
@@ -30,7 +30,6 @@ PRODUCT_COPY_FILES += \
|
||||
# Overlays
|
||||
PRODUCT_PACKAGES += \
|
||||
AndroidTvRpiOverlay \
|
||||
BluetoothRpiOverlay \
|
||||
SettingsProviderTvRpiOverlay \
|
||||
WifiRpiOverlay
|
||||
|
||||
@@ -38,6 +37,5 @@ PRODUCT_PACKAGES += \
|
||||
PRODUCT_DEVICE := rpi4
|
||||
PRODUCT_NAME := aosp_rpi4_tv
|
||||
PRODUCT_BRAND := Raspberry
|
||||
PRODUCT_MODEL := Raspberry Pi 4
|
||||
PRODUCT_MODEL := Pi 4
|
||||
PRODUCT_MANUFACTURER := Raspberry
|
||||
PRODUCT_RELEASE_NAME := Raspberry Pi 4
|
||||
|
@@ -57,6 +57,9 @@
|
||||
#define CHANNEL_STEREO 2
|
||||
#define MIN_WRITE_SLEEP_US 5000
|
||||
|
||||
int pcm_card;
|
||||
int pcm_device;
|
||||
|
||||
struct stub_stream_in {
|
||||
struct audio_stream_in stream;
|
||||
};
|
||||
@@ -148,7 +151,7 @@ static int start_output_stream(struct alsa_stream_out *out)
|
||||
out->config.start_threshold = PLAYBACK_PERIOD_START_THRESHOLD * PERIOD_SIZE;
|
||||
out->config.avail_min = PERIOD_SIZE;
|
||||
|
||||
out->pcm = pcm_open(get_pcm_card(), get_pcm_device(), PCM_OUT | PCM_MMAP | PCM_NOIRQ | PCM_MONOTONIC, &out->config);
|
||||
out->pcm = pcm_open(pcm_card, pcm_device, PCM_OUT | PCM_MMAP | PCM_NOIRQ | PCM_MONOTONIC, &out->config);
|
||||
|
||||
if (!pcm_is_ready(out->pcm)) {
|
||||
ALOGE("cannot open pcm_out driver: %s", pcm_get_error(out->pcm));
|
||||
@@ -484,7 +487,7 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
|
||||
struct pcm_params *params;
|
||||
int ret = 0;
|
||||
|
||||
params = pcm_params_get(get_pcm_card(), get_pcm_device(), PCM_OUT);
|
||||
params = pcm_params_get(pcm_card, pcm_device, PCM_OUT);
|
||||
if (!params)
|
||||
return -ENOSYS;
|
||||
|
||||
@@ -690,6 +693,10 @@ static int adev_open(const hw_module_t* module, const char* name,
|
||||
|
||||
ALOGV("adev_open: %s", name);
|
||||
|
||||
pcm_card = get_pcm_card();
|
||||
pcm_device = get_pcm_device();
|
||||
ALOGI("adev_open: pcm_card %d, pcm_device %d", pcm_card, pcm_device);
|
||||
|
||||
if (strcmp(name, AUDIO_HARDWARE_INTERFACE) != 0)
|
||||
return -EINVAL;
|
||||
|
||||
|
@@ -55,6 +55,8 @@
|
||||
#define CHANNEL_STEREO 2
|
||||
#define MIN_WRITE_SLEEP_US 5000
|
||||
|
||||
char device_name[PROPERTY_VALUE_MAX];
|
||||
|
||||
struct stub_stream_in {
|
||||
struct audio_stream_in stream;
|
||||
};
|
||||
@@ -101,8 +103,6 @@ static int start_output_stream(struct alsa_stream_out *out)
|
||||
if (out->unavailable)
|
||||
return -ENODEV;
|
||||
|
||||
char device_name[PROPERTY_VALUE_MAX];
|
||||
get_alsa_device_name(device_name);
|
||||
ALOGI("start_output_stream: %s", device_name);
|
||||
|
||||
int r;
|
||||
@@ -717,6 +717,9 @@ static int adev_open(const hw_module_t* module, const char* name,
|
||||
|
||||
ALOGV("adev_open: %s", name);
|
||||
|
||||
get_alsa_device_name(device_name);
|
||||
ALOGI("adev_open: %s", device_name);
|
||||
|
||||
if (strcmp(name, AUDIO_HARDWARE_INTERFACE) != 0)
|
||||
return -EINVAL;
|
||||
|
||||
|
@@ -1,33 +0,0 @@
|
||||
// Copyright (C) 2020 The Android Open Source Project
|
||||
// Copyright (C) 2024 KonstaKANG
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
cc_binary {
|
||||
name: "android.hardware.bluetooth-service.rpi",
|
||||
relative_install_path: "hw",
|
||||
init_rc: ["bluetooth-service-rpi.rc"],
|
||||
vintf_fragments: ["bluetooth-service-rpi.xml"],
|
||||
vendor: true,
|
||||
cflags: [
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
],
|
||||
srcs: [
|
||||
"BluetoothHci.cpp",
|
||||
"net_bluetooth_mgmt.cpp",
|
||||
"service.cpp",
|
||||
],
|
||||
shared_libs: [
|
||||
"android.hardware.bluetooth-V1-ndk",
|
||||
"libbase",
|
||||
"libbinder_ndk",
|
||||
"libhidlbase",
|
||||
"liblog",
|
||||
"libutils",
|
||||
],
|
||||
static_libs: [
|
||||
"android.hardware.bluetooth.async",
|
||||
"android.hardware.bluetooth.hci",
|
||||
],
|
||||
}
|
@@ -1,227 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
* Copyright (C) 2024 KonstaKANG
|
||||
*
|
||||
* 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 "android.hardware.bluetooth.service.rpi"
|
||||
|
||||
#include "BluetoothHci.h"
|
||||
|
||||
#include "log/log.h"
|
||||
|
||||
using namespace ::android::hardware::bluetooth::hci;
|
||||
using namespace ::android::hardware::bluetooth::async;
|
||||
using aidl::android::hardware::bluetooth::Status;
|
||||
|
||||
namespace aidl::android::hardware::bluetooth::impl {
|
||||
|
||||
void OnDeath(void* cookie);
|
||||
|
||||
class BluetoothDeathRecipient {
|
||||
public:
|
||||
BluetoothDeathRecipient(BluetoothHci* hci) : mHci(hci) {}
|
||||
|
||||
void LinkToDeath(const std::shared_ptr<IBluetoothHciCallbacks>& cb) {
|
||||
mCb = cb;
|
||||
clientDeathRecipient_ = AIBinder_DeathRecipient_new(OnDeath);
|
||||
auto linkToDeathReturnStatus = AIBinder_linkToDeath(
|
||||
mCb->asBinder().get(), clientDeathRecipient_, this /* cookie */);
|
||||
LOG_ALWAYS_FATAL_IF(linkToDeathReturnStatus != STATUS_OK,
|
||||
"Unable to link to death recipient");
|
||||
}
|
||||
|
||||
void UnlinkToDeath(const std::shared_ptr<IBluetoothHciCallbacks>& cb) {
|
||||
LOG_ALWAYS_FATAL_IF(cb != mCb, "Unable to unlink mismatched pointers");
|
||||
}
|
||||
|
||||
void serviceDied() {
|
||||
if (mCb != nullptr && !AIBinder_isAlive(mCb->asBinder().get())) {
|
||||
ALOGE("Bluetooth remote service has died");
|
||||
} else {
|
||||
ALOGE("BluetoothDeathRecipient::serviceDied called but service not dead");
|
||||
return;
|
||||
}
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(mHasDiedMutex);
|
||||
has_died_ = true;
|
||||
}
|
||||
mHci->close();
|
||||
}
|
||||
BluetoothHci* mHci;
|
||||
std::shared_ptr<IBluetoothHciCallbacks> mCb;
|
||||
AIBinder_DeathRecipient* clientDeathRecipient_;
|
||||
bool getHasDied() {
|
||||
std::lock_guard<std::mutex> guard(mHasDiedMutex);
|
||||
return has_died_;
|
||||
}
|
||||
|
||||
private:
|
||||
std::mutex mHasDiedMutex;
|
||||
bool has_died_{false};
|
||||
};
|
||||
|
||||
void OnDeath(void* cookie) {
|
||||
auto* death_recipient = static_cast<BluetoothDeathRecipient*>(cookie);
|
||||
death_recipient->serviceDied();
|
||||
}
|
||||
|
||||
BluetoothHci::BluetoothHci() {
|
||||
mDeathRecipient = std::make_shared<BluetoothDeathRecipient>(this);
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus BluetoothHci::initialize(
|
||||
const std::shared_ptr<IBluetoothHciCallbacks>& cb) {
|
||||
ALOGI(__func__);
|
||||
|
||||
if (cb == nullptr) {
|
||||
ALOGE("cb == nullptr! -> Unable to call initializationComplete(ERR)");
|
||||
return ndk::ScopedAStatus::fromServiceSpecificError(STATUS_BAD_VALUE);
|
||||
}
|
||||
|
||||
HalState old_state = HalState::READY;
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(mStateMutex);
|
||||
if (mState != HalState::READY) {
|
||||
old_state = mState;
|
||||
} else {
|
||||
mState = HalState::INITIALIZING;
|
||||
}
|
||||
}
|
||||
|
||||
if (old_state != HalState::READY) {
|
||||
ALOGE("initialize: Unexpected State %d", static_cast<int>(old_state));
|
||||
close();
|
||||
cb->initializationComplete(Status::ALREADY_INITIALIZED);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
mCb = cb;
|
||||
management_.reset(new NetBluetoothMgmt);
|
||||
mFd = management_->openHci();
|
||||
if (mFd < 0) {
|
||||
management_.reset();
|
||||
|
||||
ALOGI("Unable to open Linux interface.");
|
||||
mState = HalState::READY;
|
||||
cb->initializationComplete(Status::UNABLE_TO_OPEN_INTERFACE);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
mDeathRecipient->LinkToDeath(mCb);
|
||||
|
||||
mH4 = std::make_shared<H4Protocol>(
|
||||
mFd,
|
||||
[](const std::vector<uint8_t>& /* raw_command */) {
|
||||
LOG_ALWAYS_FATAL("Unexpected command!");
|
||||
},
|
||||
[this](const std::vector<uint8_t>& raw_acl) {
|
||||
mCb->aclDataReceived(raw_acl);
|
||||
},
|
||||
[this](const std::vector<uint8_t>& raw_sco) {
|
||||
mCb->scoDataReceived(raw_sco);
|
||||
},
|
||||
[this](const std::vector<uint8_t>& raw_event) {
|
||||
mCb->hciEventReceived(raw_event);
|
||||
},
|
||||
[this](const std::vector<uint8_t>& raw_iso) {
|
||||
mCb->isoDataReceived(raw_iso);
|
||||
},
|
||||
[this]() {
|
||||
ALOGI("HCI socket device disconnected");
|
||||
mFdWatcher.StopWatchingFileDescriptors();
|
||||
});
|
||||
mFdWatcher.WatchFdForNonBlockingReads(mFd,
|
||||
[this](int) { mH4->OnDataReady(); });
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(mStateMutex);
|
||||
mState = HalState::ONE_CLIENT;
|
||||
}
|
||||
ALOGI("initialization complete");
|
||||
auto status = mCb->initializationComplete(Status::SUCCESS);
|
||||
if (!status.isOk()) {
|
||||
if (!mDeathRecipient->getHasDied()) {
|
||||
ALOGE("Error sending init callback, but no death notification");
|
||||
}
|
||||
close();
|
||||
return ndk::ScopedAStatus::fromServiceSpecificError(
|
||||
STATUS_FAILED_TRANSACTION);
|
||||
}
|
||||
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus BluetoothHci::close() {
|
||||
ALOGI(__func__);
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(mStateMutex);
|
||||
if (mState != HalState::ONE_CLIENT) {
|
||||
LOG_ALWAYS_FATAL_IF(mState == HalState::INITIALIZING,
|
||||
"mState is INITIALIZING");
|
||||
ALOGI("Already closed");
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
mState = HalState::CLOSING;
|
||||
}
|
||||
|
||||
mFdWatcher.StopWatchingFileDescriptors();
|
||||
|
||||
management_->closeHci();
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(mStateMutex);
|
||||
mState = HalState::READY;
|
||||
mH4 = nullptr;
|
||||
}
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus BluetoothHci::sendHciCommand(
|
||||
const std::vector<uint8_t>& packet) {
|
||||
return send(PacketType::COMMAND, packet);
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus BluetoothHci::sendAclData(
|
||||
const std::vector<uint8_t>& packet) {
|
||||
return send(PacketType::ACL_DATA, packet);
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus BluetoothHci::sendScoData(
|
||||
const std::vector<uint8_t>& packet) {
|
||||
return send(PacketType::SCO_DATA, packet);
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus BluetoothHci::sendIsoData(
|
||||
const std::vector<uint8_t>& packet) {
|
||||
return send(PacketType::ISO_DATA, packet);
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus BluetoothHci::send(PacketType type,
|
||||
const std::vector<uint8_t>& v) {
|
||||
if (v.empty()) {
|
||||
ALOGE("Packet is empty, no data was found to be sent");
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
||||
}
|
||||
|
||||
std::lock_guard<std::mutex> guard(mStateMutex);
|
||||
if (mH4 == nullptr) {
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
|
||||
}
|
||||
|
||||
mH4->Send(type, v);
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
} // namespace aidl::android::hardware::bluetooth::impl
|
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
* Copyright (C) 2024 KonstaKANG
|
||||
*
|
||||
* 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 <aidl/android/hardware/bluetooth/BnBluetoothHci.h>
|
||||
#include <aidl/android/hardware/bluetooth/IBluetoothHciCallbacks.h>
|
||||
|
||||
#include "async_fd_watcher.h"
|
||||
#include "h4_protocol.h"
|
||||
#include "net_bluetooth_mgmt.h"
|
||||
|
||||
namespace aidl::android::hardware::bluetooth::impl {
|
||||
|
||||
class BluetoothDeathRecipient;
|
||||
|
||||
// This Bluetooth HAL implementation connects with a serial port at dev_path_.
|
||||
class BluetoothHci : public BnBluetoothHci {
|
||||
public:
|
||||
BluetoothHci();
|
||||
|
||||
ndk::ScopedAStatus initialize(
|
||||
const std::shared_ptr<IBluetoothHciCallbacks>& cb) override;
|
||||
|
||||
ndk::ScopedAStatus sendHciCommand(
|
||||
const std::vector<uint8_t>& packet) override;
|
||||
|
||||
ndk::ScopedAStatus sendAclData(const std::vector<uint8_t>& packet) override;
|
||||
|
||||
ndk::ScopedAStatus sendScoData(const std::vector<uint8_t>& packet) override;
|
||||
|
||||
ndk::ScopedAStatus sendIsoData(const std::vector<uint8_t>& packet) override;
|
||||
|
||||
ndk::ScopedAStatus close() override;
|
||||
|
||||
private:
|
||||
int mFd{-1};
|
||||
std::shared_ptr<IBluetoothHciCallbacks> mCb = nullptr;
|
||||
|
||||
std::shared_ptr<::android::hardware::bluetooth::hci::H4Protocol> mH4;
|
||||
|
||||
std::shared_ptr<BluetoothDeathRecipient> mDeathRecipient;
|
||||
|
||||
::android::hardware::bluetooth::async::AsyncFdWatcher mFdWatcher;
|
||||
|
||||
[[nodiscard]] ndk::ScopedAStatus send(
|
||||
::android::hardware::bluetooth::hci::PacketType type,
|
||||
const std::vector<uint8_t>& packet);
|
||||
std::unique_ptr<NetBluetoothMgmt> management_{};
|
||||
|
||||
// Don't close twice or open before close is complete
|
||||
std::mutex mStateMutex;
|
||||
enum class HalState {
|
||||
READY,
|
||||
INITIALIZING,
|
||||
ONE_CLIENT,
|
||||
CLOSING,
|
||||
} mState{HalState::READY};
|
||||
};
|
||||
|
||||
} // namespace aidl::android::hardware::bluetooth::impl
|
@@ -1,12 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 KonstaKANG
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef _BDROID_BUILDCFG_H
|
||||
#define _BDROID_BUILDCFG_H
|
||||
|
||||
#define BTM_DEF_LOCAL_NAME "Raspberry Pi 4"
|
||||
|
||||
#endif
|
@@ -1,6 +0,0 @@
|
||||
service vendor.bluetooth-default /vendor/bin/hw/android.hardware.bluetooth-service.rpi
|
||||
class hal
|
||||
capabilities BLOCK_SUSPEND NET_ADMIN SYS_NICE
|
||||
user bluetooth
|
||||
group bluetooth
|
||||
task_profiles HighPerformance
|
@@ -1,6 +0,0 @@
|
||||
<manifest version="1.0" type="device">
|
||||
<hal format="aidl">
|
||||
<name>android.hardware.bluetooth</name>
|
||||
<fqname>IBluetoothHci/default</fqname>
|
||||
</hal>
|
||||
</manifest>
|
@@ -1,278 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
* Copyright (C) 2024 KonstaKANG
|
||||
*
|
||||
* 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 "android.hardware.bluetooth.service.rpi"
|
||||
|
||||
#include "net_bluetooth_mgmt.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <log/log.h>
|
||||
#include <poll.h>
|
||||
#include <sys/socket.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <cerrno>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
// Definitions imported from <linux/net/bluetooth/bluetooth.h>
|
||||
#define BTPROTO_HCI 1
|
||||
|
||||
// Definitions imported from <linux/net/bluetooth/hci_sock.h>
|
||||
#define HCI_CHANNEL_USER 1
|
||||
#define HCI_CHANNEL_CONTROL 3
|
||||
#define HCI_DEV_NONE 0xffff
|
||||
|
||||
struct sockaddr_hci {
|
||||
sa_family_t hci_family;
|
||||
unsigned short hci_dev;
|
||||
unsigned short hci_channel;
|
||||
};
|
||||
|
||||
// Definitions imported from <linux/net/bluetooth/mgmt.h>
|
||||
#define MGMT_OP_READ_INDEX_LIST 0x0003
|
||||
#define MGMT_EV_INDEX_ADDED 0x0004
|
||||
#define MGMT_EV_CMD_COMPLETE 0x0001
|
||||
#define MGMT_PKT_SIZE_MAX 1024
|
||||
#define MGMT_INDEX_NONE 0xFFFF
|
||||
#define WRITE_NO_INTR(fn) \
|
||||
do { \
|
||||
} while ((fn) == -1 && errno == EINTR)
|
||||
|
||||
struct mgmt_pkt {
|
||||
uint16_t opcode;
|
||||
uint16_t index;
|
||||
uint16_t len;
|
||||
uint8_t data[MGMT_PKT_SIZE_MAX];
|
||||
} __attribute__((packed));
|
||||
|
||||
struct mgmt_ev_read_index_list {
|
||||
uint16_t opcode;
|
||||
uint8_t status;
|
||||
uint16_t num_controllers;
|
||||
uint16_t index[];
|
||||
} __attribute__((packed));
|
||||
|
||||
namespace aidl::android::hardware::bluetooth::impl {
|
||||
|
||||
// Wait indefinitely for the selected HCI interface to be enabled in the
|
||||
// bluetooth driver.
|
||||
int NetBluetoothMgmt::waitHciDev(int hci_interface) {
|
||||
ALOGI("waiting for hci interface %d", hci_interface);
|
||||
|
||||
int ret = -1;
|
||||
struct mgmt_pkt cmd;
|
||||
struct pollfd pollfd;
|
||||
struct sockaddr_hci hci_addr = {
|
||||
.hci_family = AF_BLUETOOTH,
|
||||
.hci_dev = HCI_DEV_NONE,
|
||||
.hci_channel = HCI_CHANNEL_CONTROL,
|
||||
};
|
||||
|
||||
// Open and bind a socket to the bluetooth control interface in the
|
||||
// kernel driver, used to send control commands and receive control
|
||||
// events.
|
||||
int fd = socket(PF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
|
||||
if (fd < 0) {
|
||||
ALOGE("unable to open raw bluetooth socket: %s", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (bind(fd, (struct sockaddr*)&hci_addr, sizeof(hci_addr)) < 0) {
|
||||
ALOGE("unable to bind bluetooth control channel: %s", strerror(errno));
|
||||
goto end;
|
||||
}
|
||||
|
||||
// Send the control command [Read Index List].
|
||||
cmd = {
|
||||
.opcode = MGMT_OP_READ_INDEX_LIST,
|
||||
.index = MGMT_INDEX_NONE,
|
||||
.len = 0,
|
||||
};
|
||||
|
||||
if (write(fd, &cmd, 6) != 6) {
|
||||
ALOGE("error writing mgmt command: %s", strerror(errno));
|
||||
goto end;
|
||||
}
|
||||
|
||||
// Poll the control socket waiting for the command response,
|
||||
// and subsequent [Index Added] events. The loops continue without
|
||||
// timeout until the selected hci interface is detected.
|
||||
pollfd = {.fd = fd, .events = POLLIN};
|
||||
|
||||
for (;;) {
|
||||
ret = poll(&pollfd, 1, -1);
|
||||
|
||||
// Poll interrupted, try again.
|
||||
if (ret == -1 && (errno == EINTR || errno == EAGAIN)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Poll failure, abandon.
|
||||
if (ret == -1) {
|
||||
ALOGE("poll error: %s", strerror(errno));
|
||||
break;
|
||||
}
|
||||
|
||||
// Spurious wakeup, try again.
|
||||
if (ret == 0 || (pollfd.revents & POLLIN) == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Read the next control event.
|
||||
struct mgmt_pkt ev {};
|
||||
ret = read(fd, &ev, sizeof(ev));
|
||||
if (ret < 0) {
|
||||
ALOGE("error reading mgmt event: %s", strerror(errno));
|
||||
goto end;
|
||||
}
|
||||
|
||||
// Received [Read Index List] command response.
|
||||
if (ev.opcode == MGMT_EV_CMD_COMPLETE) {
|
||||
struct mgmt_ev_read_index_list* data =
|
||||
(struct mgmt_ev_read_index_list*)ev.data;
|
||||
|
||||
// Prefer the exact hci_interface
|
||||
for (int i = 0; i < data->num_controllers; i++) {
|
||||
if (data->index[i] == hci_interface) {
|
||||
ALOGI("hci interface %d found", data->index[i]);
|
||||
ret = data->index[i];
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
// Accept a larger one if we can't find the exact one
|
||||
for (int i = 0; i < data->num_controllers; i++) {
|
||||
if (data->index[i] >= hci_interface) {
|
||||
ALOGI("hci interface %d found", data->index[i]);
|
||||
ret = data->index[i];
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Received [Index Added] event.
|
||||
if (ev.opcode == MGMT_EV_INDEX_ADDED && ev.index == hci_interface) {
|
||||
ALOGI("hci interface %d added", hci_interface);
|
||||
ret = hci_interface;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
::close(fd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int NetBluetoothMgmt::findRfKill() {
|
||||
char rfkill_type[64];
|
||||
char type[16];
|
||||
int fd, size, i;
|
||||
for(i = 0; rfkill_state_ == NULL; i++)
|
||||
{
|
||||
snprintf(rfkill_type, sizeof(rfkill_type), "/sys/class/rfkill/rfkill%d/type", i);
|
||||
if ((fd = open(rfkill_type, O_RDONLY)) < 0)
|
||||
{
|
||||
ALOGE("open(%s) failed: %s (%d)\n", rfkill_type, strerror(errno), errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
size = read(fd, &type, sizeof(type));
|
||||
::close(fd);
|
||||
|
||||
if ((size >= 9) && !memcmp(type, "bluetooth", 9))
|
||||
{
|
||||
::asprintf(&rfkill_state_, "/sys/class/rfkill/rfkill%d/state", i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int NetBluetoothMgmt::rfKill(int block) {
|
||||
int fd;
|
||||
char on = (block)?'1':'0';
|
||||
if (findRfKill() != 0) return 0;
|
||||
|
||||
fd = open(rfkill_state_, O_WRONLY);
|
||||
if (fd < 0) {
|
||||
ALOGE( "Unable to open /dev/rfkill");
|
||||
return -1;
|
||||
}
|
||||
ssize_t len;
|
||||
WRITE_NO_INTR(len = write(fd, &on, 1));
|
||||
if (len < 0) {
|
||||
ALOGE( "Failed to change rfkill state");
|
||||
::close(fd);
|
||||
return -1;
|
||||
}
|
||||
::close(fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int NetBluetoothMgmt::openHci(int hci_interface) {
|
||||
ALOGI("opening hci interface %d", hci_interface);
|
||||
|
||||
// Block Bluetooth.
|
||||
rfkill_state_ = NULL;
|
||||
rfKill(1);
|
||||
|
||||
// Wait for the HCI interface to complete initialization or to come online.
|
||||
int hci = waitHciDev(hci_interface);
|
||||
if (hci < 0) {
|
||||
ALOGE("hci interface %d not found", hci_interface);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Open the raw HCI socket.
|
||||
int fd = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
|
||||
if (fd < 0) {
|
||||
ALOGE("unable to open raw bluetooth socket: %s", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct sockaddr_hci hci_addr = {
|
||||
.hci_family = AF_BLUETOOTH,
|
||||
.hci_dev = static_cast<uint16_t>(hci),
|
||||
.hci_channel = HCI_CHANNEL_USER,
|
||||
};
|
||||
|
||||
// Bind the socket to the selected interface.
|
||||
if (bind(fd, (struct sockaddr*)&hci_addr, sizeof(hci_addr)) < 0) {
|
||||
ALOGE("unable to bind bluetooth user channel: %s", strerror(errno));
|
||||
::close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ALOGI("hci interface %d ready", hci);
|
||||
bt_fd_ = fd;
|
||||
return fd;
|
||||
}
|
||||
|
||||
void NetBluetoothMgmt::closeHci() {
|
||||
if (bt_fd_ != -1) {
|
||||
::close(bt_fd_);
|
||||
bt_fd_ = -1;
|
||||
}
|
||||
|
||||
// Unblock Bluetooth.
|
||||
rfKill(0);
|
||||
free(rfkill_state_);
|
||||
}
|
||||
|
||||
} // namespace aidl::android::hardware::bluetooth::impl
|
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
* Copyright (C) 2024 KonstaKANG
|
||||
*
|
||||
* 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 <unistd.h>
|
||||
|
||||
namespace aidl::android::hardware::bluetooth::impl {
|
||||
|
||||
class NetBluetoothMgmt {
|
||||
public:
|
||||
NetBluetoothMgmt() {}
|
||||
~NetBluetoothMgmt() {
|
||||
::close(bt_fd_);
|
||||
}
|
||||
|
||||
int openHci(int hci_interface = 0);
|
||||
void closeHci();
|
||||
|
||||
private:
|
||||
int waitHciDev(int hci_interface);
|
||||
int findRfKill();
|
||||
int rfKill(int block);
|
||||
char *rfkill_state_;
|
||||
|
||||
// File descriptor opened to the bluetooth user channel.
|
||||
int bt_fd_{-1};
|
||||
};
|
||||
|
||||
} // namespace aidl::android::hardware::bluetooth::impl
|
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
* Copyright (C) 2024 KonstaKANG
|
||||
*
|
||||
* 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 "aidl.android.hardware.bluetooth.service.rpi"
|
||||
|
||||
#include <aidl/android/hardware/bluetooth/IBluetoothHci.h>
|
||||
#include <android/binder_manager.h>
|
||||
#include <android/binder_process.h>
|
||||
#include <hidl/HidlSupport.h>
|
||||
#include <hidl/HidlTransportSupport.h>
|
||||
|
||||
#include "BluetoothHci.h"
|
||||
|
||||
using ::aidl::android::hardware::bluetooth::impl::BluetoothHci;
|
||||
using ::android::hardware::configureRpcThreadpool;
|
||||
using ::android::hardware::joinRpcThreadpool;
|
||||
|
||||
int main(int /* argc */, char** /* argv */) {
|
||||
ALOGI("Bluetooth HAL starting");
|
||||
if (!ABinderProcess_setThreadPoolMaxThreadCount(0)) {
|
||||
ALOGI("failed to set thread pool max thread count");
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::shared_ptr<BluetoothHci> service =
|
||||
ndk::SharedRefBase::make<BluetoothHci>();
|
||||
std::string instance = std::string() + BluetoothHci::descriptor + "/default";
|
||||
auto result =
|
||||
AServiceManager_addService(service->asBinder().get(), instance.c_str());
|
||||
if (result == STATUS_OK) {
|
||||
ABinderProcess_joinThreadPool();
|
||||
} else {
|
||||
ALOGE("Could not register as a service!");
|
||||
}
|
||||
return 0;
|
||||
}
|
@@ -20,7 +20,7 @@ disable_overscan=1
|
||||
|
||||
# Display panel
|
||||
#dtoverlay=vc4-kms-dsi-7inch
|
||||
#dtoverlay=vc4-kms-dsi-ili9881-7inch
|
||||
#dtoverlay=rpi-backlight
|
||||
|
||||
# Graphics acceleration
|
||||
disable_fw_kms_setup=1
|
||||
|
@@ -8,18 +8,9 @@ cameras:
|
||||
"/base/soc/i2c0mux/i2c@1/imx477@1a":
|
||||
location: back
|
||||
rotation: 0
|
||||
"/base/soc/i2c0mux/i2c@1/imx500@1a":
|
||||
location: back
|
||||
rotation: 0
|
||||
"/base/soc/i2c0mux/i2c@1/imx519@1a":
|
||||
location: back
|
||||
rotation: 0
|
||||
"/base/soc/i2c0mux/i2c@1/imx708@1a":
|
||||
location: back
|
||||
rotation: 0
|
||||
"/base/soc/i2c0mux/i2c@1/ov5647@36":
|
||||
location: back
|
||||
rotation: 0
|
||||
"/base/soc/i2c0mux/i2c@1/ov64a40@36":
|
||||
location: back
|
||||
rotation: 0
|
||||
|
22
device.mk
22
device.mk
@@ -74,7 +74,7 @@ PRODUCT_COPY_FILES += \
|
||||
|
||||
# Bluetooth
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.bluetooth-service.rpi
|
||||
android.hardware.bluetooth@1.1-service.btlinux
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
frameworks/native/data/etc/android.hardware.bluetooth.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth.xml \
|
||||
@@ -115,15 +115,12 @@ PRODUCT_COPY_FILES += \
|
||||
external/libcamera/src/ipa/rpi/vc4/data/imx477.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/imx477.json \
|
||||
external/libcamera/src/ipa/rpi/vc4/data/imx477_noir.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/imx477_noir.json \
|
||||
external/libcamera/src/ipa/rpi/vc4/data/imx477_scientific.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/imx477_scientific.json \
|
||||
external/libcamera/src/ipa/rpi/vc4/data/imx500.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/imx500.json \
|
||||
external/libcamera/src/ipa/rpi/vc4/data/imx519.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/imx519.json \
|
||||
external/libcamera/src/ipa/rpi/vc4/data/imx708.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/imx708.json \
|
||||
external/libcamera/src/ipa/rpi/vc4/data/imx708_noir.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/imx708_noir.json \
|
||||
external/libcamera/src/ipa/rpi/vc4/data/imx708_wide.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/imx708_wide.json \
|
||||
external/libcamera/src/ipa/rpi/vc4/data/imx708_wide_noir.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/imx708_wide_noir.json \
|
||||
external/libcamera/src/ipa/rpi/vc4/data/ov5647.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/ov5647.json \
|
||||
external/libcamera/src/ipa/rpi/vc4/data/ov5647_noir.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/ov5647_noir.json \
|
||||
external/libcamera/src/ipa/rpi/vc4/data/ov64a40.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/ov64a40.json
|
||||
external/libcamera/src/ipa/rpi/vc4/data/ov5647_noir.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/ov5647_noir.json
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
frameworks/native/data/etc/android.hardware.camera.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.xml \
|
||||
@@ -168,12 +165,13 @@ PRODUCT_PACKAGES += \
|
||||
|
||||
# Graphics
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.graphics.allocator-service.minigbm_gbm_mesa \
|
||||
mapper.minigbm_gbm_mesa \
|
||||
android.hardware.graphics.allocator@4.0-service.minigbm_gbm_mesa \
|
||||
android.hardware.graphics.mapper@4.0-impl.minigbm_gbm_mesa \
|
||||
libgbm_mesa_wrapper
|
||||
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.composer.hwc3-service.drm
|
||||
android.hardware.graphics.composer@2.4-service \
|
||||
hwcomposer.drm
|
||||
|
||||
PRODUCT_PACKAGES += \
|
||||
libEGL_mesa \
|
||||
@@ -186,7 +184,7 @@ PRODUCT_PACKAGES += \
|
||||
libgbm_mesa
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
frameworks/native/data/etc/android.software.opengles.deqp.level-2024-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.opengles.deqp.level.xml
|
||||
frameworks/native/data/etc/android.software.opengles.deqp.level-2023-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.opengles.deqp.level.xml
|
||||
|
||||
PRODUCT_PACKAGES += \
|
||||
vulkan.broadcom
|
||||
@@ -194,7 +192,7 @@ PRODUCT_PACKAGES += \
|
||||
PRODUCT_COPY_FILES += \
|
||||
frameworks/native/data/etc/android.hardware.vulkan.level-0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.level.xml \
|
||||
frameworks/native/data/etc/android.hardware.vulkan.version-1_3.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.version.xml \
|
||||
frameworks/native/data/etc/android.software.vulkan.deqp.level-2024-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.vulkan.deqp.level.xml
|
||||
frameworks/native/data/etc/android.software.vulkan.deqp.level-2023-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.vulkan.deqp.level.xml
|
||||
|
||||
# Health
|
||||
PRODUCT_PACKAGES += \
|
||||
@@ -237,7 +235,6 @@ PRODUCT_COPY_FILES += \
|
||||
|
||||
# Seccomp
|
||||
PRODUCT_COPY_FILES += \
|
||||
$(DEVICE_PATH)/seccomp_policy/android.hardware.media.c2-extended-seccomp_policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/android.hardware.media.c2-extended-seccomp_policy \
|
||||
$(DEVICE_PATH)/seccomp_policy/mediacodec.policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/mediacodec.policy \
|
||||
$(DEVICE_PATH)/seccomp_policy/mediaswcodec.policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/mediaswcodec.policy
|
||||
|
||||
@@ -274,7 +271,8 @@ PRODUCT_PACKAGES += \
|
||||
libc2plugin_store
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
$(DEVICE_PATH)/media/media_codecs_v4l2_c2_video.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_v4l2_c2_video.xml
|
||||
$(DEVICE_PATH)/media/media_codecs_v4l2_c2_video.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_v4l2_c2_video.xml \
|
||||
$(DEVICE_PATH)/seccomp_policy/android.hardware.media.c2-extended-seccomp_policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/android.hardware.media.c2-extended-seccomp_policy
|
||||
|
||||
# Virtualization
|
||||
$(call inherit-product, packages/modules/Virtualization/apex/product_packages.mk)
|
||||
|
@@ -424,7 +424,6 @@ key 580 APP_SWITCH
|
||||
key 582 VOICE_ASSIST
|
||||
# Linux KEY_ASSISTANT
|
||||
key 583 ASSIST
|
||||
key 585 EMOJI_PICKER
|
||||
key 656 MACRO_1
|
||||
key 657 MACRO_2
|
||||
key 658 MACRO_3
|
||||
@@ -437,22 +436,15 @@ key 141 POWER
|
||||
key 174 BACK
|
||||
|
||||
# Keys defined by HID usages
|
||||
key usage 0x0c0065 SCREENSHOT FALLBACK_USAGE_MAPPING
|
||||
key usage 0x0c0067 WINDOW FALLBACK_USAGE_MAPPING
|
||||
key usage 0x0c006F BRIGHTNESS_UP FALLBACK_USAGE_MAPPING
|
||||
key usage 0x0c0070 BRIGHTNESS_DOWN FALLBACK_USAGE_MAPPING
|
||||
key usage 0x0c0079 KEYBOARD_BACKLIGHT_UP FALLBACK_USAGE_MAPPING
|
||||
key usage 0x0c007A KEYBOARD_BACKLIGHT_DOWN FALLBACK_USAGE_MAPPING
|
||||
key usage 0x0c007C KEYBOARD_BACKLIGHT_TOGGLE FALLBACK_USAGE_MAPPING
|
||||
key usage 0x0c00D9 EMOJI_PICKER FALLBACK_USAGE_MAPPING
|
||||
key usage 0x0c0173 MEDIA_AUDIO_TRACK FALLBACK_USAGE_MAPPING
|
||||
key usage 0x0c019C PROFILE_SWITCH FALLBACK_USAGE_MAPPING
|
||||
key usage 0x0c019F SETTINGS FALLBACK_USAGE_MAPPING
|
||||
key usage 0x0c01A2 ALL_APPS FALLBACK_USAGE_MAPPING
|
||||
key usage 0x0c0227 REFRESH FALLBACK_USAGE_MAPPING
|
||||
key usage 0x0c029D LANGUAGE_SWITCH FALLBACK_USAGE_MAPPING
|
||||
key usage 0x0c029F RECENT_APPS FALLBACK_USAGE_MAPPING
|
||||
key usage 0x0c02A2 ALL_APPS FALLBACK_USAGE_MAPPING
|
||||
key usage 0x0d0044 STYLUS_BUTTON_PRIMARY FALLBACK_USAGE_MAPPING
|
||||
key usage 0x0d005a STYLUS_BUTTON_SECONDARY FALLBACK_USAGE_MAPPING
|
||||
|
||||
|
@@ -19,39 +19,28 @@
|
||||
|
||||
#include <android-base/file.h>
|
||||
|
||||
using ::android::base::ReadFileToString;
|
||||
using ::android::base::WriteStringToFile;
|
||||
|
||||
namespace aidl::android::hardware::light {
|
||||
|
||||
static const uint32_t defaultMaxBrightness = 255;
|
||||
static const std::string backlightFiles[] = {
|
||||
"/sys/class/backlight/rpi_backlight/brightness"
|
||||
};
|
||||
|
||||
static const std::string backlightBrightnessPath = "/sys/class/backlight/11-0045/brightness";
|
||||
static const std::string backlightMaxBrightnessPath = "/sys/class/backlight/11-0045/max_brightness";
|
||||
|
||||
static const std::vector<HwLight> availableLights = {
|
||||
const static std::vector<HwLight> availableLights = {
|
||||
{.id = (int)LightType::BACKLIGHT, .type = LightType::BACKLIGHT, .ordinal = 0}
|
||||
};
|
||||
|
||||
Lights::Lights() {
|
||||
maxBrightness = defaultMaxBrightness;
|
||||
|
||||
if (!access(backlightMaxBrightnessPath.c_str(), R_OK)) {
|
||||
std::string maxBrightnessValue;
|
||||
if (ReadFileToString(backlightMaxBrightnessPath, &maxBrightnessValue)) {
|
||||
maxBrightness = std::stoi(maxBrightnessValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus Lights::setLightState(int id, const HwLightState& state) {
|
||||
HwLight const& light = availableLights[id];
|
||||
std::string const brightness = std::to_string(rgbToScaledBrightness(state, maxBrightness));
|
||||
std::string const brightness = std::to_string(rgbToBrightness(state));
|
||||
|
||||
switch (light.type) {
|
||||
case LightType::BACKLIGHT:
|
||||
if (!access(backlightBrightnessPath.c_str(), W_OK)) {
|
||||
WriteStringToFile(brightness, backlightBrightnessPath);
|
||||
for (auto &file : backlightFiles) {
|
||||
if (!access(file.c_str(), W_OK)) {
|
||||
WriteStringToFile(brightness, file);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -69,11 +58,10 @@ ndk::ScopedAStatus Lights::getLights(std::vector<HwLight>* lights) {
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
uint32_t Lights::rgbToScaledBrightness(const HwLightState& state, uint32_t maxBrightness) {
|
||||
uint32_t Lights::rgbToBrightness(const HwLightState& state) {
|
||||
uint32_t color = state.color & 0x00ffffff;
|
||||
uint32_t brightness = ((77 * ((color >> 16) & 0xff)) + (150 * ((color >> 8) & 0xff)) +
|
||||
return ((77 * ((color >> 16) & 0xff)) + (150 * ((color >> 8) & 0xff)) +
|
||||
(29 * (color & 0xff))) >> 8;
|
||||
return brightness * maxBrightness / 0xff;
|
||||
}
|
||||
|
||||
} // aidl::android::hardware::light
|
||||
|
@@ -23,14 +23,11 @@ namespace aidl::android::hardware::light {
|
||||
|
||||
class Lights : public BnLights {
|
||||
public:
|
||||
Lights();
|
||||
|
||||
ndk::ScopedAStatus setLightState(int id, const HwLightState& state) override;
|
||||
ndk::ScopedAStatus getLights(std::vector<HwLight>* types) override;
|
||||
|
||||
private:
|
||||
uint32_t maxBrightness;
|
||||
uint32_t rgbToScaledBrightness(const HwLightState& state, uint32_t maxBrightness);
|
||||
uint32_t rgbToBrightness(const HwLightState& state);
|
||||
};
|
||||
|
||||
} // aidl::android::hardware::light
|
||||
|
@@ -1,8 +1,6 @@
|
||||
on early-boot
|
||||
chown system system /sys/class/backlight/11-0045/brightness
|
||||
chown system system /sys/class/backlight/11-0045/max_brightness
|
||||
chmod 660 /sys/class/backlight/11-0045/brightness
|
||||
chmod 440 /sys/class/backlight/11-0045/max_brightness
|
||||
chown system system /sys/class/backlight/rpi_backlight/brightness
|
||||
chmod 660 /sys/class/backlight/rpi_backlight/brightness
|
||||
|
||||
service vendor.light-default /vendor/bin/hw/android.hardware.light-service.rpi
|
||||
class hal
|
||||
|
18
manifest.xml
18
manifest.xml
@@ -17,6 +17,15 @@
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.bluetooth</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>1.1</version>
|
||||
<interface>
|
||||
<name>IBluetoothHci</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="aidl">
|
||||
<name>android.hardware.camera.provider</name>
|
||||
<version>1</version>
|
||||
@@ -34,4 +43,13 @@
|
||||
<instance>legacy/0</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.graphics.composer</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>2.4</version>
|
||||
<interface>
|
||||
<name>IComposer</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
</manifest>
|
||||
|
9
mkimg.sh
9
mkimg.sh
@@ -21,15 +21,15 @@ fi
|
||||
|
||||
for PARTITION in "boot" "system" "vendor"; do
|
||||
if [ ! -f ${ANDROID_PRODUCT_OUT}/${PARTITION}.img ]; then
|
||||
exit_with_error "Partition image not found. Run make first."
|
||||
exit_with_error "Partition image not found. Run 'make ${PARTITION}image' first."
|
||||
fi
|
||||
done
|
||||
|
||||
VERSION=RaspberryVanillaAOSP15
|
||||
VERSION=RaspberryVanillaAOSP14
|
||||
DATE=$(date +%Y%m%d)
|
||||
TARGET=$(echo ${TARGET_PRODUCT} | sed 's/^aosp_//')
|
||||
IMGNAME=${VERSION}-${DATE}-${TARGET}.img
|
||||
IMGSIZE=14848MiB
|
||||
IMGSIZE=15360000000
|
||||
|
||||
if [ -f ${ANDROID_PRODUCT_OUT}/${IMGNAME} ]; then
|
||||
exit_with_error "${ANDROID_PRODUCT_OUT}/${IMGNAME} already exists!"
|
||||
@@ -51,7 +51,7 @@ echo n
|
||||
echo p
|
||||
echo 2
|
||||
echo
|
||||
echo +2048M
|
||||
echo +2560M
|
||||
echo n
|
||||
echo p
|
||||
echo 3
|
||||
@@ -88,6 +88,7 @@ sudo mkfs.ext4 /dev/mapper/${LOOPDEV}p4 -I 512 -L userdata
|
||||
sync
|
||||
|
||||
sudo kpartx -d "/dev/${LOOPDEV}"
|
||||
sudo losetup -d "/dev/${LOOPDEV}"
|
||||
sudo chown ${USER}:${USER} ${ANDROID_PRODUCT_OUT}/${IMGNAME}
|
||||
|
||||
echo "Done, created ${ANDROID_PRODUCT_OUT}/${IMGNAME}!"
|
||||
|
@@ -1,10 +0,0 @@
|
||||
// Copyright (C) 2021-2022 KonstaKANG
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
runtime_resource_overlay {
|
||||
name: "BluetoothRpiOverlay",
|
||||
resource_dirs: ["res"],
|
||||
sdk_version: "current",
|
||||
vendor: true,
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
** Copyright (C) 2021-2022 KonstaKANG
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
-->
|
||||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.android.bluetooth.resources.rpi"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
<application android:hasCode="false" />
|
||||
<overlay
|
||||
android:targetPackage="com.android.bluetooth"
|
||||
android:isStatic="true"
|
||||
android:priority="0" />
|
||||
</manifest>
|
@@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2009-2012 Broadcom Corporation
|
||||
Copyright (C) 2021-2022 KonstaKANG
|
||||
|
||||
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.
|
||||
-->
|
||||
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
|
||||
<!-- If true, device requests audio focus and start avrcp updates on source start or play -->
|
||||
<bool name="a2dp_sink_automatically_request_audio_focus">true</bool>
|
||||
|
||||
</resources>
|
@@ -18,8 +18,8 @@
|
||||
|
||||
<resources>
|
||||
|
||||
<!-- Disable screen dimming by default -->
|
||||
<bool name="def_dim_screen">false</bool>
|
||||
<!-- Default for Settings.Global.DEVICE_NAME $1=MODEL -->
|
||||
<string name="def_device_name_simple">Raspberry Pi 4</string>
|
||||
|
||||
<!-- Default screen brightness -->
|
||||
<integer name="def_screen_brightness">128</integer>
|
||||
|
@@ -18,8 +18,8 @@
|
||||
|
||||
<resources>
|
||||
|
||||
<!-- Disable screen dimming by default -->
|
||||
<bool name="def_dim_screen">false</bool>
|
||||
<!-- Default for Settings.Global.DEVICE_NAME $1=MODEL -->
|
||||
<string name="def_device_name_simple">Raspberry Pi 4</string>
|
||||
|
||||
<!-- Default screen brightness -->
|
||||
<integer name="def_screen_brightness">128</integer>
|
||||
|
@@ -24,4 +24,13 @@
|
||||
is no longer indicative, and a separate config now exists for each band -->
|
||||
<bool translatable="false" name ="config_wifi5ghzSupport">true</bool>
|
||||
|
||||
<!-- Boolean indicating whether the wifi chipset supports background scanning mechanism.
|
||||
This mechanism allows the host to remain in suspend state and the dongle to actively
|
||||
scan and wake the host when a configured SSID is detected by the dongle. This chipset
|
||||
capability can provide power savings when wifi needs to be always kept on. -->
|
||||
<bool translatable="false" name="config_wifi_background_scan_support">true</bool>
|
||||
|
||||
<!-- Do not translate. Default access point SSID used for tethering -->
|
||||
<string name="wifi_tether_configure_ssid_default" translatable="false">Raspberry Pi 4</string>
|
||||
|
||||
</resources>
|
||||
|
@@ -11,12 +11,3 @@ on post-fs-data
|
||||
mkdir /data/vendor/wifi 0770 wifi wifi
|
||||
mkdir /data/vendor/wifi/wpa 0770 wifi wifi
|
||||
mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi
|
||||
|
||||
on property:sys.boot_completed=1
|
||||
# Reinit lmkd to reconfigure lmkd properties
|
||||
setprop lmkd.reinit 1
|
||||
|
||||
service suspend_blocker_rpi /vendor/bin/suspend_blocker_rpi
|
||||
class early_hal # Start together with system_suspend HAL
|
||||
group system
|
||||
user root
|
||||
|
@@ -13,18 +13,17 @@
|
||||
# DMA
|
||||
/dev/dma_heap/linux,cma 0666 system graphics
|
||||
|
||||
# ION
|
||||
/dev/ion 0664 system system
|
||||
# FFmpeg
|
||||
/dev/media0 0660 media media
|
||||
/dev/video19 0660 media media
|
||||
|
||||
# USB
|
||||
/sys/class/udc/fe980000.usb current_speed 0664 system system
|
||||
|
||||
# V4L2
|
||||
/dev/media0 0660 media media
|
||||
/dev/media1 0660 media media
|
||||
/dev/video10 0660 media media
|
||||
/dev/video11 0660 media media
|
||||
/dev/video12 0660 media media
|
||||
/dev/video18 0660 media media
|
||||
/dev/video19 0660 media media
|
||||
/dev/video31 0660 media media
|
||||
|
@@ -1,6 +1,5 @@
|
||||
# Bluetooth
|
||||
/sys/class/rfkill/rfkill[0-9]/state u:object_r:sysfs_bluetooth_writable:s0
|
||||
/vendor/bin/hw/android\.hardware\.bluetooth-service\.rpi u:object_r:hal_bluetooth_default_exec:s0
|
||||
|
||||
# CEC
|
||||
/dev/cec0 u:object_r:cec_device:s0
|
||||
@@ -18,29 +17,23 @@
|
||||
/vendor/bin/hw/android\.hardware\.gatekeeper@1\.0-service\.software u:object_r:hal_gatekeeper_default_exec:s0
|
||||
|
||||
# Graphics
|
||||
/dev/dri u:object_r:gpu_device:s0
|
||||
/dev/dri/card0 u:object_r:gpu_device:s0
|
||||
/dev/dri/card1 u:object_r:gpu_device:s0
|
||||
/dev/dri/renderD128 u:object_r:gpu_device:s0
|
||||
/vendor/bin/hw/android\.hardware\.composer\.hwc3-service\.drm u:object_r:hal_graphics_composer_default_exec:s0
|
||||
/vendor/bin/hw/android\.hardware\.graphics\.allocator-service\.minigbm_gbm_mesa u:object_r:hal_graphics_allocator_default_exec:s0
|
||||
/vendor/lib(64)?/hw/mapper\.minigbm_gbm_mesa\.so u:object_r:same_process_hal_file:s0
|
||||
/dev/dri(/.*)? u:object_r:gpu_device:s0
|
||||
/vendor/bin/hw/android\.hardware\.graphics\.allocator@4\.0-service\.minigbm_gbm_mesa u:object_r:hal_graphics_allocator_default_exec:s0
|
||||
/vendor/lib(64)?/hw/android\.hardware\.graphics.mapper@4\.0-impl\.minigbm_gbm_mesa\.so u:object_r:same_process_hal_file:s0
|
||||
/vendor/lib(64)?/hw/vulkan\.broadcom\.so u:object_r:same_process_hal_file:s0
|
||||
/vendor/lib(64)?/dri_gbm\.so u:object_r:same_process_hal_file:s0
|
||||
/vendor/lib(64)?/libdrm\.so u:object_r:same_process_hal_file:s0
|
||||
/vendor/lib(64)?/libgallium_dri\.so u:object_r:same_process_hal_file:s0
|
||||
/vendor/lib(64)?/libgbm_mesa\.so u:object_r:same_process_hal_file:s0
|
||||
/vendor/lib{64}?/libgbm_mesa_wrapper\.so u:object_r:same_process_hal_file:s0
|
||||
/vendor/lib(64)?/libglapi\.so u:object_r:same_process_hal_file:s0
|
||||
/vendor/lib(64)?/libgbm_mesa_wrapper\.so u:object_r:same_process_hal_file:s0
|
||||
/vendor/lib(64)?/libminigbm_gralloc_gbm_mesa\.so u:object_r:same_process_hal_file:s0
|
||||
/vendor/lib(64)?/libminigbm_gralloc4_utils_gbm_mesa\.so u:object_r:same_process_hal_file:s0
|
||||
|
||||
# Health
|
||||
/vendor/bin/hw/android\.hardware\.health-service\.rpi u:object_r:hal_health_default_exec:s0
|
||||
|
||||
# Lights
|
||||
/sys/class/backlight/11-0045/brightness u:object_r:sysfs_leds:s0
|
||||
/sys/class/backlight/11-0045/max_brightness u:object_r:sysfs_leds:s0
|
||||
/sys/class/backlight/rpi_backlight/brightness u:object_r:sysfs_leds:s0
|
||||
/sys/devices/platform/rpi_backlight/backlight/rpi_backlight/brightness u:object_r:sysfs_leds:s0
|
||||
/vendor/bin/hw/android\.hardware\.light-service\.rpi u:object_r:hal_light_default_exec:s0
|
||||
|
||||
# Partitions
|
||||
|
@@ -1,3 +1,6 @@
|
||||
genfscon sysfs /devices/platform/v3dbus/fec00000.v3d/uevent u:object_r:sysfs_gpu:s0
|
||||
genfscon sysfs /devices/platform/gpu/uevent u:object_r:sysfs_gpu:s0
|
||||
genfscon sysfs /firmware/devicetree/base/serial-number u:object_r:sysfs_dt_firmware_android:s0
|
||||
# Graphics
|
||||
genfscon sysfs /devices/platform/v3dbus/fec00000.v3d u:object_r:sysfs_gpu:s0
|
||||
genfscon sysfs /devices/platform/gpu u:object_r:sysfs_gpu:s0
|
||||
|
||||
# Serial number
|
||||
genfscon sysfs /firmware/devicetree/base/serial-number u:object_r:sysfs_dt_firmware_android:s0
|
||||
|
@@ -8,7 +8,5 @@ allow cameraserver device:dir r_dir_perms;
|
||||
allow cameraserver video_device:dir r_dir_perms;
|
||||
allow cameraserver video_device:chr_file rw_file_perms;
|
||||
|
||||
allow hal_camera_default gpu_device:dir { open read search };
|
||||
allow hal_camera_default gpu_device:chr_file { open read write ioctl map getattr };
|
||||
allow cameraserver gpu_device:dir { open read write search getattr };
|
||||
allow cameraserver gpu_device:chr_file { open read write ioctl map getattr };
|
||||
gpu_access(hal_camera_default)
|
||||
gpu_access(cameraserver)
|
||||
|
@@ -1 +0,0 @@
|
||||
gpu_access(surfaceflinger)
|
@@ -1,2 +1 @@
|
||||
gpu_access(mediaswcodec)
|
||||
allow mediaswcodec gpu_device:chr_file { getattr ioctl map open read write };
|
||||
|
@@ -1,2 +1 @@
|
||||
android.hardware.drm.IDrmFactory/widevine u:object_r:hal_drm_service:s0
|
||||
mapper/minigbm_gbm_mesa u:object_r:hal_graphics_mapper_service:s0
|
||||
|
@@ -2,7 +2,8 @@
|
||||
# gpu_access(client_domain)
|
||||
# Allow client_domain to communicate with the GPU
|
||||
define(`gpu_access', `
|
||||
allow $1 gpu_device:dir { open read search getattr };
|
||||
allow $1 gpu_device:chr_file { open read getattr ioctl map write };
|
||||
allow $1 sysfs_gpu:file { getattr open read };
|
||||
allow $1 gpu_device:dir r_dir_perms;
|
||||
allow $1 gpu_device:chr_file rw_file_perms;
|
||||
allow $1 sysfs_gpu:dir r_dir_perms;
|
||||
allow $1 sysfs_gpu:file r_file_perms;
|
||||
')
|
||||
|
@@ -5,7 +5,8 @@
|
||||
|
||||
cc_binary {
|
||||
name: "suspend_blocker_rpi",
|
||||
srcs: ["suspend_blocker_rpi.cpp"],
|
||||
init_rc: ["suspend_blocker_rpi.rc"],
|
||||
vendor: true,
|
||||
srcs: ["suspend_blocker_rpi.cpp"],
|
||||
shared_libs: ["libpower"],
|
||||
}
|
||||
|
4
suspend_blocker/suspend_blocker_rpi.rc
Normal file
4
suspend_blocker/suspend_blocker_rpi.rc
Normal file
@@ -0,0 +1,4 @@
|
||||
service suspend_blocker_rpi /vendor/bin/suspend_blocker_rpi
|
||||
class early_hal # Start together with system_suspend HAL
|
||||
group system
|
||||
user root
|
30
vendor.prop
30
vendor.prop
@@ -1,18 +1,16 @@
|
||||
|
||||
# Audio
|
||||
persist.audio.device=jack
|
||||
persist.audio.hdmi.device=vc4hdmi0
|
||||
persist.audio.pcm.card=0
|
||||
persist.audio.pcm.device=0
|
||||
persist.audio.pcm.card.auto=true
|
||||
ro.config.media_vol_default=20
|
||||
ro.config.media_vol_steps=25
|
||||
ro.hardware.audio.primary=rpi
|
||||
|
||||
# Bluetooth
|
||||
bluetooth.device.class_of_device?=90,2,12
|
||||
bluetooth.profile.a2dp.sink.enabled?=true
|
||||
bluetooth.device.default_name=Raspberry Pi 4
|
||||
bluetooth.profile.a2dp.source.enabled?=true
|
||||
bluetooth.profile.asha.central.enabled?=true
|
||||
bluetooth.profile.avrcp.controller.enabled?=true
|
||||
bluetooth.profile.avrcp.target.enabled?=true
|
||||
bluetooth.profile.bap.broadcast.assist.enabled?=true
|
||||
bluetooth.profile.bap.unicast.client.enabled?=true
|
||||
@@ -35,13 +33,16 @@ bluetooth.profile.vcp.controller.enabled?=true
|
||||
persist.bluetooth.a2dp_aac.vbr_supported=true
|
||||
|
||||
# Camera
|
||||
media.settings.xml=/vendor/etc/media_profiles_V1_0.xml
|
||||
ro.hardware.camera=libcamera
|
||||
|
||||
# CEC
|
||||
persist.hdmi.cec_device=cec0
|
||||
ro.hdmi.device_type=4
|
||||
|
||||
# Chipset
|
||||
ro.soc.manufacturer=Broadcom
|
||||
ro.soc.model=BCM2711
|
||||
|
||||
# Display
|
||||
debug.drm.mode.force=1920x1080
|
||||
|
||||
@@ -53,22 +54,12 @@ persist.ffmpeg_codec2.v4l2.h265=true
|
||||
|
||||
# Graphics
|
||||
ro.hardware.egl=mesa
|
||||
ro.hardware.hwcomposer=drm
|
||||
ro.hardware.vulkan=broadcom
|
||||
ro.opengles.version=196609
|
||||
ro.vendor.hwc.drm.use_config_groups=0
|
||||
vendor.hwc.drm.ctm=DRM_OR_IGNORE
|
||||
|
||||
# LMKD
|
||||
ro.lmk.critical=0
|
||||
ro.lmk.critical_upgrade=false
|
||||
ro.lmk.downgrade_pressure=100
|
||||
ro.lmk.kill_heaviest_task=true
|
||||
ro.lmk.kill_timeout_ms=100
|
||||
ro.lmk.log_stats=true
|
||||
ro.lmk.low=1001
|
||||
ro.lmk.medium=800
|
||||
ro.lmk.upgrade_pressure=100
|
||||
ro.lmk.use_minfree_levels=true
|
||||
|
||||
# Lockscreen
|
||||
ro.lockscreen.disable.default=true
|
||||
|
||||
@@ -82,7 +73,7 @@ persist.device_config.mglru_native.lru_gen_config=core
|
||||
persist.sys.fuse.backup.external_volume_backup=false
|
||||
|
||||
# V4L2
|
||||
debug.stagefright.c2-poolmask=0xf50000
|
||||
debug.stagefright.c2-poolmask=0xfc0000
|
||||
persist.v4l2_codec2.rank.decoder=128
|
||||
persist.v4l2_codec2.rank.encoder=128
|
||||
ro.vendor.v4l2_codec2.decode_concurrent_instances=8
|
||||
@@ -93,4 +84,3 @@ wifi.interface=wlan0
|
||||
|
||||
# Window extensions
|
||||
persist.settings.large_screen_opt.enabled=true
|
||||
|
||||
|
136
wrimg.sh
Executable file
136
wrimg.sh
Executable file
@@ -0,0 +1,136 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Copyright (C) 2025 KonstaKANG
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
exit_with_error() {
|
||||
echo $@
|
||||
exit 1
|
||||
}
|
||||
|
||||
check_device() {
|
||||
for PARTITION in "1" "2" "3" "4"; do
|
||||
if [ ! -b /dev/${1}${PARTITION} ]; then
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
|
||||
PARTITION1=$(lsblk -o LABEL,SIZE -b /dev/${1}1 | tail -n 1)
|
||||
PARTITION2=$(lsblk -o LABEL,SIZE -b /dev/${1}2 | tail -n 1)
|
||||
PARTITION3=$(lsblk -o LABEL,SIZE -b /dev/${1}3 | tail -n 1)
|
||||
PARTITION4=$(lsblk -o LABEL,SIZE -b /dev/${1}4 | tail -n 1)
|
||||
|
||||
if [ $(echo ${PARTITION1} | awk {'print $1'}) != "boot" ] || [ $(echo ${PARTITION1} | awk {'print $2'}) != "134217728" ]; then
|
||||
return 1
|
||||
fi
|
||||
if [ $(echo ${PARTITION2} | awk {'print $1'}) != "/" ] || [ $(echo ${PARTITION2} | awk {'print $2'}) != "2684354560" ]; then
|
||||
return 1
|
||||
fi
|
||||
if [ $(echo ${PARTITION3} | awk {'print $1'}) != "vendor" ] || [ $(echo ${PARTITION3} | awk {'print $2'}) != "268435456" ]; then
|
||||
return 1
|
||||
fi
|
||||
if [ $(echo ${PARTITION4} | awk {'print $1'}) != "userdata" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
DEVICE=${1}
|
||||
return 0
|
||||
}
|
||||
|
||||
find_device() {
|
||||
for SDX in "sda" "sdb" "sdc" "sdd" "sde" "sdf"; do
|
||||
check_device ${SDX}
|
||||
if [ $? == "0" ]; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z ${DEVICE} ]; then
|
||||
exit_with_error "Unable to find suitable block device!"
|
||||
fi
|
||||
}
|
||||
|
||||
confirm() {
|
||||
echo "Build target ${1}..."
|
||||
if [ "${2}" == "wipe" ]; then
|
||||
echo "Wiping userdata partition..."
|
||||
else
|
||||
echo "Writing ${2} image..."
|
||||
fi
|
||||
echo "Writing to device /dev/${DEVICE}..."
|
||||
lsblk -o NAME,LABEL,SIZE /dev/${DEVICE}
|
||||
|
||||
read -p "Continue (y/n)? " -n 1 -r RESPONSE
|
||||
echo ""
|
||||
if [[ ! ${RESPONSE} =~ ^[Yy]$ ]]; then
|
||||
exit_with_error "Exiting!"
|
||||
fi
|
||||
}
|
||||
|
||||
write_partition() {
|
||||
if [ ! -f ${ANDROID_PRODUCT_OUT}/${1}.img ]; then
|
||||
exit_with_error "Partition image not found. Run 'make ${1}image' first."
|
||||
fi
|
||||
|
||||
echo "Copying ${1}..."
|
||||
sudo umount /dev/${DEVICE}${2}
|
||||
sudo dd if=${ANDROID_PRODUCT_OUT}/${1}.img of=/dev/${DEVICE}${2} bs=1M
|
||||
}
|
||||
|
||||
wipe_userdata() {
|
||||
echo "Creating userdata..."
|
||||
sudo umount /dev/${DEVICE}4
|
||||
sudo wipefs -a /dev/${DEVICE}4
|
||||
sudo mkfs.ext4 /dev/${DEVICE}4 -I 512 -L userdata
|
||||
}
|
||||
|
||||
finish() {
|
||||
sync
|
||||
echo "Done!"
|
||||
exit 0
|
||||
}
|
||||
|
||||
if [ -z ${TARGET_PRODUCT} ]; then
|
||||
exit_with_error "TARGET_PRODUCT environment variable is not set. Run lunch first."
|
||||
fi
|
||||
|
||||
if [ -z ${ANDROID_PRODUCT_OUT} ]; then
|
||||
exit_with_error "ANDROID_PRODUCT_OUT environment variable is not set. Run lunch first."
|
||||
fi
|
||||
|
||||
TARGET=$(echo ${TARGET_PRODUCT} | sed 's/^aosp_//')
|
||||
DEVICE=
|
||||
|
||||
if [ -z $1 ]; then
|
||||
find_device
|
||||
confirm ${TARGET} "boot, system, and vendor"
|
||||
write_partition boot 1
|
||||
write_partition system 2
|
||||
write_partition vendor 3
|
||||
finish
|
||||
elif [ ! -z $1 ] && [ $1 == "boot" ]; then
|
||||
find_device
|
||||
confirm ${TARGET} "boot"
|
||||
write_partition boot 1
|
||||
finish
|
||||
elif [ ! -z $1 ] && [ $1 == "system" ]; then
|
||||
find_device
|
||||
confirm ${TARGET} "system"
|
||||
write_partition system 2
|
||||
finish
|
||||
elif [ ! -z $1 ] && [ $1 == "vendor" ]; then
|
||||
find_device
|
||||
confirm ${TARGET} "vendor"
|
||||
write_partition vendor 3
|
||||
finish
|
||||
elif [ ! -z $1 ] && [ $1 == "wipe" ]; then
|
||||
find_device
|
||||
confirm ${TARGET} "wipe"
|
||||
wipe_userdata
|
||||
finish
|
||||
else
|
||||
exit_with_error "Usage: $0 [boot|system|vendor|wipe]"
|
||||
fi
|
Reference in New Issue
Block a user