Compare commits
254 Commits
android-12
...
android-16
Author | SHA1 | Date | |
---|---|---|---|
|
e38828e453 | ||
|
aaafd4ad77 | ||
|
6a138fcbc3 | ||
|
eefaf52ed2 | ||
|
73dc302e7c | ||
|
79499edb0a | ||
|
9f56322d0d | ||
|
a27160eac6 | ||
|
f051aa7456 | ||
|
6da2011d04 | ||
|
97d178fb0f | ||
|
dbb03fcd99 | ||
|
5edcb4f1e5 | ||
|
e0c894f6bb | ||
|
08fd823c92 | ||
|
872f2d93ff | ||
|
0eacc6e521 | ||
|
596751674d | ||
|
b5dfa61808 | ||
|
df1f9b11a5 | ||
|
8848000689 | ||
|
b859ded61e | ||
|
6805e02d6a | ||
|
f3265ec330 | ||
|
f46b7392fe | ||
|
2103ad1dea | ||
|
1b4858762d | ||
|
583d56ec4b | ||
|
47143a3804 | ||
|
a33fafc261 | ||
|
13af585d0d | ||
|
8e63b830e2 | ||
|
a96b2234a4 | ||
|
062049cecd | ||
|
faa832f059 | ||
|
27d5b9a0b8 | ||
|
0dc4975917 | ||
|
8a1b860709 | ||
|
ee074c799e | ||
|
e5346626fc | ||
|
6456ba251c | ||
|
d10016b71d | ||
|
4aa73b41a6 | ||
|
bc7579e2a5 | ||
|
5420780e92 | ||
|
05888d86db | ||
|
46fe18c658 | ||
|
2e6ec77756 | ||
|
be863bb0bf | ||
|
48b4fe88df | ||
|
f3eec1f842 | ||
|
2241197367 | ||
|
b6700c25a6 | ||
|
e6363fd2d6 | ||
|
08303135d2 | ||
|
b7cafd27c1 | ||
|
f6fe82c411 | ||
|
667fad95e6 | ||
|
50cc6c9ca9 | ||
|
6fbb90fa33 | ||
|
3022586712 | ||
|
47a329c4e4 | ||
|
4ffea81903 | ||
|
080a9d7c3a | ||
|
e82989d87f | ||
|
6db460055a | ||
|
00e46f0d1e | ||
|
faabc62ea4 | ||
|
ca95b7824f | ||
|
e288798b65 | ||
|
543cb97137 | ||
|
e03e665eec | ||
|
aa53179895 | ||
|
7d91c1b33c | ||
|
146369a9a4 | ||
|
221f89b35f | ||
|
8fc1e786fc | ||
|
06c2ae2559 | ||
|
c8117b1305 | ||
|
b310542c14 | ||
|
f92559efc7 | ||
|
8ec47479b4 | ||
|
93dbd7462f | ||
|
d6d1d6fe05 | ||
|
b57146cc25 | ||
|
2aaf56aafd | ||
|
19f52b0ded | ||
|
5dc267dfe4 | ||
|
533b650a59 | ||
|
6001b95ce2 | ||
|
2ecea7b694 | ||
|
3ad6a96d46 | ||
|
60955c261b | ||
|
24b579dfc4 | ||
|
8f75b1471c | ||
|
4edc28ddf9 | ||
|
579d405eaf | ||
|
ba42314531 | ||
|
f3f1bf945f | ||
|
7ab77538e6 | ||
|
b3a1d84235 | ||
|
fd9c60bdaf | ||
|
6a128defbc | ||
|
41ddcf5ca5 | ||
|
e942debb44 | ||
|
e5359d2734 | ||
|
9f396b332a | ||
|
dfdcfe5c6e | ||
|
05919b729a | ||
|
2cc1d0e2ab | ||
|
bc6e2d5ee2 | ||
|
99ebee2452 | ||
|
fe6264c79f | ||
|
e934722c00 | ||
|
4815bb04bd | ||
|
bad22b6d33 | ||
|
7a16da5609 | ||
|
e928f841f0 | ||
|
b27f62c475 | ||
|
a2363586b2 | ||
|
aa56ad1961 | ||
|
3d223ae030 | ||
|
941fb0f0c1 | ||
|
3fba3e61e5 | ||
|
441c2cde9f | ||
|
be7c3b6462 | ||
|
c86505857d | ||
|
fe5a39b067 | ||
|
75efcfcbb4 | ||
|
be98ffc92d | ||
|
21a6d545b2 | ||
|
01569e8eec | ||
|
f9f7db29e1 | ||
|
6119d30d95 | ||
|
ce6b4687fa | ||
|
2bcf780b91 | ||
|
aebb08edae | ||
|
fb83928d5a | ||
|
9fdacb0960 | ||
|
2785f1c5fd | ||
|
c94112be0b | ||
|
0113344e01 | ||
|
741b658768 | ||
|
c0ecc79bbb | ||
|
e107fc556c | ||
|
85a8359c38 | ||
|
31279e096f | ||
|
c2217592d2 | ||
|
ef8706e703 | ||
|
3ed5d0e615 | ||
|
33e503a632 | ||
|
a152d68eac | ||
|
9f0b78612e | ||
|
7e5f70d8a8 | ||
|
7f899c9b64 | ||
|
3856f29874 | ||
|
2790cd7abd | ||
|
881295d1f0 | ||
|
0424549bf0 | ||
|
4a80053345 | ||
|
ca3c59bc6e | ||
|
34e6ccbc75 | ||
|
ec52be7fcf | ||
|
cfb419c398 | ||
|
7276df653b | ||
|
b1e605a615 | ||
|
57cdc04899 | ||
|
073f50878f | ||
|
973797e543 | ||
|
b7ac80d55f | ||
|
eef70eed76 | ||
|
49655668d2 | ||
|
e47485495e | ||
|
d9457507d1 | ||
|
9dd0d06c97 | ||
|
810864227d | ||
|
77d8091ba1 | ||
|
f5db2884d7 | ||
|
38a5c9ff94 | ||
|
0205059ddb | ||
|
ef056e1f91 | ||
|
51d93e9116 | ||
|
54a1d67860 | ||
|
cafac234ff | ||
|
c1f7f3e677 | ||
|
c4a082a910 | ||
|
8a64b0130c | ||
|
58de1fd5f1 | ||
|
3f4462dd77 | ||
|
1ac293a581 | ||
|
99f26e997f | ||
|
2632bb5db3 | ||
|
eeeab1fb7e | ||
|
2dc938adef | ||
|
a1b1670f1c | ||
|
31b0958771 | ||
|
d1476ec29f | ||
|
c9cb165c19 | ||
|
2df5bd40b4 | ||
|
003d08a615 | ||
|
29e89ed615 | ||
|
7e2e50fdb5 | ||
|
68d59d4e59 | ||
|
5193e6ce38 | ||
|
f396cbd7cd | ||
|
f40e2e0b3f | ||
|
8ed26e6ce0 | ||
|
b194bfeb50 | ||
|
f973ec3b27 | ||
|
d2d71de351 | ||
|
91e679f985 | ||
|
a44c8a0e42 | ||
|
b11baea4dd | ||
|
cc4df73839 | ||
|
18cc1bd154 | ||
|
8c2871ed29 | ||
|
1c8d67b68d | ||
|
1273c5706f | ||
|
441fee39c8 | ||
|
c0a8378d8b | ||
|
6dd65fa73f | ||
|
9d97214096 | ||
|
2c74170885 | ||
|
fa4e05caab | ||
|
aa699b1415 | ||
|
30b46be80b | ||
|
7e49f1dadb | ||
|
5aefdbab09 | ||
|
4c17ea10df | ||
|
cac7486609 | ||
|
6f2c07f589 | ||
|
cccd7a63ec | ||
|
c6ecc0a1dd | ||
|
f74ee1fc3d | ||
|
53a5d230cc | ||
|
1b30e93a6a | ||
|
e0a401b461 | ||
|
526eb3759b | ||
|
2207df9355 | ||
|
a6453efdef | ||
|
dc1fc3a6e3 | ||
|
4bb647b2d6 | ||
|
523369cab2 | ||
|
9b826f72b8 | ||
|
8150438454 | ||
|
5ca6214215 | ||
|
203db632fa | ||
|
1e8030c243 | ||
|
3ca55b2c31 | ||
|
1951d76f1e | ||
|
7c245cd045 | ||
|
cc22a51844 | ||
|
8c709130cd | ||
|
c76b23f21e |
@@ -1,11 +1,15 @@
|
||||
#
|
||||
# Copyright (C) 2021-2022 KonstaKANG
|
||||
# Copyright (C) 2021-2023 KonstaKANG
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
PRODUCT_MAKEFILES := \
|
||||
$(LOCAL_DIR)/aosp_rpi4.mk
|
||||
$(LOCAL_DIR)/aosp_rpi4.mk \
|
||||
$(LOCAL_DIR)/aosp_rpi4_car.mk \
|
||||
$(LOCAL_DIR)/aosp_rpi4_tv.mk
|
||||
|
||||
COMMON_LUNCH_CHOICES := \
|
||||
aosp_rpi4-userdebug
|
||||
aosp_rpi4-trunk_staging-userdebug \
|
||||
aosp_rpi4_car-trunk_staging-userdebug \
|
||||
aosp_rpi4_tv-trunk_staging-userdebug
|
||||
|
@@ -6,83 +6,67 @@
|
||||
|
||||
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
|
||||
TARGET_CPU_ABI2 :=
|
||||
TARGET_CPU_VARIANT := cortex-a72
|
||||
|
||||
TARGET_2ND_ARCH := arm
|
||||
TARGET_2ND_ARCH_VARIANT := armv7-a-neon
|
||||
TARGET_2ND_CPU_ABI := armeabi-v7a
|
||||
TARGET_2ND_CPU_ABI2 := armeabi
|
||||
TARGET_2ND_CPU_VARIANT := cortex-a72
|
||||
TARGET_CPU_VARIANT := generic
|
||||
|
||||
# Bluetooth
|
||||
BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := $(DEVICE_PATH)/bluetooth
|
||||
BOARD_CUSTOM_BT_CONFIG := $(DEVICE_PATH)/bluetooth/vnd_rpi4.txt
|
||||
BOARD_HAVE_BLUETOOTH := true
|
||||
BOARD_HAVE_BLUETOOTH_BCM := true
|
||||
|
||||
# Camera
|
||||
BOARD_LIBCAMERA_IPAS := raspberrypi
|
||||
BOARD_LIBCAMERA_PIPELINES := raspberrypi
|
||||
BOARD_LIBCAMERA_USES_MESON_BUILD := true
|
||||
# Bootloader
|
||||
TARGET_NO_BOOTLOADER := true
|
||||
|
||||
# Display
|
||||
TARGET_SCREEN_DENSITY := 240
|
||||
|
||||
# Graphics
|
||||
BOARD_MESA3D_USES_MESON_BUILD := true
|
||||
BOARD_MESA3D_GALLIUM_DRIVERS := vc4 v3d
|
||||
BOARD_MESA3D_VULKAN_DRIVERS := broadcom
|
||||
|
||||
# Kernel
|
||||
BOARD_CUSTOM_BOOTIMG := true
|
||||
BOARD_CUSTOM_BOOTIMG_MK := $(DEVICE_PATH)/mkbootimg.mk
|
||||
BOARD_KERNEL_CMDLINE := console=ttyS0,115200 no_console_suspend root=/dev/ram0 rootwait androidboot.hardware=rpi4
|
||||
|
||||
# Manifest
|
||||
DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE := $(DEVICE_PATH)/framework_compatibility_matrix.xml
|
||||
DEVICE_MANIFEST_FILE := $(DEVICE_PATH)/manifest.xml
|
||||
DEVICE_MATRIX_FILE := $(DEVICE_PATH)/compatibility_matrix.xml
|
||||
|
||||
# Media
|
||||
TARGET_ENABLE_MEDIADRM_64 := true
|
||||
PRODUCT_MANIFEST_FILES := $(DEVICE_PATH)/product_manifest.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
|
||||
BOARD_KERNEL_CMDLINE += androidboot.hypervisor.vm.supported=1
|
||||
|
||||
# Wifi
|
||||
BOARD_WLAN_DEVICE := bcmdhd
|
||||
BOARD_HOSTAPD_DRIVER := NL80211
|
||||
BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_$(BOARD_WLAN_DEVICE)
|
||||
BOARD_WPA_SUPPLICANT_DRIVER := NL80211
|
||||
BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_$(BOARD_WLAN_DEVICE)
|
||||
WIFI_HIDL_UNIFIED_SUPPLICANT_SERVICE_RC_ENTRY := true
|
||||
WPA_SUPPLICANT_VERSION := VER_0_8_X
|
||||
BOARD_KERNEL_CMDLINE += androidboot.wificountrycode=00
|
||||
|
@@ -1 +1 @@
|
||||
Raspberry Vanilla AOSP 12 device configuration for Raspberry Pi 4.
|
||||
Raspberry Vanilla AOSP 16 device configuration for Raspberry Pi 4.
|
||||
|
31
aosp_rpi4.mk
31
aosp_rpi4.mk
@@ -1,16 +1,41 @@
|
||||
#
|
||||
# Copyright (C) 2021-2022 KonstaKANG
|
||||
# Copyright (C) 2021-2023 KonstaKANG
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
DEVICE_PATH := device/brcm/rpi4
|
||||
|
||||
# Inherit device configuration
|
||||
$(call inherit-product, device/brcm/rpi4/device.mk)
|
||||
|
||||
PRODUCT_AAPT_CONFIG := normal mdpi hdpi
|
||||
PRODUCT_AAPT_PREF_CONFIG := hdpi
|
||||
PRODUCT_CHARACTERISTICS := tablet,nosdcard
|
||||
|
||||
$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base.mk)
|
||||
$(call enforce-product-packages-exist,com.android.ranging)
|
||||
|
||||
# Keylayout
|
||||
PRODUCT_COPY_FILES += \
|
||||
$(DEVICE_PATH)/keylayout/Generic.kl:$(TARGET_COPY_OUT_VENDOR)/usr/keylayout/Generic.kl
|
||||
|
||||
# Overlays
|
||||
PRODUCT_PACKAGES += \
|
||||
AndroidRpiOverlay \
|
||||
BluetoothRpiOverlay \
|
||||
SettingsProviderRpiOverlay \
|
||||
SettingsRpiOverlay \
|
||||
SystemUIRpiOverlay \
|
||||
WifiRpiOverlay
|
||||
|
||||
# Permissions
|
||||
PRODUCT_COPY_FILES += \
|
||||
frameworks/native/data/etc/tablet_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/tablet_core_hardware.xml
|
||||
|
||||
# Device identifier. This must come after all inclusions.
|
||||
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
|
||||
|
118
aosp_rpi4_car.mk
Normal file
118
aosp_rpi4_car.mk
Normal file
@@ -0,0 +1,118 @@
|
||||
#
|
||||
# Copyright (C) 2021-2023 KonstaKANG
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
DEVICE_PATH := device/brcm/rpi4
|
||||
|
||||
# Inherit device configuration
|
||||
$(call inherit-product, device/brcm/rpi4/device.mk)
|
||||
|
||||
PRODUCT_AAPT_CONFIG := normal mdpi hdpi
|
||||
PRODUCT_AAPT_PREF_CONFIG := hdpi
|
||||
PRODUCT_CHARACTERISTICS := automotive,nosdcard
|
||||
|
||||
$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base.mk)
|
||||
$(call inherit-product, packages/services/Car/car_product/build/car.mk)
|
||||
$(call enforce-product-packages-exist,Bluetooth Keyguard Launcher2 OverviewApp RotaryIME RotaryPlayground com.android.ranging libnfc_ndef libvariablespeed pppd)
|
||||
|
||||
# Audio
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.automotive.audiocontrol-service.example
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
$(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.asha.central.enabled=false \
|
||||
bluetooth.profile.bap.broadcast.assist.enabled=false \
|
||||
bluetooth.profile.bap.unicast.client.enabled=false \
|
||||
bluetooth.profile.bas.client.enabled=false \
|
||||
bluetooth.profile.ccp.server.enabled=false \
|
||||
bluetooth.profile.csip.set_coordinator.enabled=false \
|
||||
bluetooth.profile.hap.client.enabled=false \
|
||||
bluetooth.profile.hfp.ag.enabled=false \
|
||||
bluetooth.profile.hid.device.enabled=false \
|
||||
bluetooth.profile.hid.host.enabled=false \
|
||||
bluetooth.profile.map.server.enabled=false \
|
||||
bluetooth.profile.mcp.server.enabled=false \
|
||||
bluetooth.profile.opp.enabled=false \
|
||||
bluetooth.profile.pbap.server.enabled=false \
|
||||
bluetooth.profile.sap.server.enabled=false \
|
||||
bluetooth.profile.vcp.controller.enabled=false
|
||||
|
||||
# Broadcast radio
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.broadcastradio-service.default
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
frameworks/native/data/etc/android.hardware.broadcastradio.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.broadcastradio.xml
|
||||
|
||||
# Camera
|
||||
ENABLE_CAMERA_SERVICE := true
|
||||
|
||||
# CAN
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.automotive.can-service
|
||||
|
||||
PRODUCT_PACKAGES += \
|
||||
canhalctrl \
|
||||
canhaldump \
|
||||
canhalsend
|
||||
|
||||
# Display
|
||||
PRODUCT_COPY_FILES += \
|
||||
$(DEVICE_PATH)/car/display_settings.xml:$(TARGET_COPY_OUT_VENDOR)/etc/display_settings.xml
|
||||
|
||||
# EVS
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.automotive.evs-v4l2 \
|
||||
cardisplayproxyd \
|
||||
CarEvsCameraPreviewApp \
|
||||
evs_app \
|
||||
evsmanagerd
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
packages/services/Car/cpp/evs/manager/aidl/init.evs.rc:$(TARGET_COPY_OUT_SYSTEM)/etc/init/init.evs.rc
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
$(DEVICE_PATH)/car/evs_config_override.json:${TARGET_COPY_OUT_VENDOR}/etc/automotive/evs/config_override.json
|
||||
|
||||
include packages/services/Car/cpp/evs/apps/sepolicy/evsapp.mk
|
||||
|
||||
# Keylayout
|
||||
PRODUCT_COPY_FILES += \
|
||||
$(DEVICE_PATH)/keylayout/Generic.kl:$(TARGET_COPY_OUT_VENDOR)/usr/keylayout/Generic.kl
|
||||
|
||||
# Occupant awareness
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.automotive.occupant_awareness@1.0-service
|
||||
|
||||
include packages/services/Car/car_product/occupant_awareness/OccupantAwareness.mk
|
||||
|
||||
# Overlays
|
||||
PRODUCT_PACKAGES += \
|
||||
AndroidRpiOverlay \
|
||||
BluetoothRpiOverlay \
|
||||
CarServiceRpiOverlay \
|
||||
SettingsProviderRpiOverlay \
|
||||
WifiRpiOverlay
|
||||
|
||||
# Permissions
|
||||
PRODUCT_COPY_FILES += \
|
||||
frameworks/native/data/etc/android.software.activities_on_secondary_displays.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.activities_on_secondary_displays.xml \
|
||||
frameworks/native/data/etc/car_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/car_core_hardware.xml
|
||||
|
||||
# Vehicle
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.automotive.vehicle@V4-default-service
|
||||
|
||||
# Device identifier. This must come after all inclusions.
|
||||
PRODUCT_DEVICE := rpi4
|
||||
PRODUCT_NAME := aosp_rpi4_car
|
||||
PRODUCT_BRAND := Raspberry
|
||||
PRODUCT_MODEL := Pi 4
|
||||
PRODUCT_MANUFACTURER := Raspberry
|
50
aosp_rpi4_tv.mk
Normal file
50
aosp_rpi4_tv.mk
Normal file
@@ -0,0 +1,50 @@
|
||||
#
|
||||
# Copyright (C) 2021-2023 KonstaKANG
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
DEVICE_PATH := device/brcm/rpi4
|
||||
|
||||
# Inherit device configuration
|
||||
$(call inherit-product, device/brcm/rpi4/device.mk)
|
||||
|
||||
PRODUCT_AAPT_PREF_CONFIG := tvdpi
|
||||
PRODUCT_CHARACTERISTICS := tv
|
||||
|
||||
$(call inherit-product, device/google/atv/products/atv_base.mk)
|
||||
$(call enforce-product-packages-exist,com.android.ranging)
|
||||
|
||||
# Android TV
|
||||
PRODUCT_PACKAGES += \
|
||||
DocumentsUI \
|
||||
LeanbackIME \
|
||||
TvProvision \
|
||||
TvSampleLeanbackLauncher \
|
||||
TvSettingsTwoPanel
|
||||
|
||||
# Bluetooth
|
||||
PRODUCT_VENDOR_PROPERTIES += \
|
||||
bluetooth.device.class_of_device=34,4,36
|
||||
|
||||
# Boot animation
|
||||
PRODUCT_COPY_FILES += \
|
||||
device/google/atv/products/bootanimations/bootanimation.zip:$(TARGET_COPY_OUT_SYSTEM)/media/bootanimation.zip
|
||||
|
||||
# Keylayout
|
||||
PRODUCT_COPY_FILES += \
|
||||
$(DEVICE_PATH)/keylayout/Generic-tv.kl:$(TARGET_COPY_OUT_VENDOR)/usr/keylayout/Generic.kl
|
||||
|
||||
# Overlays
|
||||
PRODUCT_PACKAGES += \
|
||||
AndroidTvRpiOverlay \
|
||||
BluetoothRpiOverlay \
|
||||
SettingsProviderTvRpiOverlay \
|
||||
WifiRpiOverlay
|
||||
|
||||
# Device identifier. This must come after all inclusions.
|
||||
PRODUCT_DEVICE := rpi4
|
||||
PRODUCT_NAME := aosp_rpi4_tv
|
||||
PRODUCT_BRAND := Raspberry
|
||||
PRODUCT_MODEL := Pi 4
|
||||
PRODUCT_MANUFACTURER := Raspberry
|
@@ -1,12 +1,12 @@
|
||||
// Copyright (C) 2015 The Android Open Source Project
|
||||
// Copyright (C) 2021-2022 KonstaKANG
|
||||
// Copyright (C) 2021-2023 KonstaKANG
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
cc_library_shared {
|
||||
name: "audio.primary.rpi",
|
||||
relative_install_path: "hw",
|
||||
proprietary: true,
|
||||
vendor: true,
|
||||
srcs: ["audio_hw.c"],
|
||||
include_dirs: [
|
||||
"external/expat/lib",
|
||||
@@ -22,3 +22,22 @@ cc_library_shared {
|
||||
],
|
||||
cflags: ["-Wno-unused-parameter"],
|
||||
}
|
||||
|
||||
cc_library_shared {
|
||||
name: "audio.primary.rpi_hdmi",
|
||||
relative_install_path: "hw",
|
||||
vendor: true,
|
||||
srcs: ["audio_hw_hdmi.c"],
|
||||
include_dirs: [
|
||||
"external/expat/lib",
|
||||
"system/media/audio_effects/include",
|
||||
"system/media/audio_utils/include",
|
||||
],
|
||||
header_libs: ["libhardware_headers"],
|
||||
shared_libs: [
|
||||
"libcutils",
|
||||
"liblog",
|
||||
"libasound",
|
||||
],
|
||||
cflags: ["-Wno-unused-parameter"],
|
||||
}
|
||||
|
@@ -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;
|
||||
};
|
||||
@@ -84,17 +87,52 @@ struct alsa_stream_out {
|
||||
unsigned int written;
|
||||
};
|
||||
|
||||
static int probe_pcm_out_card() {
|
||||
FILE *fp;
|
||||
char card_node[32];
|
||||
char card_id[16];
|
||||
|
||||
char card_prop[PROPERTY_VALUE_MAX];
|
||||
property_get("persist.vendor.audio.device", card_prop, "");
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
snprintf(card_node, sizeof(card_node), "/proc/asound/card%d/id", i);
|
||||
if ((fp = fopen(card_node, "r")) != NULL) {
|
||||
fgets(card_id, sizeof(card_id), fp);
|
||||
ALOGV("%s: %s", card_node, card_id);
|
||||
if (!strcmp(card_prop, "jack") && !strncmp(card_id, "Headphones", 10)) {
|
||||
fclose(fp);
|
||||
ALOGI("Using PCM card %d for 3.5mm audio jack", i);
|
||||
return i;
|
||||
} else if (!strcmp(card_prop, "dac") && strncmp(card_id, "Headphones", 10)
|
||||
&& strncmp(card_id, "vc4hdmi", 7)) {
|
||||
fclose(fp);
|
||||
ALOGI("Using PCM card %d for audio DAC %s", i, card_id);
|
||||
return i;
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
|
||||
ALOGE("Could not probe PCM card for %s, using PCM card 0", card_prop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_pcm_card()
|
||||
{
|
||||
char card[PROPERTY_VALUE_MAX];
|
||||
property_get("persist.audio.pcm.card", card, "0");
|
||||
property_get("persist.vendor.audio.pcm.card.auto", card, "false");
|
||||
if (!strcmp(card, "true"))
|
||||
return probe_pcm_out_card();
|
||||
|
||||
property_get("persist.vendor.audio.pcm.card", card, "0");
|
||||
return atoi(card);
|
||||
}
|
||||
|
||||
static int get_pcm_device()
|
||||
{
|
||||
char device[PROPERTY_VALUE_MAX];
|
||||
property_get("persist.audio.pcm.device", device, "0");
|
||||
property_get("persist.vendor.audio.pcm.device", device, "0");
|
||||
return atoi(device);
|
||||
}
|
||||
|
||||
@@ -113,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));
|
||||
@@ -311,17 +349,17 @@ static int out_get_presentation_position(const struct audio_stream_out *stream,
|
||||
struct alsa_stream_out *out = (struct alsa_stream_out *)stream;
|
||||
int ret = -1;
|
||||
|
||||
if (out->pcm) {
|
||||
unsigned int avail;
|
||||
if (pcm_get_htimestamp(out->pcm, &avail, timestamp) == 0) {
|
||||
size_t kernel_buffer_size = out->config.period_size * out->config.period_count;
|
||||
int64_t signed_frames = out->written - kernel_buffer_size + avail;
|
||||
if (signed_frames >= 0) {
|
||||
*frames = signed_frames;
|
||||
ret = 0;
|
||||
}
|
||||
if (out->pcm) {
|
||||
unsigned int avail;
|
||||
if (pcm_get_htimestamp(out->pcm, &avail, timestamp) == 0) {
|
||||
size_t kernel_buffer_size = out->config.period_size * out->config.period_count;
|
||||
int64_t signed_frames = out->written - kernel_buffer_size + avail;
|
||||
if (signed_frames >= 0) {
|
||||
*frames = signed_frames;
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -449,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;
|
||||
|
||||
@@ -655,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;
|
||||
|
||||
|
773
audio/audio_hw_hdmi.c
Normal file
773
audio/audio_hw_hdmi.c
Normal file
@@ -0,0 +1,773 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
* Copyright (C) 2021-2023 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 "audio_hw_rpi_hdmi"
|
||||
//#define LOG_NDEBUG 0
|
||||
|
||||
#include <errno.h>
|
||||
#include <malloc.h>
|
||||
#include <pthread.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/time.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <log/log.h>
|
||||
#include <cutils/str_parms.h>
|
||||
#include <cutils/properties.h>
|
||||
|
||||
#include <hardware/hardware.h>
|
||||
#include <system/audio.h>
|
||||
#include <hardware/audio.h>
|
||||
|
||||
#include <alsa/asoundlib.h>
|
||||
#include <audio_utils/resampler.h>
|
||||
#include <audio_utils/echo_reference.h>
|
||||
#include <hardware/audio_effect.h>
|
||||
#include <audio_effects/effect_aec.h>
|
||||
|
||||
|
||||
/* Minimum granularity - Arbitrary but small value */
|
||||
#define CODEC_BASE_FRAME_COUNT 32
|
||||
|
||||
/* number of base blocks in a short period (low latency) */
|
||||
#define PERIOD_MULTIPLIER 32 /* 21 ms */
|
||||
/* number of frames per short period (low latency) */
|
||||
#define PERIOD_SIZE (CODEC_BASE_FRAME_COUNT * PERIOD_MULTIPLIER)
|
||||
/* number of pseudo periods for low latency playback */
|
||||
#define PLAYBACK_PERIOD_COUNT 4
|
||||
#define PLAYBACK_PERIOD_START_THRESHOLD 2
|
||||
#define CODEC_SAMPLING_RATE 48000
|
||||
#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;
|
||||
};
|
||||
|
||||
struct alsa_audio_device {
|
||||
struct audio_hw_device hw_device;
|
||||
|
||||
pthread_mutex_t lock; /* see note below on mutex acquisition order */
|
||||
int devices;
|
||||
struct alsa_stream_in *active_input;
|
||||
struct alsa_stream_out *active_output;
|
||||
bool mic_mute;
|
||||
};
|
||||
|
||||
struct alsa_stream_out {
|
||||
struct audio_stream_out stream;
|
||||
struct alsa_audio_device *dev;
|
||||
|
||||
pthread_mutex_t lock; /* see note below on mutex acquisition order */
|
||||
snd_pcm_t *pcm;
|
||||
|
||||
snd_pcm_uframes_t period_size;
|
||||
unsigned int periods;
|
||||
snd_pcm_uframes_t buffer_size;
|
||||
|
||||
bool unavailable;
|
||||
int standby;
|
||||
snd_pcm_uframes_t written;
|
||||
};
|
||||
|
||||
static void get_alsa_device_name(char *name) {
|
||||
char hdmi_device[PROPERTY_VALUE_MAX];
|
||||
property_get("persist.vendor.audio.hdmi.device", hdmi_device, "vc4hdmi0");
|
||||
|
||||
// use card configured in vc4-hdmi.conf to get IEC958 subframe conversion
|
||||
sprintf(name, "default:CARD=%s", hdmi_device);
|
||||
}
|
||||
|
||||
/* must be called with hw device and output stream mutexes locked */
|
||||
static int start_output_stream(struct alsa_stream_out *out)
|
||||
{
|
||||
struct alsa_audio_device *adev = out->dev;
|
||||
|
||||
if (out->unavailable)
|
||||
return -ENODEV;
|
||||
|
||||
ALOGI("start_output_stream: %s", device_name);
|
||||
|
||||
int r;
|
||||
snd_pcm_t *pcm;
|
||||
|
||||
if ((r = snd_pcm_open(&pcm, device_name, SND_PCM_STREAM_PLAYBACK, 0) < 0)) {
|
||||
ALOGE("cannot open pcm_out driver: %s", snd_strerror(r));
|
||||
adev->active_output = NULL;
|
||||
out->unavailable = true;
|
||||
return -ENODEV;
|
||||
}
|
||||
out->pcm = pcm;
|
||||
|
||||
snd_pcm_hw_params_t *hwp;
|
||||
snd_pcm_hw_params_alloca(&hwp);
|
||||
snd_pcm_hw_params_any(pcm, hwp);
|
||||
snd_pcm_hw_params_set_access(pcm, hwp, SND_PCM_ACCESS_RW_INTERLEAVED);
|
||||
snd_pcm_hw_params_set_format(pcm, hwp, SND_PCM_FORMAT_S16_LE);
|
||||
snd_pcm_hw_params_set_rate(pcm, hwp, CODEC_SAMPLING_RATE, 0);
|
||||
snd_pcm_hw_params_set_channels(pcm, hwp, CHANNEL_STEREO);
|
||||
|
||||
// Configurue period_size, periods and buffer_size
|
||||
int dir = 0;
|
||||
out->period_size = PERIOD_SIZE;
|
||||
if ((r = snd_pcm_hw_params_set_period_size_near(pcm, hwp, &out->period_size, &dir)) < 0) {
|
||||
ALOGE("cannot snd_pcm_hw_params_set_period_size_near: %s", snd_strerror(r));
|
||||
adev->active_output = NULL;
|
||||
out->unavailable = true;
|
||||
return -ENODEV;
|
||||
}
|
||||
dir = 0;
|
||||
out->periods = PLAYBACK_PERIOD_COUNT;
|
||||
if ((r = snd_pcm_hw_params_set_periods_near(pcm, hwp, &out->periods, &dir)) < 0) {
|
||||
ALOGE("cannot snd_pcm_hw_params_set_periods_near: %s", snd_strerror(r));
|
||||
adev->active_output = NULL;
|
||||
out->unavailable = true;
|
||||
return -ENODEV;
|
||||
}
|
||||
out->buffer_size = out->period_size * out->periods;
|
||||
if ((r = snd_pcm_hw_params_set_buffer_size_near(pcm, hwp, &out->buffer_size)) < 0) {
|
||||
ALOGE("cannot snd_pcm_hw_params_set_buffer_size_near: %s", snd_strerror(r));
|
||||
adev->active_output = NULL;
|
||||
out->unavailable = true;
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
//write the hw params
|
||||
if ((r = snd_pcm_hw_params(pcm, hwp)) < 0) {
|
||||
ALOGE("cannot snd_pcm_hw_params: %s", snd_strerror(r));
|
||||
adev->active_output = NULL;
|
||||
out->unavailable = true;
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
//Software parameters
|
||||
snd_pcm_sw_params_t *swp;
|
||||
snd_pcm_sw_params_alloca(&swp);
|
||||
snd_pcm_sw_params_current(pcm, swp);
|
||||
|
||||
// set avail_min to period_size
|
||||
if ((r = snd_pcm_sw_params_set_avail_min(pcm, swp, out->period_size)) < 0) {
|
||||
ALOGE("cannot snd_pcm_sw_params_set_avail_min: %s", snd_strerror(r));
|
||||
adev->active_output = NULL;
|
||||
out->unavailable = true;
|
||||
return -ENODEV;
|
||||
}
|
||||
// set start_threshold to period_size * PLAYBACK_PERIOD_START_THRESHOLD
|
||||
if ((r = snd_pcm_sw_params_set_start_threshold(pcm, swp, out->period_size * PLAYBACK_PERIOD_START_THRESHOLD)) < 0) {
|
||||
ALOGE("cannot snd_pcm_sw_params_set_start_threshold: %s", snd_strerror(r));
|
||||
adev->active_output = NULL;
|
||||
out->unavailable = true;
|
||||
return -ENODEV;
|
||||
}
|
||||
//write the sw params
|
||||
if ((r = snd_pcm_sw_params(pcm, swp)) < 0) {
|
||||
ALOGE("cannot snd_pcm_sw_params: %s", snd_strerror(r));
|
||||
adev->active_output = NULL;
|
||||
out->unavailable = true;
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
// prepare
|
||||
if ((r = snd_pcm_prepare(pcm)) < 0) {
|
||||
ALOGE("cannot snd_pcm_prepare: %s", snd_strerror(r));
|
||||
adev->active_output = NULL;
|
||||
out->unavailable = true;
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
adev->active_output = out;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint32_t out_get_sample_rate(const struct audio_stream *stream)
|
||||
{
|
||||
ALOGV("out_get_sample_rate: %d", CODEC_SAMPLING_RATE);
|
||||
return CODEC_SAMPLING_RATE;
|
||||
}
|
||||
|
||||
static int out_set_sample_rate(struct audio_stream *stream, uint32_t rate)
|
||||
{
|
||||
ALOGV("out_set_sample_rate: %d", 0);
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
static size_t out_get_buffer_size(const struct audio_stream *stream)
|
||||
{
|
||||
struct alsa_stream_out *out = (struct alsa_stream_out *)stream;
|
||||
|
||||
/* return the closest majoring multiple of 16 frames, as
|
||||
* audioflinger expects audio buffers to be a multiple of 16 frames */
|
||||
size_t size = out->period_size;
|
||||
size = ((size + 15) / 16) * 16;
|
||||
ALOGV("out_get_buffer_size: %ld", (long int)size);
|
||||
return size * audio_stream_out_frame_size((struct audio_stream_out *)stream);
|
||||
}
|
||||
|
||||
static audio_channel_mask_t out_get_channels(const struct audio_stream *stream)
|
||||
{
|
||||
ALOGV("out_get_channels: %d", CHANNEL_STEREO);
|
||||
return audio_channel_out_mask_from_count(CHANNEL_STEREO);
|
||||
}
|
||||
|
||||
static audio_format_t out_get_format(const struct audio_stream *stream)
|
||||
{
|
||||
ALOGV("out_get_format: %d", AUDIO_FORMAT_PCM_16_BIT);
|
||||
return AUDIO_FORMAT_PCM_16_BIT;
|
||||
}
|
||||
|
||||
static int out_set_format(struct audio_stream *stream, audio_format_t format)
|
||||
{
|
||||
ALOGV("out_set_format: %d",format);
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
static int do_output_standby(struct alsa_stream_out *out)
|
||||
{
|
||||
struct alsa_audio_device *adev = out->dev;
|
||||
|
||||
if (!out->standby) {
|
||||
snd_pcm_close(out->pcm);
|
||||
out->pcm = NULL;
|
||||
adev->active_output = NULL;
|
||||
out->standby = 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int out_standby(struct audio_stream *stream)
|
||||
{
|
||||
ALOGV("out_standby");
|
||||
struct alsa_stream_out *out = (struct alsa_stream_out *)stream;
|
||||
int status;
|
||||
|
||||
pthread_mutex_lock(&out->dev->lock);
|
||||
pthread_mutex_lock(&out->lock);
|
||||
status = do_output_standby(out);
|
||||
pthread_mutex_unlock(&out->lock);
|
||||
pthread_mutex_unlock(&out->dev->lock);
|
||||
return status;
|
||||
}
|
||||
|
||||
static int out_dump(const struct audio_stream *stream, int fd)
|
||||
{
|
||||
ALOGV("out_dump");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int out_set_parameters(struct audio_stream *stream, const char *kvpairs)
|
||||
{
|
||||
ALOGV("out_set_parameters");
|
||||
struct alsa_stream_out *out = (struct alsa_stream_out *)stream;
|
||||
struct alsa_audio_device *adev = out->dev;
|
||||
struct str_parms *parms;
|
||||
char value[32];
|
||||
int val = 0;
|
||||
int ret = -EINVAL;
|
||||
|
||||
if (kvpairs == NULL || kvpairs[0] == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
parms = str_parms_create_str(kvpairs);
|
||||
|
||||
if (str_parms_get_str(parms, AUDIO_PARAMETER_STREAM_ROUTING, value, sizeof(value)) >= 0) {
|
||||
val = atoi(value);
|
||||
pthread_mutex_lock(&adev->lock);
|
||||
pthread_mutex_lock(&out->lock);
|
||||
if (((adev->devices & AUDIO_DEVICE_OUT_ALL) != val) && (val != 0)) {
|
||||
adev->devices &= ~AUDIO_DEVICE_OUT_ALL;
|
||||
adev->devices |= val;
|
||||
}
|
||||
pthread_mutex_unlock(&out->lock);
|
||||
pthread_mutex_unlock(&adev->lock);
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
str_parms_destroy(parms);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static char * out_get_parameters(const struct audio_stream *stream, const char *keys)
|
||||
{
|
||||
ALOGV("out_get_parameters");
|
||||
return strdup("");
|
||||
}
|
||||
|
||||
static uint32_t out_get_latency(const struct audio_stream_out *stream)
|
||||
{
|
||||
ALOGV("out_get_latency");
|
||||
struct alsa_stream_out *out = (struct alsa_stream_out *)stream;
|
||||
// latency = buffer_size / rate
|
||||
return (out->buffer_size * 1000) / CODEC_SAMPLING_RATE;
|
||||
}
|
||||
|
||||
static int out_set_volume(struct audio_stream_out *stream, float left,
|
||||
float right)
|
||||
{
|
||||
ALOGV("out_set_volume: Left:%f Right:%f", left, right);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ssize_t out_write(struct audio_stream_out *stream, const void* buffer,
|
||||
size_t bytes)
|
||||
{
|
||||
int ret;
|
||||
struct alsa_stream_out *out = (struct alsa_stream_out *)stream;
|
||||
struct alsa_audio_device *adev = out->dev;
|
||||
size_t frame_size = audio_stream_out_frame_size(stream);
|
||||
snd_pcm_uframes_t out_frames = bytes / frame_size;
|
||||
|
||||
/* acquiring hw device mutex systematically is useful if a low priority thread is waiting
|
||||
* on the output stream mutex - e.g. executing select_mode() while holding the hw device
|
||||
* mutex
|
||||
*/
|
||||
pthread_mutex_lock(&adev->lock);
|
||||
pthread_mutex_lock(&out->lock);
|
||||
if (out->standby) {
|
||||
ret = start_output_stream(out);
|
||||
if (ret != 0) {
|
||||
pthread_mutex_unlock(&adev->lock);
|
||||
goto exit;
|
||||
}
|
||||
out->standby = 0;
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&adev->lock);
|
||||
|
||||
ALOGV("out_write: out_frames:%ld", (long int)out_frames);
|
||||
|
||||
ret = snd_pcm_writei(out->pcm, buffer, out_frames);
|
||||
if (ret == out_frames) {
|
||||
out->written += out_frames;
|
||||
}
|
||||
exit:
|
||||
pthread_mutex_unlock(&out->lock);
|
||||
|
||||
if (ret != out_frames) {
|
||||
if (ret == -EPIPE) {
|
||||
ALOGE("underrun deteced -> redo snd_pcm_prepare");
|
||||
snd_pcm_prepare(out->pcm);
|
||||
} else {
|
||||
ALOGE("out_write err: %s", snd_strerror(ret));
|
||||
usleep((int64_t)bytes * 1000000 / audio_stream_out_frame_size(stream) /
|
||||
out_get_sample_rate(&stream->common));
|
||||
}
|
||||
}
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
||||
static int out_get_render_position(const struct audio_stream_out *stream,
|
||||
uint32_t *dsp_frames)
|
||||
{
|
||||
*dsp_frames = 0;
|
||||
ALOGV("out_get_render_position: dsp_frames: %p", dsp_frames);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int out_get_presentation_position(const struct audio_stream_out *stream,
|
||||
uint64_t *frames, struct timespec *timestamp)
|
||||
{
|
||||
struct alsa_stream_out *out = (struct alsa_stream_out *)stream;
|
||||
int ret = -1;
|
||||
|
||||
if (out->pcm) {
|
||||
snd_pcm_uframes_t avail;
|
||||
int r;
|
||||
if ((r = snd_pcm_htimestamp(out->pcm, &avail, timestamp)) == 0) {
|
||||
int64_t signed_frames = (int64_t)(out->written) - out->buffer_size + avail;
|
||||
if (signed_frames >= 0) {
|
||||
*frames = signed_frames;
|
||||
ret = 0;
|
||||
}
|
||||
ALOGV("out_get_presentation_position: %ld", (long int)(*frames));
|
||||
} else {
|
||||
ALOGE("out_get_presentation_position: err: %s", snd_strerror(r));
|
||||
}
|
||||
} else {
|
||||
ALOGV("out_get_presentation_position: stream in standby");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int out_add_audio_effect(const struct audio_stream *stream, effect_handle_t effect)
|
||||
{
|
||||
ALOGV("out_add_audio_effect: %p", effect);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int out_remove_audio_effect(const struct audio_stream *stream, effect_handle_t effect)
|
||||
{
|
||||
ALOGV("out_remove_audio_effect: %p", effect);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int out_get_next_write_timestamp(const struct audio_stream_out *stream,
|
||||
int64_t *timestamp)
|
||||
{
|
||||
*timestamp = 0;
|
||||
ALOGV("out_get_next_write_timestamp: %ld", (long int)(*timestamp));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/** audio_stream_in implementation **/
|
||||
static uint32_t in_get_sample_rate(const struct audio_stream *stream)
|
||||
{
|
||||
ALOGV("in_get_sample_rate");
|
||||
return 8000;
|
||||
}
|
||||
|
||||
static int in_set_sample_rate(struct audio_stream *stream, uint32_t rate)
|
||||
{
|
||||
ALOGV("in_set_sample_rate: %d", rate);
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
static size_t in_get_buffer_size(const struct audio_stream *stream)
|
||||
{
|
||||
ALOGV("in_get_buffer_size: %d", 320);
|
||||
return 320;
|
||||
}
|
||||
|
||||
static audio_channel_mask_t in_get_channels(const struct audio_stream *stream)
|
||||
{
|
||||
ALOGV("in_get_channels: %d", AUDIO_CHANNEL_IN_MONO);
|
||||
return AUDIO_CHANNEL_IN_MONO;
|
||||
}
|
||||
|
||||
static audio_format_t in_get_format(const struct audio_stream *stream)
|
||||
{
|
||||
return AUDIO_FORMAT_PCM_16_BIT;
|
||||
}
|
||||
|
||||
static int in_set_format(struct audio_stream *stream, audio_format_t format)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
static int in_standby(struct audio_stream *stream)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int in_dump(const struct audio_stream *stream, int fd)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int in_set_parameters(struct audio_stream *stream, const char *kvpairs)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char * in_get_parameters(const struct audio_stream *stream,
|
||||
const char *keys)
|
||||
{
|
||||
return strdup("");
|
||||
}
|
||||
|
||||
static int in_set_gain(struct audio_stream_in *stream, float gain)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ssize_t in_read(struct audio_stream_in *stream, void* buffer,
|
||||
size_t bytes)
|
||||
{
|
||||
ALOGV("in_read: bytes %zu", bytes);
|
||||
/* XXX: fake timing for audio input */
|
||||
usleep((int64_t)bytes * 1000000 / audio_stream_in_frame_size(stream) /
|
||||
in_get_sample_rate(&stream->common));
|
||||
memset(buffer, 0, bytes);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
static uint32_t in_get_input_frames_lost(struct audio_stream_in *stream)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int in_add_audio_effect(const struct audio_stream *stream, effect_handle_t effect)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int in_remove_audio_effect(const struct audio_stream *stream, effect_handle_t effect)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int adev_open_output_stream(struct audio_hw_device *dev,
|
||||
audio_io_handle_t handle,
|
||||
audio_devices_t devices,
|
||||
audio_output_flags_t flags,
|
||||
struct audio_config *config,
|
||||
struct audio_stream_out **stream_out,
|
||||
const char *address __unused)
|
||||
{
|
||||
ALOGV("adev_open_output_stream...");
|
||||
|
||||
struct alsa_audio_device *ladev = (struct alsa_audio_device *)dev;
|
||||
struct alsa_stream_out *out;
|
||||
int ret = 0;
|
||||
|
||||
out = (struct alsa_stream_out *)calloc(1, sizeof(struct alsa_stream_out));
|
||||
if (!out)
|
||||
return -ENOMEM;
|
||||
|
||||
out->stream.common.get_sample_rate = out_get_sample_rate;
|
||||
out->stream.common.set_sample_rate = out_set_sample_rate;
|
||||
out->stream.common.get_buffer_size = out_get_buffer_size;
|
||||
out->stream.common.get_channels = out_get_channels;
|
||||
out->stream.common.get_format = out_get_format;
|
||||
out->stream.common.set_format = out_set_format;
|
||||
out->stream.common.standby = out_standby;
|
||||
out->stream.common.dump = out_dump;
|
||||
out->stream.common.set_parameters = out_set_parameters;
|
||||
out->stream.common.get_parameters = out_get_parameters;
|
||||
out->stream.common.add_audio_effect = out_add_audio_effect;
|
||||
out->stream.common.remove_audio_effect = out_remove_audio_effect;
|
||||
out->stream.get_latency = out_get_latency;
|
||||
out->stream.set_volume = out_set_volume;
|
||||
out->stream.write = out_write;
|
||||
out->stream.get_render_position = out_get_render_position;
|
||||
out->stream.get_next_write_timestamp = out_get_next_write_timestamp;
|
||||
out->stream.get_presentation_position = out_get_presentation_position;
|
||||
|
||||
out->period_size = PERIOD_SIZE;
|
||||
out->periods = PLAYBACK_PERIOD_COUNT;
|
||||
out->buffer_size = out->period_size * out->periods;
|
||||
|
||||
out->dev = ladev;
|
||||
out->standby = 1;
|
||||
out->unavailable = false;
|
||||
|
||||
config->format = out_get_format(&out->stream.common);
|
||||
config->channel_mask = out_get_channels(&out->stream.common);
|
||||
config->sample_rate = out_get_sample_rate(&out->stream.common);
|
||||
|
||||
*stream_out = &out->stream;
|
||||
|
||||
/* TODO The retry mechanism isn't implemented in AudioPolicyManager/AudioFlinger. */
|
||||
ret = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void adev_close_output_stream(struct audio_hw_device *dev,
|
||||
struct audio_stream_out *stream)
|
||||
{
|
||||
ALOGV("adev_close_output_stream...");
|
||||
free(stream);
|
||||
}
|
||||
|
||||
static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs)
|
||||
{
|
||||
ALOGV("adev_set_parameters");
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
static char * adev_get_parameters(const struct audio_hw_device *dev,
|
||||
const char *keys)
|
||||
{
|
||||
ALOGV("adev_get_parameters");
|
||||
return strdup("");
|
||||
}
|
||||
|
||||
static int adev_init_check(const struct audio_hw_device *dev)
|
||||
{
|
||||
ALOGV("adev_init_check");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int adev_set_voice_volume(struct audio_hw_device *dev, float volume)
|
||||
{
|
||||
ALOGV("adev_set_voice_volume: %f", volume);
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
static int adev_set_master_volume(struct audio_hw_device *dev, float volume)
|
||||
{
|
||||
ALOGV("adev_set_master_volume: %f", volume);
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
static int adev_get_master_volume(struct audio_hw_device *dev, float *volume)
|
||||
{
|
||||
ALOGV("adev_get_master_volume: %f", *volume);
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
static int adev_set_master_mute(struct audio_hw_device *dev, bool muted)
|
||||
{
|
||||
ALOGV("adev_set_master_mute: %d", muted);
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
static int adev_get_master_mute(struct audio_hw_device *dev, bool *muted)
|
||||
{
|
||||
ALOGV("adev_get_master_mute: %d", *muted);
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
static int adev_set_mode(struct audio_hw_device *dev, audio_mode_t mode)
|
||||
{
|
||||
ALOGV("adev_set_mode: %d", mode);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int adev_set_mic_mute(struct audio_hw_device *dev, bool state)
|
||||
{
|
||||
ALOGV("adev_set_mic_mute: %d",state);
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
static int adev_get_mic_mute(const struct audio_hw_device *dev, bool *state)
|
||||
{
|
||||
ALOGV("adev_get_mic_mute");
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
static size_t adev_get_input_buffer_size(const struct audio_hw_device *dev,
|
||||
const struct audio_config *config)
|
||||
{
|
||||
ALOGV("adev_get_input_buffer_size: %d", 320);
|
||||
return 320;
|
||||
}
|
||||
|
||||
static int adev_open_input_stream(struct audio_hw_device __unused *dev,
|
||||
audio_io_handle_t handle,
|
||||
audio_devices_t devices,
|
||||
struct audio_config *config,
|
||||
struct audio_stream_in **stream_in,
|
||||
audio_input_flags_t flags __unused,
|
||||
const char *address __unused,
|
||||
audio_source_t source __unused)
|
||||
{
|
||||
struct stub_stream_in *in;
|
||||
|
||||
ALOGV("adev_open_input_stream...");
|
||||
|
||||
in = (struct stub_stream_in *)calloc(1, sizeof(struct stub_stream_in));
|
||||
if (!in)
|
||||
return -ENOMEM;
|
||||
|
||||
in->stream.common.get_sample_rate = in_get_sample_rate;
|
||||
in->stream.common.set_sample_rate = in_set_sample_rate;
|
||||
in->stream.common.get_buffer_size = in_get_buffer_size;
|
||||
in->stream.common.get_channels = in_get_channels;
|
||||
in->stream.common.get_format = in_get_format;
|
||||
in->stream.common.set_format = in_set_format;
|
||||
in->stream.common.standby = in_standby;
|
||||
in->stream.common.dump = in_dump;
|
||||
in->stream.common.set_parameters = in_set_parameters;
|
||||
in->stream.common.get_parameters = in_get_parameters;
|
||||
in->stream.common.add_audio_effect = in_add_audio_effect;
|
||||
in->stream.common.remove_audio_effect = in_remove_audio_effect;
|
||||
in->stream.set_gain = in_set_gain;
|
||||
in->stream.read = in_read;
|
||||
in->stream.get_input_frames_lost = in_get_input_frames_lost;
|
||||
|
||||
*stream_in = &in->stream;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void adev_close_input_stream(struct audio_hw_device *dev,
|
||||
struct audio_stream_in *in)
|
||||
{
|
||||
ALOGV("adev_close_input_stream...");
|
||||
return;
|
||||
}
|
||||
|
||||
static int adev_dump(const audio_hw_device_t *device, int fd)
|
||||
{
|
||||
ALOGV("adev_dump");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int adev_close(hw_device_t *device)
|
||||
{
|
||||
ALOGV("adev_close");
|
||||
free(device);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int adev_open(const hw_module_t* module, const char* name,
|
||||
hw_device_t** device)
|
||||
{
|
||||
struct alsa_audio_device *adev;
|
||||
|
||||
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;
|
||||
|
||||
adev = calloc(1, sizeof(struct alsa_audio_device));
|
||||
if (!adev)
|
||||
return -ENOMEM;
|
||||
|
||||
adev->hw_device.common.tag = HARDWARE_DEVICE_TAG;
|
||||
adev->hw_device.common.version = AUDIO_DEVICE_API_VERSION_2_0;
|
||||
adev->hw_device.common.module = (struct hw_module_t *) module;
|
||||
adev->hw_device.common.close = adev_close;
|
||||
adev->hw_device.init_check = adev_init_check;
|
||||
adev->hw_device.set_voice_volume = adev_set_voice_volume;
|
||||
adev->hw_device.set_master_volume = adev_set_master_volume;
|
||||
adev->hw_device.get_master_volume = adev_get_master_volume;
|
||||
adev->hw_device.set_master_mute = adev_set_master_mute;
|
||||
adev->hw_device.get_master_mute = adev_get_master_mute;
|
||||
adev->hw_device.set_mode = adev_set_mode;
|
||||
adev->hw_device.set_mic_mute = adev_set_mic_mute;
|
||||
adev->hw_device.get_mic_mute = adev_get_mic_mute;
|
||||
adev->hw_device.set_parameters = adev_set_parameters;
|
||||
adev->hw_device.get_parameters = adev_get_parameters;
|
||||
adev->hw_device.get_input_buffer_size = adev_get_input_buffer_size;
|
||||
adev->hw_device.open_output_stream = adev_open_output_stream;
|
||||
adev->hw_device.close_output_stream = adev_close_output_stream;
|
||||
adev->hw_device.open_input_stream = adev_open_input_stream;
|
||||
adev->hw_device.close_input_stream = adev_close_input_stream;
|
||||
adev->hw_device.dump = adev_dump;
|
||||
|
||||
adev->devices = AUDIO_DEVICE_NONE;
|
||||
|
||||
*device = &adev->hw_device.common;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct hw_module_methods_t hal_module_methods = {
|
||||
.open = adev_open,
|
||||
};
|
||||
|
||||
struct audio_module HAL_MODULE_INFO_SYM = {
|
||||
.common = {
|
||||
.tag = HARDWARE_MODULE_TAG,
|
||||
.module_api_version = AUDIO_MODULE_API_VERSION_0_1,
|
||||
.hal_api_version = HARDWARE_HAL_API_VERSION,
|
||||
.id = AUDIO_HARDWARE_MODULE_ID,
|
||||
.name = "Raspberry Pi audio hdmi HW HAL",
|
||||
.author = "The Android Open Source Project",
|
||||
.methods = &hal_module_methods,
|
||||
},
|
||||
};
|
@@ -1,68 +0,0 @@
|
||||
# Configuration for the VC4-HDMI sound card using software IEC958
|
||||
# subframe conversion
|
||||
|
||||
<confdir:pcm/hdmi.conf>
|
||||
vc4-hdmi.pcm.hdmi.0 {
|
||||
@args [ CARD AES0 AES1 AES2 AES3 ]
|
||||
@args.CARD {
|
||||
type string
|
||||
}
|
||||
@args.AES0 {
|
||||
type integer
|
||||
}
|
||||
@args.AES1 {
|
||||
type integer
|
||||
}
|
||||
@args.AES2 {
|
||||
type integer
|
||||
}
|
||||
@args.AES3 {
|
||||
type integer
|
||||
}
|
||||
type iec958
|
||||
slave {
|
||||
format IEC958_SUBFRAME_LE
|
||||
pcm {
|
||||
type hooks
|
||||
slave.pcm {
|
||||
type hw
|
||||
card $CARD
|
||||
device 0
|
||||
}
|
||||
hooks.0 {
|
||||
type ctl_elems
|
||||
hook_args [
|
||||
{
|
||||
name "IEC958 Playback Default"
|
||||
interface PCM
|
||||
optional true
|
||||
lock true
|
||||
preserve true
|
||||
value [ $AES0 $AES1 $AES2 $AES3 ]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
status [ $AES0 $AES1 $AES2 $AES3 ]
|
||||
}
|
||||
|
||||
# default with plug
|
||||
vc4-hdmi.pcm.default {
|
||||
@args [ CARD ]
|
||||
@args.CARD {
|
||||
type string
|
||||
}
|
||||
type plug
|
||||
slave.pcm {
|
||||
type softvol
|
||||
slave.pcm {
|
||||
@func concat
|
||||
strings [ "hdmi:" $CARD ]
|
||||
}
|
||||
control {
|
||||
name "PCM Playback Volume"
|
||||
card $CARD
|
||||
}
|
||||
}
|
||||
}
|
56
bluetooth/Android.bp
Normal file
56
bluetooth/Android.bp
Normal file
@@ -0,0 +1,56 @@
|
||||
// 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",
|
||||
vendor: true,
|
||||
srcs: [
|
||||
"BluetoothHci.cpp",
|
||||
"main.cpp",
|
||||
"net_bluetooth_mgmt.cpp",
|
||||
],
|
||||
static_libs: [
|
||||
"android.hardware.bluetooth.async",
|
||||
"android.hardware.bluetooth.hci",
|
||||
],
|
||||
shared_libs: [
|
||||
"android.hardware.bluetooth-V1-ndk",
|
||||
"libbase",
|
||||
"libbinder_ndk",
|
||||
"liblog",
|
||||
"libutils",
|
||||
],
|
||||
installable: false,
|
||||
}
|
||||
|
||||
prebuilt_etc {
|
||||
name: "android.hardware.bluetooth-service.rpi.rc",
|
||||
src: "android.hardware.bluetooth-service.rpi.rc",
|
||||
installable: false,
|
||||
}
|
||||
|
||||
prebuilt_etc {
|
||||
name: "android.hardware.bluetooth-service.rpi.xml",
|
||||
src: "android.hardware.bluetooth-service.rpi.xml",
|
||||
sub_dir: "vintf",
|
||||
installable: false,
|
||||
}
|
||||
|
||||
apex {
|
||||
name: "com.android.hardware.bluetooth.rpi4",
|
||||
manifest: "apex_manifest.json",
|
||||
file_contexts: "apex_file_contexts",
|
||||
key: "com.android.hardware.key",
|
||||
certificate: ":com.android.hardware.certificate",
|
||||
updatable: false,
|
||||
vendor: true,
|
||||
|
||||
binaries: ["android.hardware.bluetooth-service.rpi"],
|
||||
prebuilts: [
|
||||
"android.hardware.bluetooth-service.rpi.rc",
|
||||
"android.hardware.bluetooth-service.rpi.xml",
|
||||
],
|
||||
}
|
227
bluetooth/BluetoothHci.cpp
Normal file
227
bluetooth/BluetoothHci.cpp
Normal file
@@ -0,0 +1,227 @@
|
||||
/*
|
||||
* 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
|
75
bluetooth/BluetoothHci.h
Normal file
75
bluetooth/BluetoothHci.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* 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
|
6
bluetooth/android.hardware.bluetooth-service.rpi.rc
Normal file
6
bluetooth/android.hardware.bluetooth-service.rpi.rc
Normal file
@@ -0,0 +1,6 @@
|
||||
service vendor.bluetooth-rpi /apex/com.android.hardware.bluetooth.rpi4/bin/hw/android.hardware.bluetooth-service.rpi
|
||||
class hal
|
||||
capabilities BLOCK_SUSPEND NET_ADMIN SYS_NICE
|
||||
user bluetooth
|
||||
group bluetooth
|
||||
task_profiles HighPerformance
|
6
bluetooth/android.hardware.bluetooth-service.rpi.xml
Normal file
6
bluetooth/android.hardware.bluetooth-service.rpi.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<manifest version="1.0" type="device">
|
||||
<hal format="aidl">
|
||||
<name>android.hardware.bluetooth</name>
|
||||
<fqname>IBluetoothHci/default</fqname>
|
||||
</hal>
|
||||
</manifest>
|
3
bluetooth/apex_file_contexts
Normal file
3
bluetooth/apex_file_contexts
Normal file
@@ -0,0 +1,3 @@
|
||||
(/.*)? u:object_r:vendor_file:s0
|
||||
/etc(/.*)? u:object_r:vendor_configs_file:s0
|
||||
/bin/hw/android\.hardware\.bluetooth-service\.rpi u:object_r:hal_bluetooth_default_exec:s0
|
4
bluetooth/apex_manifest.json
Normal file
4
bluetooth/apex_manifest.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "com.android.hardware.bluetooth.rpi4",
|
||||
"version": 1
|
||||
}
|
@@ -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
|
36
bluetooth/main.cpp
Normal file
36
bluetooth/main.cpp
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "BluetoothHci.h"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <android/binder_manager.h>
|
||||
#include <android/binder_process.h>
|
||||
|
||||
using ::aidl::android::hardware::bluetooth::impl::BluetoothHci;
|
||||
|
||||
int main() {
|
||||
ABinderProcess_setThreadPoolMaxThreadCount(0);
|
||||
std::shared_ptr<BluetoothHci> bluetooth = ndk::SharedRefBase::make<BluetoothHci>();
|
||||
|
||||
const std::string instance = std::string() + BluetoothHci::descriptor + "/default";
|
||||
binder_status_t status = AServiceManager_addService(bluetooth->asBinder().get(), instance.c_str());
|
||||
CHECK(status == STATUS_OK);
|
||||
|
||||
ABinderProcess_joinThreadPool();
|
||||
return EXIT_FAILURE; // should not reach
|
||||
}
|
278
bluetooth/net_bluetooth_mgmt.cpp
Normal file
278
bluetooth/net_bluetooth_mgmt.cpp
Normal file
@@ -0,0 +1,278 @@
|
||||
/*
|
||||
* 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
|
44
bluetooth/net_bluetooth_mgmt.h
Normal file
44
bluetooth/net_bluetooth_mgmt.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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,14 +0,0 @@
|
||||
BLUETOOTH_UART_DEVICE_PORT = "/dev/ttyAMA0"
|
||||
FW_PATCHFILE_LOCATION = "/vendor/firmware/brcm/"
|
||||
FW_PATCH_SETTLEMENT_DELAY_MS = 200
|
||||
BT_WAKE_VIA_PROC = FALSE
|
||||
BT_WAKE_VIA_USERIAL_IOCTL = FALSE
|
||||
LPM_IDLE_TIMEOUT_MULTIPLE = 5
|
||||
SCO_CFG_INCLUDED = FALSE
|
||||
SCO_PCM_IF_CLOCK_RATE = 2
|
||||
BTVND_DBG = FALSE
|
||||
BTHW_DBG = FALSE
|
||||
VNDUSERIAL_DBG = FALSE
|
||||
UPIO_DBG = FALSE
|
||||
UART_TARGET_BAUD_RATE = 3000000
|
||||
USE_CONTROLLER_BDADDR = FALSE
|
@@ -12,16 +12,19 @@ dtparam=audio=on
|
||||
camera_auto_detect=1
|
||||
start_x=1
|
||||
|
||||
# CPU
|
||||
arm_boost=1
|
||||
|
||||
# Display
|
||||
disable_overscan=1
|
||||
|
||||
# Display panel
|
||||
#dtoverlay=vc4-kms-dsi-7inch
|
||||
#dtoverlay=rpi-backlight
|
||||
#dtoverlay=vc4-kms-dsi-ili9881-7inch
|
||||
|
||||
# Graphics acceleration
|
||||
disable_fw_kms_setup=1
|
||||
dtoverlay=vc4-kms-v3d
|
||||
dtoverlay=cma,cma-384
|
||||
|
||||
# I2C
|
||||
#dtparam=i2c_arm=on
|
||||
@@ -40,6 +43,3 @@ dtoverlay=dwc2,dr_mode=peripheral
|
||||
[cm4]
|
||||
dtoverlay=dwc2,dr_mode=otg
|
||||
[all]
|
||||
|
||||
# V4L2
|
||||
#dtoverlay=rpivid-v4l2
|
||||
|
@@ -2,9 +2,24 @@ cameras:
|
||||
"/base/soc/i2c0mux/i2c@1/imx219@10":
|
||||
location: back
|
||||
rotation: 0
|
||||
"/base/soc/i2c0mux/i2c@1/imx296@1a":
|
||||
location: back
|
||||
rotation: 0
|
||||
"/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
|
||||
|
@@ -32,6 +32,7 @@
|
||||
<id>21</id>
|
||||
<id>22</id>
|
||||
<id>23</id>
|
||||
<id>31</id>
|
||||
</ignore>
|
||||
</Provider>
|
||||
<!-- See ExternalCameraUtils.cpp for default values of Device configurations below -->
|
||||
|
52
car/car_audio_configuration.xml
Normal file
52
car/car_audio_configuration.xml
Normal file
@@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2021 The Android Open Source Project
|
||||
|
||||
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.
|
||||
-->
|
||||
|
||||
<!--
|
||||
Defines the audio configuration in a car, including
|
||||
- Audio zones
|
||||
- Zone configurations (in each audio zone)
|
||||
- Volume groups (in each zone configuration)
|
||||
- Context to audio bus mappings (in each volume group)
|
||||
in the car environment.
|
||||
-->
|
||||
<carAudioConfiguration version="3">
|
||||
<zones>
|
||||
<zone name="Primary zone" isPrimary="true" occupantZoneId="0">
|
||||
<zoneConfigs>
|
||||
<zoneConfig name="Config 0" isDefault="true">
|
||||
<volumeGroups>
|
||||
<group>
|
||||
<device address="Speaker">
|
||||
<context context="music"/>
|
||||
<context context="navigation"/>
|
||||
<context context="voice_command"/>
|
||||
<context context="call_ring"/>
|
||||
<context context="call"/>
|
||||
<context context="alarm"/>
|
||||
<context context="notification"/>
|
||||
<context context="system_sound"/>
|
||||
<context context="emergency"/>
|
||||
<context context="safety"/>
|
||||
<context context="vehicle_status"/>
|
||||
<context context="announcement"/>
|
||||
</device>
|
||||
</group>
|
||||
</volumeGroups>
|
||||
</zoneConfig>
|
||||
</zoneConfigs>
|
||||
</zone>
|
||||
</zones>
|
||||
</carAudioConfiguration>
|
8
car/display_settings.xml
Normal file
8
car/display_settings.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
|
||||
<display-settings>
|
||||
<!-- Use physical port number instead of local id -->
|
||||
<config identifier="1" />
|
||||
|
||||
<!-- Display settings for cluster -->
|
||||
<display name="port:1" dontMoveToTop="true" />
|
||||
</display-settings>
|
85
car/evs_config_override.json
Normal file
85
car/evs_config_override.json
Normal file
@@ -0,0 +1,85 @@
|
||||
|
||||
{
|
||||
"car" : {
|
||||
"width" : 76.7,
|
||||
"wheelBase" : 117.9,
|
||||
"frontExtent" : 44.7,
|
||||
"rearExtent" : 40
|
||||
},
|
||||
"displays" : [
|
||||
{
|
||||
"_comment": "Display0",
|
||||
"displayPort" : 0,
|
||||
"frontRange" : 100,
|
||||
"rearRange" : 100
|
||||
},
|
||||
{
|
||||
"_comment": "Display1",
|
||||
"displayPort" : 1,
|
||||
"frontRange" : 100,
|
||||
"rearRange" : 100
|
||||
}
|
||||
],
|
||||
"graphic" : {
|
||||
"frontPixel" : -20,
|
||||
"rearPixel" : 260
|
||||
},
|
||||
"cameras" : [
|
||||
{
|
||||
"cameraId" : "/dev/video0",
|
||||
"function" : "reverse",
|
||||
"x" : 0.0,
|
||||
"y" : 20.0,
|
||||
"z" : 48,
|
||||
"yaw" : 180,
|
||||
"pitch" : -10,
|
||||
"roll" : 0,
|
||||
"hfov" : 115,
|
||||
"vfov" : 80,
|
||||
"hflip" : true,
|
||||
"vflip" : false
|
||||
},
|
||||
{
|
||||
"cameraId" : "1",
|
||||
"function" : "front",
|
||||
"x" : 0.0,
|
||||
"y" : 100.0,
|
||||
"z" : 48,
|
||||
"yaw" : 0,
|
||||
"pitch" : -10,
|
||||
"roll" : 0,
|
||||
"hfov" : 115,
|
||||
"vfov" : 80,
|
||||
"hflip" : false,
|
||||
"vflip" : false
|
||||
},
|
||||
{
|
||||
"cameraId" : "2",
|
||||
"function" : "right",
|
||||
"x" : -25.0,
|
||||
"y" : 60.0,
|
||||
"z" : 88,
|
||||
"yaw" : -90,
|
||||
"pitch" : -10,
|
||||
"roll" : 0,
|
||||
"hfov" : 60,
|
||||
"vfov" : 62,
|
||||
"hflip" : false,
|
||||
"vflip" : false
|
||||
},
|
||||
{
|
||||
"cameraId" : "3",
|
||||
"function" : "left",
|
||||
"x" : 20.0,
|
||||
"y" : 60.0,
|
||||
"z" : 88,
|
||||
"yaw" : 90,
|
||||
"pitch" : -10,
|
||||
"roll" : 0,
|
||||
"hfov" : 60,
|
||||
"vfov" : 62,
|
||||
"hflip" : false,
|
||||
"vflip" : false
|
||||
}
|
||||
]
|
||||
}
|
@@ -1,58 +0,0 @@
|
||||
<compatibility-matrix version="1.0" type="device">
|
||||
<hal format="hidl" optional="false">
|
||||
<name>android.frameworks.displayservice</name>
|
||||
<version>1.0</version>
|
||||
<interface>
|
||||
<name>IDisplayService</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl" optional="false">
|
||||
<name>android.frameworks.sensorservice</name>
|
||||
<version>1.0</version>
|
||||
<interface>
|
||||
<name>ISensorManager</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl" optional="false">
|
||||
<name>android.hidl.manager</name>
|
||||
<version>1.2</version>
|
||||
<interface>
|
||||
<name>IServiceManager</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl" optional="true">
|
||||
<name>android.hidl.memory</name>
|
||||
<version>1.0</version>
|
||||
<interface>
|
||||
<name>IMapper</name>
|
||||
<instance>ashmem</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl" optional="false">
|
||||
<name>android.hidl.token</name>
|
||||
<version>1.0</version>
|
||||
<interface>
|
||||
<name>ITokenManager</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl" optional="false">
|
||||
<name>android.system.net.netd</name>
|
||||
<version>1.1</version>
|
||||
<interface>
|
||||
<name>INetd</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl" optional="false">
|
||||
<name>android.system.wifi.keystore</name>
|
||||
<version>1.0</version>
|
||||
<interface>
|
||||
<name>IKeystore</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
</compatibility-matrix>
|
204
device.mk
204
device.mk
@@ -1,40 +1,31 @@
|
||||
#
|
||||
# Copyright (C) 2021-2022 KonstaKANG
|
||||
# Copyright (C) 2021-2023 KonstaKANG
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
DEVICE_PATH := device/brcm/rpi4
|
||||
PRODUCT_SOONG_NAMESPACES += $(DEVICE_PATH)
|
||||
|
||||
$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
|
||||
$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base.mk)
|
||||
$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit_only.mk)
|
||||
$(call inherit-product, frameworks/native/build/tablet-7in-xhdpi-2048-dalvik-heap.mk)
|
||||
$(call inherit-product, vendor/brcm/rpi4/rpi4-vendor.mk)
|
||||
|
||||
PRODUCT_AAPT_CONFIG := normal mdpi hdpi
|
||||
PRODUCT_AAPT_PREF_CONFIG := hdpi
|
||||
PRODUCT_CHARACTERISTICS := tablet,nosdcard
|
||||
# APEX
|
||||
$(call inherit-product, $(SRC_TARGET_DIR)/product/updatable_apex.mk)
|
||||
|
||||
# API level
|
||||
PRODUCT_SHIPPING_API_LEVEL := 32
|
||||
PRODUCT_SHIPPING_API_LEVEL := 36
|
||||
|
||||
# Audio
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.audio.service \
|
||||
android.hardware.audio@7.0-impl \
|
||||
android.hardware.audio@7.1-impl \
|
||||
android.hardware.audio.effect@7.0-impl \
|
||||
audio.primary.rpi \
|
||||
audio.primary.rpi_hdmi \
|
||||
audio.r_submix.default \
|
||||
audio.usb.default
|
||||
|
||||
PRODUCT_PACKAGES += \
|
||||
tinycap \
|
||||
tinyhostless \
|
||||
tinymix \
|
||||
tinypcminfo \
|
||||
tinyplay
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
$(DEVICE_PATH)/audio/audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_policy_configuration.xml \
|
||||
frameworks/av/media/libeffects/data/audio_effects.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_effects.xml \
|
||||
@@ -43,49 +34,16 @@ PRODUCT_COPY_FILES += \
|
||||
frameworks/av/services/audiopolicy/config/r_submix_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/r_submix_audio_policy_configuration.xml \
|
||||
frameworks/av/services/audiopolicy/config/usb_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/usb_audio_policy_configuration.xml
|
||||
|
||||
PRODUCT_PACKAGES += \
|
||||
alsa_amixer \
|
||||
alsa_aplay \
|
||||
alsa_arecord \
|
||||
alsa_loop
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
$(DEVICE_PATH)/audio/vc4-hdmi.conf:$(TARGET_COPY_OUT_VENDOR)/etc/alsa/cards/vc4-hdmi.conf \
|
||||
external/alsa-lib/src/conf/alsa.conf:$(TARGET_COPY_OUT_VENDOR)/etc/alsa/alsa.conf \
|
||||
external/alsa-lib/src/conf/cards/aliases.conf:$(TARGET_COPY_OUT_VENDOR)/etc/alsa/cards/aliases.conf \
|
||||
external/alsa-lib/src/conf/ctl/default.conf:$(TARGET_COPY_OUT_VENDOR)/etc/alsa/ctl/default.conf \
|
||||
external/alsa-lib/src/conf/pcm/center_lfe.conf:$(TARGET_COPY_OUT_VENDOR)/etc/alsa/pcm/center_lfe.conf \
|
||||
external/alsa-lib/src/conf/pcm/default.conf:$(TARGET_COPY_OUT_VENDOR)/etc/alsa/pcm/default.conf \
|
||||
external/alsa-lib/src/conf/pcm/dmix.conf:$(TARGET_COPY_OUT_VENDOR)/etc/alsa/pcm/dmix.conf \
|
||||
external/alsa-lib/src/conf/pcm/dpl.conf:$(TARGET_COPY_OUT_VENDOR)/etc/alsa/pcm/dpl.conf \
|
||||
external/alsa-lib/src/conf/pcm/dsnoop.conf:$(TARGET_COPY_OUT_VENDOR)/etc/alsa/pcm/dsnoop.conf \
|
||||
external/alsa-lib/src/conf/pcm/front.conf:$(TARGET_COPY_OUT_VENDOR)/etc/alsa/pcm/front.conf \
|
||||
external/alsa-lib/src/conf/pcm/hdmi.conf:$(TARGET_COPY_OUT_VENDOR)/etc/alsa/pcm/hdmi.conf \
|
||||
external/alsa-lib/src/conf/pcm/iec958.conf:$(TARGET_COPY_OUT_VENDOR)/etc/alsa/pcm/iec958.conf \
|
||||
external/alsa-lib/src/conf/pcm/modem.conf:$(TARGET_COPY_OUT_VENDOR)/etc/alsa/pcm/modem.conf \
|
||||
external/alsa-lib/src/conf/pcm/rear.conf:$(TARGET_COPY_OUT_VENDOR)/etc/alsa/pcm/rear.conf \
|
||||
external/alsa-lib/src/conf/pcm/side.conf:$(TARGET_COPY_OUT_VENDOR)/etc/alsa/pcm/side.conf \
|
||||
external/alsa-lib/src/conf/pcm/surround21.conf:$(TARGET_COPY_OUT_VENDOR)/etc/alsa/pcm/surround21.conf \
|
||||
external/alsa-lib/src/conf/pcm/surround40.conf:$(TARGET_COPY_OUT_VENDOR)/etc/alsa/pcm/surround40.conf \
|
||||
external/alsa-lib/src/conf/pcm/surround41.conf:$(TARGET_COPY_OUT_VENDOR)/etc/alsa/pcm/surround41.conf \
|
||||
external/alsa-lib/src/conf/pcm/surround50.conf:$(TARGET_COPY_OUT_VENDOR)/etc/alsa/pcm/surround50.conf \
|
||||
external/alsa-lib/src/conf/pcm/surround51.conf:$(TARGET_COPY_OUT_VENDOR)/etc/alsa/pcm/surround51.conf \
|
||||
external/alsa-lib/src/conf/pcm/surround71.conf:$(TARGET_COPY_OUT_VENDOR)/etc/alsa/pcm/surround71.conf \
|
||||
external/alsa-lib/src/conf/smixer.conf:$(TARGET_COPY_OUT_VENDOR)/etc/alsa/smixer.conf
|
||||
|
||||
# Bluetooth
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.bluetooth@1.0-impl \
|
||||
android.hardware.bluetooth@1.0-service \
|
||||
libbt-vendor
|
||||
com.android.hardware.bluetooth.rpi4
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
frameworks/native/data/etc/android.hardware.bluetooth.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth.xml \
|
||||
frameworks/native/data/etc/android.hardware.bluetooth_le.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth_le.xml
|
||||
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.bluetooth.audio@2.0-impl \
|
||||
audio.a2dp.default \
|
||||
android.hardware.bluetooth.audio-impl \
|
||||
audio.bluetooth.default
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
@@ -94,7 +52,7 @@ PRODUCT_COPY_FILES += \
|
||||
|
||||
# Camera
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.camera.provider@2.5-external-service
|
||||
android.hardware.camera.provider-V1-external-service
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
$(DEVICE_PATH)/camera/external_camera_config.xml:$(TARGET_COPY_OUT_VENDOR)/etc/external_camera_config.xml
|
||||
@@ -103,109 +61,122 @@ PRODUCT_COPY_FILES += \
|
||||
frameworks/native/data/etc/android.hardware.camera.external.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.external.xml
|
||||
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.camera.provider@2.5-service_64 \
|
||||
android.hardware.camera.provider-V1-libcamera-service \
|
||||
camera.libcamera \
|
||||
ipa_rpi
|
||||
ipa_rpi_vc4
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
$(DEVICE_PATH)/camera/camera_hal.yaml:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/camera_hal.yaml \
|
||||
external/libcamera/src/ipa/raspberrypi/data/imx219.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/raspberrypi/imx219.json \
|
||||
external/libcamera/src/ipa/raspberrypi/data/imx219_noir.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/raspberrypi/imx219_noir.json \
|
||||
external/libcamera/src/ipa/raspberrypi/data/imx477.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/raspberrypi/imx477.json \
|
||||
external/libcamera/src/ipa/raspberrypi/data/imx477_noir.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/raspberrypi/imx477_noir.json \
|
||||
external/libcamera/src/ipa/raspberrypi/data/ov5647.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/raspberrypi/ov5647.json \
|
||||
external/libcamera/src/ipa/raspberrypi/data/ov5647_noir.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/raspberrypi/ov5647_noir.json
|
||||
$(DEVICE_PATH)/camera/camera_hal.yaml:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/camera_hal.yaml
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
frameworks/native/data/etc/android.hardware.camera.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.xml
|
||||
frameworks/native/data/etc/android.hardware.camera.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.xml \
|
||||
frameworks/native/data/etc/android.hardware.camera.concurrent.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.concurrent.xml \
|
||||
frameworks/native/data/etc/android.hardware.camera.flash-autofocus.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.flash-autofocus.xml \
|
||||
frameworks/native/data/etc/android.hardware.camera.front.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.front.xml \
|
||||
frameworks/native/data/etc/android.hardware.camera.full.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.full.xml \
|
||||
frameworks/native/data/etc/android.hardware.camera.raw.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.raw.xml
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
$(DEVICE_PATH)/camera/media_profiles_V1_0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_profiles_V1_0.xml
|
||||
|
||||
# CEC
|
||||
PRODUCT_PACKAGES += \
|
||||
com.android.hardware.tv.hdmi.cec.rpi4 \
|
||||
com.android.hardware.tv.hdmi.connection.rpi4
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
frameworks/native/data/etc/android.hardware.hdmi.cec.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.hdmi.cec.xml
|
||||
|
||||
# Debugfs
|
||||
PRODUCT_SET_DEBUGFS_RESTRICTIONS := false
|
||||
|
||||
# DRM
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.drm@1.0-impl \
|
||||
android.hardware.drm@1.0-service \
|
||||
android.hardware.drm@1.4-service.clearkey
|
||||
com.android.hardware.drm.clearkey
|
||||
|
||||
# Emergency info
|
||||
PRODUCT_PACKAGES += \
|
||||
EmergencyInfo
|
||||
|
||||
# Ethernet
|
||||
PRODUCT_COPY_FILES += \
|
||||
frameworks/native/data/etc/android.hardware.ethernet.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.ethernet.xml
|
||||
|
||||
# FFmpeg
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.media.c2@1.2-service-ffmpeg
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
$(DEVICE_PATH)/media/media_codecs_ffmpeg_c2.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_ffmpeg_c2.xml \
|
||||
$(DEVICE_PATH)/seccomp_policy/android.hardware.media.c2-ffmpeg.policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/android.hardware.media.c2-ffmpeg.policy
|
||||
|
||||
# Gatekeeper
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.gatekeeper@1.0-service.software
|
||||
com.android.hardware.gatekeeper.nonsecure
|
||||
|
||||
# Graphics
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.graphics.allocator@4.0-service.minigbm_gbm_mesa \
|
||||
android.hardware.graphics.mapper@4.0-impl.minigbm_gbm_mesa
|
||||
android.hardware.graphics.allocator-service.minigbm_gbm_mesa \
|
||||
mapper.minigbm_gbm_mesa
|
||||
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.graphics.composer@2.4-service \
|
||||
hwcomposer.drm
|
||||
com.android.hardware.graphics.composer.drm_hwcomposer
|
||||
|
||||
PRODUCT_PACKAGES += \
|
||||
libEGL_mesa \
|
||||
libGLESv1_CM_mesa \
|
||||
libGLESv2_mesa \
|
||||
libgallium_dri \
|
||||
libglapi
|
||||
libgallium_dri
|
||||
|
||||
PRODUCT_PACKAGES += \
|
||||
dri_gbm \
|
||||
libgbm_mesa
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
frameworks/native/data/etc/android.software.opengles.deqp.level-2021-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.opengles.deqp.level.xml
|
||||
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
|
||||
|
||||
PRODUCT_PACKAGES += \
|
||||
vulkan.broadcom
|
||||
|
||||
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_0_3.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.version.xml \
|
||||
frameworks/native/data/etc/android.software.vulkan.deqp.level-2021-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.vulkan.deqp.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
|
||||
|
||||
# Health
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.health@2.0-service.rpi
|
||||
com.android.hardware.health.rpi4
|
||||
|
||||
# HIDL
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hidl.allocator@1.0-service \
|
||||
hwservicemanager
|
||||
|
||||
# Kernel
|
||||
PRODUCT_COPY_FILES += \
|
||||
$(DEVICE_PATH)-kernel/Image:$(PRODUCT_OUT)/kernel
|
||||
|
||||
# Keymaster
|
||||
# Keymint
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.keymaster@3.0-impl \
|
||||
android.hardware.keymaster@3.0-service
|
||||
com.android.hardware.keymint.rust_nonsecure
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
frameworks/native/data/etc/android.hardware.keystore.app_attest_key.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.keystore.app_attest_key.xml
|
||||
|
||||
# Lights
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.light@2.0-service.rpi
|
||||
com.android.hardware.light.rpi4
|
||||
|
||||
# Media
|
||||
PRODUCT_COPY_FILES += \
|
||||
$(DEVICE_PATH)/media/media_codecs.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs.xml \
|
||||
$(DEVICE_PATH)/media/media_codecs_v4l2_c2_video.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_v4l2_c2_video.xml \
|
||||
frameworks/av/media/libstagefright/data/media_codecs_google_c2_audio.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_c2_audio.xml \
|
||||
frameworks/av/media/libstagefright/data/media_codecs_google_c2_tv.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_c2_tv.xml \
|
||||
frameworks/av/media/libstagefright/data/media_codecs_google_c2_video.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_c2_video.xml
|
||||
|
||||
# Overlays
|
||||
PRODUCT_PACKAGES += \
|
||||
AndroidRpiOverlay \
|
||||
SettingsRpiOverlay \
|
||||
SettingsProviderRpiOverlay \
|
||||
SystemUIRpiOverlay \
|
||||
WifiRpiOverlay
|
||||
|
||||
# Permissions
|
||||
PRODUCT_COPY_FILES += \
|
||||
frameworks/native/data/etc/tablet_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/tablet_core_hardware.xml
|
||||
|
||||
# Power
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.power-service.example
|
||||
com.android.hardware.power
|
||||
|
||||
# Ramdisk
|
||||
PRODUCT_COPY_FILES += \
|
||||
@@ -217,24 +188,31 @@ PRODUCT_COPY_FILES += \
|
||||
|
||||
# Seccomp
|
||||
PRODUCT_COPY_FILES += \
|
||||
$(DEVICE_PATH)/seccomp_policy/codec2.vendor.ext.policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/codec2.vendor.ext.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
|
||||
|
||||
# Settings
|
||||
PRODUCT_PACKAGES += \
|
||||
androidx.window.extensions
|
||||
# Soong
|
||||
PRODUCT_SOONG_NAMESPACES += $(DEVICE_PATH)
|
||||
|
||||
# Storage
|
||||
$(call inherit-product, $(SRC_TARGET_DIR)/product/emulated_storage.mk)
|
||||
|
||||
# Suspend
|
||||
PRODUCT_PACKAGES += \
|
||||
suspend_blocker_rpi
|
||||
com.android.hardware.suspend_blocker.rpi4
|
||||
|
||||
# Thermal
|
||||
PRODUCT_PACKAGES += \
|
||||
com.android.hardware.thermal
|
||||
|
||||
# Touchscreen
|
||||
PRODUCT_COPY_FILES += \
|
||||
frameworks/native/data/etc/android.hardware.touchscreen.multitouch.jazzhand.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.touchscreen.multitouch.jazzhand.xml
|
||||
|
||||
# USB
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.usb@1.0-service
|
||||
com.android.hardware.usb \
|
||||
com.android.hardware.usb.gadget.rpi4
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
frameworks/native/data/etc/android.hardware.usb.accessory.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.usb.accessory.xml \
|
||||
@@ -245,22 +223,26 @@ PRODUCT_COPY_FILES += \
|
||||
PRODUCT_SOONG_NAMESPACES += external/v4l2_codec2
|
||||
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.media.c2@1.0-service-v4l2 \
|
||||
android.hardware.media.c2@1.2-service-v4l2 \
|
||||
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)/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)
|
||||
|
||||
# Wifi
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.wifi@1.0-service \
|
||||
hostapd \
|
||||
hostapd_cli \
|
||||
com.android.hardware.wifi \
|
||||
com.android.hardware.wifi.hostapd.rpi4 \
|
||||
com.android.hardware.wifi.supplicant.rpi4 \
|
||||
libwpa_client \
|
||||
wificond \
|
||||
wpa_cli \
|
||||
wpa_supplicant \
|
||||
wpa_supplicant.conf
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
hardware/broadcom/wlan/bcmdhd/config/wpa_supplicant_overlay.conf:$(TARGET_COPY_OUT_VENDOR)/etc/wifi/wpa_supplicant_overlay.conf
|
||||
wificond
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
frameworks/native/data/etc/android.hardware.wifi.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.xml
|
||||
|
||||
# Window extensions
|
||||
$(call inherit-product, $(SRC_TARGET_DIR)/product/window_extensions.mk)
|
||||
|
12
framework_compatibility_matrix.xml
Normal file
12
framework_compatibility_matrix.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<compatibility-matrix version="1.0" type="framework">
|
||||
<hal format="hidl" optional="true">
|
||||
<name>android.hardware.media.c2</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>1.2</version>
|
||||
<interface>
|
||||
<name>IComponentStore</name>
|
||||
<instance>ffmpeg</instance>
|
||||
<instance>v4l2</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
</compatibility-matrix>
|
53
hdmi/cec/Android.bp
Normal file
53
hdmi/cec/Android.bp
Normal file
@@ -0,0 +1,53 @@
|
||||
// Copyright (C) 2021 The Android Open Source Project
|
||||
// Copyright (C) 2025 KonstaKANG
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
cc_binary {
|
||||
name: "android.hardware.tv.hdmi.cec-service.rpi",
|
||||
relative_install_path: "hw",
|
||||
vendor: true,
|
||||
srcs: [
|
||||
"HdmiCec.cpp",
|
||||
"HdmiCecPort.cpp",
|
||||
"main.cpp",
|
||||
],
|
||||
shared_libs: [
|
||||
"android.hardware.tv.hdmi.cec-V1-ndk",
|
||||
"libbase",
|
||||
"libbinder_ndk",
|
||||
"libcutils",
|
||||
"libhardware",
|
||||
"liblog",
|
||||
],
|
||||
installable: false,
|
||||
}
|
||||
|
||||
prebuilt_etc {
|
||||
name: "android.hardware.tv.hdmi.cec-service.rpi.rc",
|
||||
src: "android.hardware.tv.hdmi.cec-service.rpi.rc",
|
||||
installable: false,
|
||||
}
|
||||
|
||||
prebuilt_etc {
|
||||
name: "android.hardware.tv.hdmi.cec-service.rpi.xml",
|
||||
src: "android.hardware.tv.hdmi.cec-service.rpi.xml",
|
||||
sub_dir: "vintf",
|
||||
installable: false,
|
||||
}
|
||||
|
||||
apex {
|
||||
name: "com.android.hardware.tv.hdmi.cec.rpi4",
|
||||
manifest: "apex_manifest.json",
|
||||
file_contexts: "apex_file_contexts",
|
||||
key: "com.android.hardware.key",
|
||||
certificate: ":com.android.hardware.certificate",
|
||||
updatable: false,
|
||||
vendor: true,
|
||||
|
||||
binaries: ["android.hardware.tv.hdmi.cec-service.rpi"],
|
||||
prebuilts: [
|
||||
"android.hardware.tv.hdmi.cec-service.rpi.rc",
|
||||
"android.hardware.tv.hdmi.cec-service.rpi.xml",
|
||||
],
|
||||
}
|
457
hdmi/cec/HdmiCec.cpp
Normal file
457
hdmi/cec/HdmiCec.cpp
Normal file
@@ -0,0 +1,457 @@
|
||||
/*
|
||||
* Copyright (C) 2021 The Android Open Source Project
|
||||
* Copyright (C) 2025 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.tv.hdmi.cec-service.rpi"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <android-base/properties.h>
|
||||
|
||||
#include <cutils/properties.h>
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <linux/ioctl.h>
|
||||
#include <poll.h>
|
||||
|
||||
#include "HdmiCec.h"
|
||||
|
||||
#define PROPERTY_CEC_DEVICE "persist.vendor.hdmi.cec_device"
|
||||
|
||||
using android::base::GetProperty;
|
||||
using ndk::ScopedAStatus;
|
||||
using std::string;
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace tv {
|
||||
namespace hdmi {
|
||||
namespace cec {
|
||||
namespace implementation {
|
||||
|
||||
HdmiCec::HdmiCec() {
|
||||
mCecEnabled = false;
|
||||
mWakeupEnabled = false;
|
||||
mCecControlEnabled = false;
|
||||
mCallback = nullptr;
|
||||
|
||||
Result result = init();
|
||||
if (result != Result::SUCCESS) {
|
||||
LOG(ERROR) << "Failed to init HDMI-CEC HAL";
|
||||
}
|
||||
}
|
||||
|
||||
HdmiCec::~HdmiCec() {
|
||||
release();
|
||||
}
|
||||
|
||||
ScopedAStatus HdmiCec::addLogicalAddress(CecLogicalAddress addr, Result* _aidl_return) {
|
||||
if (addr < CecLogicalAddress::TV || addr >= CecLogicalAddress::BROADCAST) {
|
||||
LOG(ERROR) << "Add logical address failed, Invalid address";
|
||||
*_aidl_return = Result::FAILURE_INVALID_ARGS;
|
||||
return ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
cec_log_addrs cecLogAddrs;
|
||||
int ret = ioctl(mHdmiCecPorts[0]->mCecFd, CEC_ADAP_G_LOG_ADDRS, &cecLogAddrs);
|
||||
if (ret) {
|
||||
LOG(ERROR) << "Add logical address failed, Error = " << strerror(errno);
|
||||
*_aidl_return = Result::FAILURE_BUSY;
|
||||
return ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
cecLogAddrs.cec_version = CEC_OP_CEC_VERSION_1_4;
|
||||
cecLogAddrs.vendor_id = 0x000c03; // HDMI LLC vendor ID
|
||||
|
||||
unsigned int logAddrType = CEC_LOG_ADDR_TYPE_UNREGISTERED;
|
||||
unsigned int allDevTypes = 0;
|
||||
unsigned int primDevType = 0xff;
|
||||
switch (addr) {
|
||||
case CecLogicalAddress::TV:
|
||||
primDevType = CEC_OP_PRIM_DEVTYPE_TV;
|
||||
logAddrType = CEC_LOG_ADDR_TYPE_TV;
|
||||
allDevTypes = CEC_OP_ALL_DEVTYPE_TV;
|
||||
break;
|
||||
case CecLogicalAddress::RECORDER_1:
|
||||
case CecLogicalAddress::RECORDER_2:
|
||||
case CecLogicalAddress::RECORDER_3:
|
||||
primDevType = CEC_OP_PRIM_DEVTYPE_RECORD;
|
||||
logAddrType = CEC_LOG_ADDR_TYPE_RECORD;
|
||||
allDevTypes = CEC_OP_ALL_DEVTYPE_RECORD;
|
||||
break;
|
||||
case CecLogicalAddress::TUNER_1:
|
||||
case CecLogicalAddress::TUNER_2:
|
||||
case CecLogicalAddress::TUNER_3:
|
||||
case CecLogicalAddress::TUNER_4:
|
||||
primDevType = CEC_OP_PRIM_DEVTYPE_TUNER;
|
||||
logAddrType = CEC_LOG_ADDR_TYPE_TUNER;
|
||||
allDevTypes = CEC_OP_ALL_DEVTYPE_TUNER;
|
||||
break;
|
||||
case CecLogicalAddress::PLAYBACK_1:
|
||||
case CecLogicalAddress::PLAYBACK_2:
|
||||
case CecLogicalAddress::PLAYBACK_3:
|
||||
primDevType = CEC_OP_PRIM_DEVTYPE_PLAYBACK;
|
||||
logAddrType = CEC_LOG_ADDR_TYPE_PLAYBACK;
|
||||
allDevTypes = CEC_OP_ALL_DEVTYPE_PLAYBACK;
|
||||
cecLogAddrs.flags |= CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU;
|
||||
break;
|
||||
case CecLogicalAddress::AUDIO_SYSTEM:
|
||||
primDevType = CEC_OP_PRIM_DEVTYPE_AUDIOSYSTEM;
|
||||
logAddrType = CEC_LOG_ADDR_TYPE_AUDIOSYSTEM;
|
||||
allDevTypes = CEC_OP_ALL_DEVTYPE_AUDIOSYSTEM;
|
||||
break;
|
||||
case CecLogicalAddress::FREE_USE:
|
||||
primDevType = CEC_OP_PRIM_DEVTYPE_PROCESSOR;
|
||||
logAddrType = CEC_LOG_ADDR_TYPE_SPECIFIC;
|
||||
allDevTypes = CEC_OP_ALL_DEVTYPE_SWITCH;
|
||||
break;
|
||||
case CecLogicalAddress::UNREGISTERED:
|
||||
cecLogAddrs.flags |= CEC_LOG_ADDRS_FL_ALLOW_UNREG_FALLBACK;
|
||||
break;
|
||||
case CecLogicalAddress::BACKUP_1:
|
||||
case CecLogicalAddress::BACKUP_2:
|
||||
break;
|
||||
}
|
||||
|
||||
int logAddrIndex = cecLogAddrs.num_log_addrs;
|
||||
cecLogAddrs.num_log_addrs += 1;
|
||||
cecLogAddrs.log_addr[logAddrIndex] = static_cast<cec_logical_address_t>(addr);
|
||||
cecLogAddrs.log_addr_type[logAddrIndex] = logAddrType;
|
||||
cecLogAddrs.primary_device_type[logAddrIndex] = primDevType;
|
||||
cecLogAddrs.all_device_types[logAddrIndex] = allDevTypes;
|
||||
cecLogAddrs.features[logAddrIndex][0] = 0;
|
||||
cecLogAddrs.features[logAddrIndex][1] = 0;
|
||||
|
||||
ret = ioctl(mHdmiCecPorts[0]->mCecFd, CEC_ADAP_S_LOG_ADDRS, &cecLogAddrs);
|
||||
if (ret) {
|
||||
LOG(ERROR) << "Add logical address failed for port " << mHdmiCecPorts[0]->mPortId
|
||||
<< ", Error = " << strerror(errno);
|
||||
*_aidl_return = Result::FAILURE_BUSY;
|
||||
return ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
*_aidl_return = Result::SUCCESS;
|
||||
return ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ScopedAStatus HdmiCec::clearLogicalAddress() {
|
||||
cec_log_addrs cecLogAddrs;
|
||||
memset(&cecLogAddrs, 0, sizeof(cecLogAddrs));
|
||||
|
||||
int ret = ioctl(mHdmiCecPorts[0]->mCecFd, CEC_ADAP_S_LOG_ADDRS, &cecLogAddrs);
|
||||
if (ret) {
|
||||
LOG(ERROR) << "Clear logical Address failed for port " << mHdmiCecPorts[0]->mPortId
|
||||
<< ", Error = " << strerror(errno);
|
||||
}
|
||||
|
||||
return ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ScopedAStatus HdmiCec::enableAudioReturnChannel(int32_t portId __unused, bool enable __unused) {
|
||||
return ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ScopedAStatus HdmiCec::getCecVersion(int32_t* _aidl_return) {
|
||||
*_aidl_return = CEC_OP_CEC_VERSION_1_4;
|
||||
return ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ScopedAStatus HdmiCec::getPhysicalAddress(int32_t* _aidl_return) {
|
||||
uint16_t addr;
|
||||
|
||||
int ret = ioctl(mHdmiCecPorts[0]->mCecFd, CEC_ADAP_G_PHYS_ADDR, &addr);
|
||||
if (ret) {
|
||||
LOG(ERROR) << "Get physical address failed, Error = " << strerror(errno);
|
||||
return ScopedAStatus::fromServiceSpecificError(
|
||||
static_cast<int32_t>(Result::FAILURE_INVALID_STATE));
|
||||
}
|
||||
|
||||
*_aidl_return = addr;
|
||||
return ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ScopedAStatus HdmiCec::getVendorId(int32_t* _aidl_return) {
|
||||
*_aidl_return = 0x000c03; // HDMI LLC vendor ID
|
||||
return ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ScopedAStatus HdmiCec::sendMessage(const CecMessage& message, SendMessageResult* _aidl_return) {
|
||||
if (!mCecEnabled) {
|
||||
*_aidl_return = SendMessageResult::FAIL;
|
||||
return ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
cec_msg cecMsg;
|
||||
memset(&cecMsg, 0, sizeof(cec_msg));
|
||||
|
||||
int initiator = static_cast<cec_logical_address_t>(message.initiator);
|
||||
int destination = static_cast<cec_logical_address_t>(message.destination);
|
||||
|
||||
cecMsg.msg[0] = (initiator << 4) | destination;
|
||||
for (size_t i = 0; i < message.body.size(); ++i) {
|
||||
cecMsg.msg[i + 1] = message.body[i];
|
||||
}
|
||||
cecMsg.len = message.body.size() + 1;
|
||||
|
||||
int ret = ioctl(mHdmiCecPorts[0]->mCecFd, CEC_TRANSMIT, &cecMsg);
|
||||
if (ret) {
|
||||
LOG(ERROR) << "Send message failed, Error = " << strerror(errno);
|
||||
*_aidl_return = SendMessageResult::FAIL;
|
||||
return ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
if (cecMsg.tx_status != CEC_TX_STATUS_OK) {
|
||||
LOG(ERROR) << "Send message tx_status = " << cecMsg.tx_status;
|
||||
}
|
||||
|
||||
*_aidl_return = getSendMessageResult(cecMsg.tx_status);
|
||||
return ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ScopedAStatus HdmiCec::setCallback(const std::shared_ptr<IHdmiCecCallback>& callback) {
|
||||
if (mCallback != nullptr) {
|
||||
mCallback = nullptr;
|
||||
}
|
||||
|
||||
if (callback != nullptr) {
|
||||
mCallback = callback;
|
||||
}
|
||||
|
||||
return ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ScopedAStatus HdmiCec::setLanguage(const std::string& language __unused) {
|
||||
return ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ScopedAStatus HdmiCec::enableWakeupByOtp(bool value) {
|
||||
mWakeupEnabled = value;
|
||||
return ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ScopedAStatus HdmiCec::enableCec(bool value) {
|
||||
mCecEnabled = value;
|
||||
return ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ScopedAStatus HdmiCec::enableSystemCecControl(bool value) {
|
||||
mCecControlEnabled = value;
|
||||
return ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
// Initialise the cec file descriptor
|
||||
Result HdmiCec::init() {
|
||||
string cecDevice = GetProperty(PROPERTY_CEC_DEVICE, "cec0");
|
||||
if (cecDevice != "cec0" && cecDevice != "cec1") {
|
||||
LOG(ERROR) << "Invalid CEC device " << cecDevice;
|
||||
return Result::FAILURE_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
string devicePath = "/dev/" + cecDevice;
|
||||
int portId = stoi(cecDevice.substr(3));
|
||||
|
||||
shared_ptr<HdmiCecPort> hdmiCecPort(new HdmiCecPort(portId));
|
||||
Result result = hdmiCecPort->init(devicePath.c_str());
|
||||
if (result != Result::SUCCESS) {
|
||||
return Result::FAILURE_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
thread eventThread(&HdmiCec::event_thread, this, hdmiCecPort.get());
|
||||
mEventThreads.push_back(std::move(eventThread));
|
||||
mHdmiCecPorts.push_back(std::move(hdmiCecPort));
|
||||
LOG(INFO) << "Using CEC device " << devicePath;
|
||||
|
||||
mCecEnabled = true;
|
||||
mWakeupEnabled = true;
|
||||
mCecControlEnabled = true;
|
||||
|
||||
return Result::SUCCESS;
|
||||
}
|
||||
|
||||
void HdmiCec::release() {
|
||||
mCecEnabled = false;
|
||||
mWakeupEnabled = false;
|
||||
mCecControlEnabled = false;
|
||||
|
||||
for (thread& eventThread : mEventThreads) {
|
||||
if (eventThread.joinable()) {
|
||||
eventThread.join();
|
||||
}
|
||||
}
|
||||
setCallback(nullptr);
|
||||
mHdmiCecPorts.clear();
|
||||
mEventThreads.clear();
|
||||
}
|
||||
|
||||
void HdmiCec::event_thread(HdmiCecPort* hdmiCecPort) {
|
||||
struct pollfd ufds[3] = {
|
||||
{hdmiCecPort->mCecFd, POLLIN, 0},
|
||||
{hdmiCecPort->mCecFd, POLLERR, 0},
|
||||
{hdmiCecPort->mExitFd, POLLIN, 0},
|
||||
};
|
||||
|
||||
while (1) {
|
||||
ufds[0].revents = 0;
|
||||
ufds[1].revents = 0;
|
||||
ufds[2].revents = 0;
|
||||
|
||||
int ret = poll(ufds, /* size(ufds) = */ 3, /* timeout = */ -1);
|
||||
|
||||
if (ret <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ufds[2].revents == POLLIN) { /* Exit */
|
||||
break;
|
||||
}
|
||||
|
||||
if (ufds[1].revents == POLLERR) { /* CEC Event */
|
||||
cec_event ev;
|
||||
ret = ioctl(hdmiCecPort->mCecFd, CEC_DQEVENT, &ev);
|
||||
|
||||
if (ret) {
|
||||
LOG(ERROR) << "CEC_DQEVENT failed, Error = " << strerror(errno);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!mCecEnabled) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (ufds[0].revents == POLLIN) { /* CEC Driver */
|
||||
cec_msg msg = {};
|
||||
ret = ioctl(hdmiCecPort->mCecFd, CEC_RECEIVE, &msg);
|
||||
|
||||
if (ret) {
|
||||
LOG(ERROR) << "CEC_RECEIVE failed, Error = " << strerror(errno);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (msg.rx_status != CEC_RX_STATUS_OK) {
|
||||
LOG(ERROR) << "msg rx_status = " << msg.rx_status;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!mCecEnabled) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!mWakeupEnabled && isWakeupMessage(msg)) {
|
||||
LOG(DEBUG) << "Filter wakeup message";
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!mCecControlEnabled && !isTransferableInSleep(msg)) {
|
||||
LOG(DEBUG) << "Filter message in standby mode";
|
||||
continue;
|
||||
}
|
||||
|
||||
if (mCallback != nullptr) {
|
||||
size_t length = std::min(msg.len - 1, (uint32_t)(CEC_MESSAGE_BODY_MAX_LENGTH - 1));
|
||||
CecMessage cecMessage{
|
||||
.initiator = static_cast<CecLogicalAddress>(msg.msg[0] >> 4),
|
||||
.destination = static_cast<CecLogicalAddress>(msg.msg[0] & 0xf),
|
||||
};
|
||||
cecMessage.body.resize(length);
|
||||
for (size_t i = 0; i < length; ++i) {
|
||||
cecMessage.body[i] = static_cast<uint8_t>(msg.msg[i + 1]);
|
||||
}
|
||||
mCallback->onCecMessage(cecMessage);
|
||||
} else {
|
||||
LOG(ERROR) << "no event callback for message";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int HdmiCec::getOpcode(cec_msg message) {
|
||||
return static_cast<uint8_t>(message.msg[1]);
|
||||
}
|
||||
|
||||
bool HdmiCec::isWakeupMessage(cec_msg message) {
|
||||
int opcode = getOpcode(message);
|
||||
switch (opcode) {
|
||||
case CEC_MESSAGE_TEXT_VIEW_ON:
|
||||
case CEC_MESSAGE_IMAGE_VIEW_ON:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool HdmiCec::isTransferableInSleep(cec_msg message) {
|
||||
int opcode = getOpcode(message);
|
||||
switch (opcode) {
|
||||
case CEC_MESSAGE_ABORT:
|
||||
case CEC_MESSAGE_DEVICE_VENDOR_ID:
|
||||
case CEC_MESSAGE_GET_CEC_VERSION:
|
||||
case CEC_MESSAGE_GET_MENU_LANGUAGE:
|
||||
case CEC_MESSAGE_GIVE_DEVICE_POWER_STATUS:
|
||||
case CEC_MESSAGE_GIVE_DEVICE_VENDOR_ID:
|
||||
case CEC_MESSAGE_GIVE_OSD_NAME:
|
||||
case CEC_MESSAGE_GIVE_PHYSICAL_ADDRESS:
|
||||
case CEC_MESSAGE_REPORT_PHYSICAL_ADDRESS:
|
||||
case CEC_MESSAGE_REPORT_POWER_STATUS:
|
||||
case CEC_MESSAGE_SET_OSD_NAME:
|
||||
case CEC_MESSAGE_DECK_CONTROL:
|
||||
case CEC_MESSAGE_PLAY:
|
||||
case CEC_MESSAGE_IMAGE_VIEW_ON:
|
||||
case CEC_MESSAGE_TEXT_VIEW_ON:
|
||||
case CEC_MESSAGE_SYSTEM_AUDIO_MODE_REQUEST:
|
||||
return true;
|
||||
case CEC_MESSAGE_USER_CONTROL_PRESSED:
|
||||
return isPowerUICommand(message);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int HdmiCec::getFirstParam(cec_msg message) {
|
||||
return static_cast<uint8_t>(message.msg[2]);
|
||||
}
|
||||
|
||||
bool HdmiCec::isPowerUICommand(cec_msg message) {
|
||||
int uiCommand = getFirstParam(message);
|
||||
switch (uiCommand) {
|
||||
case CEC_OP_UI_CMD_POWER:
|
||||
case CEC_OP_UI_CMD_DEVICE_ROOT_MENU:
|
||||
case CEC_OP_UI_CMD_POWER_ON_FUNCTION:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
SendMessageResult HdmiCec::getSendMessageResult(int tx_status) {
|
||||
switch (tx_status) {
|
||||
case CEC_TX_STATUS_OK:
|
||||
return SendMessageResult::SUCCESS;
|
||||
case CEC_TX_STATUS_ARB_LOST:
|
||||
return SendMessageResult::BUSY;
|
||||
case CEC_TX_STATUS_NACK:
|
||||
return SendMessageResult::NACK;
|
||||
default:
|
||||
return SendMessageResult::FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace cec
|
||||
} // namespace hdmi
|
||||
} // namespace tv
|
||||
} // namespace hardware
|
||||
} // namespace android
|
100
hdmi/cec/HdmiCec.h
Normal file
100
hdmi/cec/HdmiCec.h
Normal file
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Copyright (C) 2021 The Android Open Source Project
|
||||
* Copyright (C) 2025 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.
|
||||
*/
|
||||
|
||||
#include <aidl/android/hardware/tv/hdmi/cec/BnHdmiCec.h>
|
||||
#include <hardware/hdmi_cec.h>
|
||||
#include <linux/cec.h>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
#include "HdmiCecPort.h"
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace tv {
|
||||
namespace hdmi {
|
||||
namespace cec {
|
||||
namespace implementation {
|
||||
|
||||
using std::shared_ptr;
|
||||
using std::thread;
|
||||
using std::vector;
|
||||
|
||||
using ::aidl::android::hardware::tv::hdmi::cec::BnHdmiCec;
|
||||
using ::aidl::android::hardware::tv::hdmi::cec::CecLogicalAddress;
|
||||
using ::aidl::android::hardware::tv::hdmi::cec::CecMessage;
|
||||
using ::aidl::android::hardware::tv::hdmi::cec::IHdmiCec;
|
||||
using ::aidl::android::hardware::tv::hdmi::cec::IHdmiCecCallback;
|
||||
using ::aidl::android::hardware::tv::hdmi::cec::Result;
|
||||
using ::aidl::android::hardware::tv::hdmi::cec::SendMessageResult;
|
||||
|
||||
struct HdmiCec : public BnHdmiCec {
|
||||
public:
|
||||
HdmiCec();
|
||||
~HdmiCec();
|
||||
::ndk::ScopedAStatus addLogicalAddress(CecLogicalAddress addr, Result* _aidl_return) override;
|
||||
::ndk::ScopedAStatus clearLogicalAddress() override;
|
||||
::ndk::ScopedAStatus enableAudioReturnChannel(int32_t portId, bool enable) override;
|
||||
::ndk::ScopedAStatus getCecVersion(int32_t* _aidl_return) override;
|
||||
::ndk::ScopedAStatus getPhysicalAddress(int32_t* _aidl_return) override;
|
||||
::ndk::ScopedAStatus getVendorId(int32_t* _aidl_return) override;
|
||||
::ndk::ScopedAStatus sendMessage(const CecMessage& message,
|
||||
SendMessageResult* _aidl_return) override;
|
||||
::ndk::ScopedAStatus setCallback(const std::shared_ptr<IHdmiCecCallback>& callback) override;
|
||||
::ndk::ScopedAStatus setLanguage(const std::string& language) override;
|
||||
::ndk::ScopedAStatus enableWakeupByOtp(bool value) override;
|
||||
::ndk::ScopedAStatus enableCec(bool value) override;
|
||||
::ndk::ScopedAStatus enableSystemCecControl(bool value) override;
|
||||
|
||||
Result init();
|
||||
void release();
|
||||
|
||||
private:
|
||||
void event_thread(HdmiCecPort* hdmiCecPort);
|
||||
static int getOpcode(cec_msg message);
|
||||
static int getFirstParam(cec_msg message);
|
||||
static bool isWakeupMessage(cec_msg message);
|
||||
static bool isTransferableInSleep(cec_msg message);
|
||||
static bool isPowerUICommand(cec_msg message);
|
||||
static SendMessageResult getSendMessageResult(int tx_status);
|
||||
|
||||
vector<thread> mEventThreads;
|
||||
vector<shared_ptr<HdmiCecPort>> mHdmiCecPorts;
|
||||
|
||||
// When set to false, all the CEC commands are discarded. True by default after initialization.
|
||||
bool mCecEnabled;
|
||||
/*
|
||||
* When set to false, HAL does not wake up the system upon receiving <Image View On> or
|
||||
* <Text View On>. True by default after initialization.
|
||||
*/
|
||||
bool mWakeupEnabled;
|
||||
/*
|
||||
* Updated when system goes into or comes out of standby mode.
|
||||
* When set to true, Android system is handling CEC commands.
|
||||
* When set to false, microprocessor is handling CEC commands.
|
||||
* True by default after initialization.
|
||||
*/
|
||||
bool mCecControlEnabled;
|
||||
|
||||
std::shared_ptr<IHdmiCecCallback> mCallback;
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace cec
|
||||
} // namespace hdmi
|
||||
} // namespace tv
|
||||
} // namespace hardware
|
||||
} // namespace android
|
103
hdmi/cec/HdmiCecPort.cpp
Normal file
103
hdmi/cec/HdmiCecPort.cpp
Normal file
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright (C) 2021 The Android Open Source Project
|
||||
* Copyright (C) 2025 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.tv.hdmi.cec-service.rpi"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <errno.h>
|
||||
#include <linux/cec.h>
|
||||
#include <linux/ioctl.h>
|
||||
#include <sys/eventfd.h>
|
||||
#include <algorithm>
|
||||
|
||||
#include "HdmiCecPort.h"
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace tv {
|
||||
namespace hdmi {
|
||||
namespace cec {
|
||||
namespace implementation {
|
||||
|
||||
HdmiCecPort::HdmiCecPort(unsigned int portId) {
|
||||
mPortId = portId;
|
||||
mCecFd = -1;
|
||||
mExitFd = -1;
|
||||
}
|
||||
|
||||
HdmiCecPort::~HdmiCecPort() {
|
||||
release();
|
||||
}
|
||||
|
||||
// Initialise the cec file descriptor
|
||||
Result HdmiCecPort::init(const char* path) {
|
||||
mCecFd = open(path, O_RDWR);
|
||||
if (mCecFd < 0) {
|
||||
LOG(ERROR) << "Failed to open " << path << ", Error = " << strerror(errno);
|
||||
return Result::FAILURE_NOT_SUPPORTED;
|
||||
}
|
||||
mExitFd = eventfd(0, EFD_NONBLOCK);
|
||||
if (mExitFd < 0) {
|
||||
LOG(ERROR) << "Failed to open eventfd, Error = " << strerror(errno);
|
||||
release();
|
||||
return Result::FAILURE_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
// Ensure the CEC device supports required capabilities
|
||||
struct cec_caps caps = {};
|
||||
int ret = ioctl(mCecFd, CEC_ADAP_G_CAPS, &caps);
|
||||
if (ret) {
|
||||
LOG(ERROR) << "Unable to query cec adapter capabilities, Error = " << strerror(errno);
|
||||
release();
|
||||
return Result::FAILURE_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
if (!(caps.capabilities & (CEC_CAP_LOG_ADDRS | CEC_CAP_TRANSMIT | CEC_CAP_PASSTHROUGH))) {
|
||||
LOG(ERROR) << "Wrong cec adapter capabilities " << caps.capabilities;
|
||||
release();
|
||||
return Result::FAILURE_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
uint32_t mode = CEC_MODE_INITIATOR | CEC_MODE_EXCL_FOLLOWER_PASSTHRU;
|
||||
ret = ioctl(mCecFd, CEC_S_MODE, &mode);
|
||||
if (ret) {
|
||||
LOG(ERROR) << "Unable to set initiator mode, Error = " << strerror(errno);
|
||||
release();
|
||||
return Result::FAILURE_NOT_SUPPORTED;
|
||||
}
|
||||
return Result::SUCCESS;
|
||||
}
|
||||
|
||||
void HdmiCecPort::release() {
|
||||
if (mExitFd > 0) {
|
||||
uint64_t tmp = 1;
|
||||
write(mExitFd, &tmp, sizeof(tmp));
|
||||
}
|
||||
if (mExitFd > 0) {
|
||||
close(mExitFd);
|
||||
}
|
||||
if (mCecFd > 0) {
|
||||
close(mCecFd);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace cec
|
||||
} // namespace hdmi
|
||||
} // namespace tv
|
||||
} // namespace hardware
|
||||
} // namespace android
|
46
hdmi/cec/HdmiCecPort.h
Normal file
46
hdmi/cec/HdmiCecPort.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (C) 2021 The Android Open Source Project
|
||||
* Copyright (C) 2025 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.
|
||||
*/
|
||||
|
||||
#include <aidl/android/hardware/tv/hdmi/cec/BnHdmiCec.h>
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace tv {
|
||||
namespace hdmi {
|
||||
namespace cec {
|
||||
namespace implementation {
|
||||
|
||||
using ::aidl::android::hardware::tv::hdmi::cec::Result;
|
||||
|
||||
class HdmiCecPort {
|
||||
public:
|
||||
HdmiCecPort(unsigned int portId);
|
||||
~HdmiCecPort();
|
||||
Result init(const char* path);
|
||||
void release();
|
||||
|
||||
unsigned int mPortId;
|
||||
int mCecFd;
|
||||
int mExitFd;
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace cec
|
||||
} // namespace hdmi
|
||||
} // namespace tv
|
||||
} // namespace hardware
|
||||
} // namespace android
|
5
hdmi/cec/android.hardware.tv.hdmi.cec-service.rpi.rc
Normal file
5
hdmi/cec/android.hardware.tv.hdmi.cec-service.rpi.rc
Normal file
@@ -0,0 +1,5 @@
|
||||
service vendor.cec-rpi /apex/com.android.hardware.tv.hdmi.cec.rpi4/bin/hw/android.hardware.tv.hdmi.cec-service.rpi
|
||||
interface aidl android.hardware.tv.hdmi.cec.IHdmiCec/default
|
||||
class hal
|
||||
user system
|
||||
group system
|
10
hdmi/cec/android.hardware.tv.hdmi.cec-service.rpi.xml
Normal file
10
hdmi/cec/android.hardware.tv.hdmi.cec-service.rpi.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<manifest version="1.0" type="device">
|
||||
<hal format="aidl">
|
||||
<name>android.hardware.tv.hdmi.cec</name>
|
||||
<version>1</version>
|
||||
<interface>
|
||||
<name>IHdmiCec</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
</manifest>
|
3
hdmi/cec/apex_file_contexts
Normal file
3
hdmi/cec/apex_file_contexts
Normal file
@@ -0,0 +1,3 @@
|
||||
(/.*)? u:object_r:vendor_file:s0
|
||||
/etc(/.*)? u:object_r:vendor_configs_file:s0
|
||||
/bin/hw/android\.hardware\.tv\.hdmi\.cec-service\.rpi u:object_r:hal_tv_hdmi_cec_default_exec:s0
|
4
hdmi/cec/apex_manifest.json
Normal file
4
hdmi/cec/apex_manifest.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "com.android.hardware.tv.hdmi.cec.rpi4",
|
||||
"version": 1
|
||||
}
|
37
hdmi/cec/main.cpp
Normal file
37
hdmi/cec/main.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
* Copyright (C) 2025 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.
|
||||
*/
|
||||
|
||||
#include "HdmiCec.h"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <android/binder_manager.h>
|
||||
#include <android/binder_process.h>
|
||||
|
||||
using android::hardware::tv::hdmi::cec::implementation::HdmiCec;
|
||||
|
||||
int main() {
|
||||
ABinderProcess_setThreadPoolMaxThreadCount(1);
|
||||
ABinderProcess_startThreadPool();
|
||||
|
||||
std::shared_ptr<HdmiCec> hdmiCecAidl = ndk::SharedRefBase::make<HdmiCec>();
|
||||
const std::string instance = std::string() + HdmiCec::descriptor + "/default";
|
||||
binder_status_t status = AServiceManager_addService(hdmiCecAidl->asBinder().get(), instance.c_str());
|
||||
CHECK_EQ(status, STATUS_OK);
|
||||
|
||||
ABinderProcess_joinThreadPool();
|
||||
return EXIT_FAILURE; // should not reach
|
||||
}
|
50
hdmi/connection/Android.bp
Normal file
50
hdmi/connection/Android.bp
Normal file
@@ -0,0 +1,50 @@
|
||||
// Copyright (C) 2022 The Android Open Source Project
|
||||
// Copyright (C) 2025 KonstaKANG
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
cc_binary {
|
||||
name: "android.hardware.tv.hdmi.connection-service.rpi",
|
||||
relative_install_path: "hw",
|
||||
vendor: true,
|
||||
srcs: [
|
||||
"HdmiConnection.cpp",
|
||||
"main.cpp",
|
||||
],
|
||||
shared_libs: [
|
||||
"android.hardware.tv.hdmi.connection-V1-ndk",
|
||||
"libbase",
|
||||
"libbinder_ndk",
|
||||
"liblog",
|
||||
],
|
||||
installable: false,
|
||||
}
|
||||
|
||||
prebuilt_etc {
|
||||
name: "android.hardware.tv.hdmi.connection-service.rpi.rc",
|
||||
src: "android.hardware.tv.hdmi.connection-service.rpi.rc",
|
||||
installable: false,
|
||||
}
|
||||
|
||||
prebuilt_etc {
|
||||
name: "android.hardware.tv.hdmi.connection-service.rpi.xml",
|
||||
src: "android.hardware.tv.hdmi.connection-service.rpi.xml",
|
||||
sub_dir: "vintf",
|
||||
installable: false,
|
||||
}
|
||||
|
||||
apex {
|
||||
name: "com.android.hardware.tv.hdmi.connection.rpi4",
|
||||
manifest: "apex_manifest.json",
|
||||
file_contexts: "apex_file_contexts",
|
||||
key: "com.android.hardware.key",
|
||||
certificate: ":com.android.hardware.certificate",
|
||||
updatable: false,
|
||||
vendor: true,
|
||||
|
||||
binaries: ["android.hardware.tv.hdmi.connection-service.rpi"],
|
||||
prebuilts: [
|
||||
"android.hardware.tv.hdmi.connection-service.rpi.rc",
|
||||
"android.hardware.tv.hdmi.connection-service.rpi.xml",
|
||||
],
|
||||
}
|
119
hdmi/connection/HdmiConnection.cpp
Normal file
119
hdmi/connection/HdmiConnection.cpp
Normal file
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
* Copyright (C) 2025 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.tv.hdmi.connection-service.rpi"
|
||||
|
||||
#include "HdmiConnection.h"
|
||||
|
||||
#include <android-base/file.h>
|
||||
#include <android-base/logging.h>
|
||||
|
||||
using android::base::ReadFileToString;
|
||||
using ndk::ScopedAStatus;
|
||||
using std::string;
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace tv {
|
||||
namespace hdmi {
|
||||
namespace connection {
|
||||
namespace implementation {
|
||||
|
||||
static const string drmCard = "card0";
|
||||
|
||||
HdmiConnection::HdmiConnection() {
|
||||
mCallback = nullptr;
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mPortInfos.push_back(
|
||||
{.type = HdmiPortType::OUTPUT,
|
||||
.portId = i,
|
||||
.cecSupported = true,
|
||||
.arcSupported = false,
|
||||
.eArcSupported = false,
|
||||
.physicalAddress = 0xFFFF});
|
||||
mHpdSignal.push_back(HpdSignal::HDMI_HPD_PHYSICAL);
|
||||
}
|
||||
}
|
||||
|
||||
HdmiConnection::~HdmiConnection() {
|
||||
if (mCallback != nullptr) {
|
||||
mCallback = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
ScopedAStatus HdmiConnection::getPortInfo(std::vector<HdmiPortInfo>* _aidl_return) {
|
||||
*_aidl_return = mPortInfos;
|
||||
return ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ScopedAStatus HdmiConnection::isConnected(int32_t portId, bool* _aidl_return) {
|
||||
if (portId != 0 && portId != 1) {
|
||||
*_aidl_return = false;
|
||||
return ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
bool connected = false;
|
||||
string hdmiStatusPath = "/sys/class/drm/" + drmCard + "-HDMI-A-" + to_string(portId + 1) + "/status";
|
||||
if (!access(hdmiStatusPath.c_str(), R_OK)) {
|
||||
string connectedValue;
|
||||
if (ReadFileToString(hdmiStatusPath, &connectedValue)) {
|
||||
connected = !connectedValue.compare("connected\n");
|
||||
}
|
||||
}
|
||||
LOG(INFO) << "portId: " << portId << ", connected: " << connected;
|
||||
|
||||
*_aidl_return = connected;
|
||||
return ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ScopedAStatus HdmiConnection::setCallback(const std::shared_ptr<IHdmiConnectionCallback>& callback) {
|
||||
if (mCallback != nullptr) {
|
||||
mCallback = nullptr;
|
||||
}
|
||||
|
||||
if (callback != nullptr) {
|
||||
mCallback = callback;
|
||||
}
|
||||
|
||||
return ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ScopedAStatus HdmiConnection::setHpdSignal(HpdSignal signal, int32_t portId) {
|
||||
if (portId != 0 && portId != 1) {
|
||||
return ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
||||
}
|
||||
|
||||
mHpdSignal.at(portId) = signal;
|
||||
return ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ScopedAStatus HdmiConnection::getHpdSignal(int32_t portId, HpdSignal* _aidl_return) {
|
||||
if (portId != 0 && portId != 1) {
|
||||
return ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
||||
}
|
||||
|
||||
*_aidl_return = mHpdSignal.at(portId);
|
||||
return ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace connection
|
||||
} // namespace hdmi
|
||||
} // namespace tv
|
||||
} // namespace hardware
|
||||
} // namespace android
|
62
hdmi/connection/HdmiConnection.h
Normal file
62
hdmi/connection/HdmiConnection.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
* Copyright (C) 2025 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.
|
||||
*/
|
||||
|
||||
#include <aidl/android/hardware/tv/hdmi/connection/BnHdmiConnection.h>
|
||||
#include <aidl/android/hardware/tv/hdmi/connection/Result.h>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace tv {
|
||||
namespace hdmi {
|
||||
namespace connection {
|
||||
namespace implementation {
|
||||
|
||||
using ::aidl::android::hardware::tv::hdmi::connection::BnHdmiConnection;
|
||||
using ::aidl::android::hardware::tv::hdmi::connection::HdmiPortInfo;
|
||||
using ::aidl::android::hardware::tv::hdmi::connection::HdmiPortType;
|
||||
using ::aidl::android::hardware::tv::hdmi::connection::HpdSignal;
|
||||
using ::aidl::android::hardware::tv::hdmi::connection::IHdmiConnection;
|
||||
using ::aidl::android::hardware::tv::hdmi::connection::IHdmiConnectionCallback;
|
||||
using ::aidl::android::hardware::tv::hdmi::connection::Result;
|
||||
|
||||
struct HdmiConnection : public BnHdmiConnection {
|
||||
HdmiConnection();
|
||||
~HdmiConnection();
|
||||
::ndk::ScopedAStatus getPortInfo(std::vector<HdmiPortInfo>* _aidl_return) override;
|
||||
::ndk::ScopedAStatus isConnected(int32_t portId, bool* _aidl_return) override;
|
||||
::ndk::ScopedAStatus setCallback(
|
||||
const std::shared_ptr<IHdmiConnectionCallback>& callback) override;
|
||||
::ndk::ScopedAStatus setHpdSignal(HpdSignal signal, int32_t portId) override;
|
||||
::ndk::ScopedAStatus getHpdSignal(int32_t portId, HpdSignal* _aidl_return) override;
|
||||
|
||||
private:
|
||||
std::vector<HdmiPortInfo> mPortInfos;
|
||||
std::vector<HpdSignal> mHpdSignal;
|
||||
|
||||
std::shared_ptr<IHdmiConnectionCallback> mCallback;
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace connection
|
||||
} // namespace hdmi
|
||||
} // Namespace tv
|
||||
} // namespace hardware
|
||||
} // namespace android
|
@@ -0,0 +1,5 @@
|
||||
service vendor.hdmi-rpi /apex/com.android.hardware.tv.hdmi.connection.rpi4/bin/hw/android.hardware.tv.hdmi.connection-service.rpi
|
||||
interface aidl android.hardware.tv.hdmi.connection.IHdmiConnection/default
|
||||
class hal
|
||||
user system
|
||||
group system
|
@@ -0,0 +1,10 @@
|
||||
<manifest version="1.0" type="device">
|
||||
<hal format="aidl">
|
||||
<name>android.hardware.tv.hdmi.connection</name>
|
||||
<version>1</version>
|
||||
<interface>
|
||||
<name>IHdmiConnection</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
</manifest>
|
3
hdmi/connection/apex_file_contexts
Normal file
3
hdmi/connection/apex_file_contexts
Normal file
@@ -0,0 +1,3 @@
|
||||
(/.*)? u:object_r:vendor_file:s0
|
||||
/etc(/.*)? u:object_r:vendor_configs_file:s0
|
||||
/bin/hw/android\.hardware\.tv\.hdmi\.connection-service\.rpi u:object_r:hal_tv_hdmi_connection_default_exec:s0
|
4
hdmi/connection/apex_manifest.json
Normal file
4
hdmi/connection/apex_manifest.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "com.android.hardware.tv.hdmi.connection.rpi4",
|
||||
"version": 1
|
||||
}
|
37
hdmi/connection/main.cpp
Normal file
37
hdmi/connection/main.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
* Copyright (C) 2025 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.
|
||||
*/
|
||||
|
||||
#include "HdmiConnection.h"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <android/binder_manager.h>
|
||||
#include <android/binder_process.h>
|
||||
|
||||
using android::hardware::tv::hdmi::connection::implementation::HdmiConnection;
|
||||
|
||||
int main() {
|
||||
ABinderProcess_setThreadPoolMaxThreadCount(1);
|
||||
ABinderProcess_startThreadPool();
|
||||
|
||||
std::shared_ptr<HdmiConnection> hdmiAidl = ndk::SharedRefBase::make<HdmiConnection>();
|
||||
const std::string instance = std::string() + HdmiConnection::descriptor + "/default";
|
||||
binder_status_t status = AServiceManager_addService(hdmiAidl->asBinder().get(), instance.c_str());
|
||||
CHECK_EQ(status, STATUS_OK);
|
||||
|
||||
ABinderProcess_joinThreadPool();
|
||||
return EXIT_FAILURE; // should not reach
|
||||
}
|
@@ -1,33 +1,58 @@
|
||||
// Copyright (C) 2021-2022 KonstaKANG
|
||||
// Copyright (C) 2018 The Android Open Source Project
|
||||
// Copyright (C) 2023 KonstaKANG
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
cc_binary {
|
||||
name: "android.hardware.health@2.0-service.rpi",
|
||||
init_rc: ["android.hardware.health@2.0-service.rpi.rc"],
|
||||
vintf_fragments: ["android.hardware.health@2.0-service.rpi.xml"],
|
||||
proprietary: true,
|
||||
name: "android.hardware.health-service.rpi",
|
||||
relative_install_path: "hw",
|
||||
vendor: true,
|
||||
srcs: [
|
||||
"HealthService.cpp",
|
||||
],
|
||||
cflags: [
|
||||
"-Wall",
|
||||
"-Werror",
|
||||
"HealthImpl.cpp",
|
||||
"main.cpp",
|
||||
],
|
||||
static_libs: [
|
||||
"android.hardware.health@2.0-impl",
|
||||
"android.hardware.health@1.0-convert",
|
||||
"libhealthservice",
|
||||
"libbatterymonitor",
|
||||
"libhealthstoragedefault",
|
||||
"libhealth_aidl_impl",
|
||||
"libhealthloop",
|
||||
],
|
||||
shared_libs: [
|
||||
"android.hardware.health-V4-ndk",
|
||||
"libbase",
|
||||
"libbinder_ndk",
|
||||
"libcutils",
|
||||
"libhidlbase",
|
||||
"liblog",
|
||||
"libutils",
|
||||
"android.hardware.health@2.0",
|
||||
],
|
||||
header_libs: ["libhealthd_headers"],
|
||||
overrides: ["charger"],
|
||||
installable: false,
|
||||
}
|
||||
|
||||
prebuilt_etc {
|
||||
name: "android.hardware.health-service.rpi.rc",
|
||||
src: "android.hardware.health-service.rpi.rc",
|
||||
installable: false,
|
||||
}
|
||||
|
||||
prebuilt_etc {
|
||||
name: "android.hardware.health-service.rpi.xml",
|
||||
src: "android.hardware.health-service.rpi.xml",
|
||||
sub_dir: "vintf",
|
||||
installable: false,
|
||||
}
|
||||
|
||||
apex {
|
||||
name: "com.android.hardware.health.rpi4",
|
||||
manifest: "apex_manifest.json",
|
||||
file_contexts: "apex_file_contexts",
|
||||
key: "com.android.hardware.key",
|
||||
certificate: ":com.android.hardware.certificate",
|
||||
updatable: false,
|
||||
vendor: true,
|
||||
|
||||
binaries: ["android.hardware.health-service.rpi"],
|
||||
prebuilts: [
|
||||
"android.hardware.health-service.rpi.rc",
|
||||
"android.hardware.health-service.rpi.xml",
|
||||
],
|
||||
}
|
||||
|
82
health/HealthImpl.cpp
Normal file
82
health/HealthImpl.cpp
Normal file
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright (C) 2021 The Android Open Source Project
|
||||
* Copyright (C) 2023 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.
|
||||
*/
|
||||
|
||||
#include "HealthImpl.h"
|
||||
|
||||
using ::aidl::android::hardware::health::BatteryHealth;
|
||||
using ::aidl::android::hardware::health::BatteryStatus;
|
||||
using ::aidl::android::hardware::health::HealthInfo;
|
||||
|
||||
namespace aidl::android::hardware::health {
|
||||
|
||||
void HealthImpl::UpdateHealthInfo(HealthInfo* health_info) {
|
||||
health_info->chargerAcOnline = true;
|
||||
health_info->chargerUsbOnline = true;
|
||||
health_info->chargerWirelessOnline = false;
|
||||
health_info->chargerDockOnline = false;
|
||||
health_info->maxChargingCurrentMicroamps = 500000;
|
||||
health_info->maxChargingVoltageMicrovolts = 5000000;
|
||||
health_info->batteryStatus = BatteryStatus::FULL;
|
||||
health_info->batteryHealth = BatteryHealth::GOOD;
|
||||
health_info->batteryPresent = true;
|
||||
health_info->batteryLevel = 100;
|
||||
health_info->batteryVoltageMillivolts = 5000;
|
||||
health_info->batteryTemperatureTenthsCelsius = 250;
|
||||
health_info->batteryCurrentMicroamps = 500000;
|
||||
health_info->batteryCycleCount = 25;
|
||||
health_info->batteryFullChargeUah = 5000000;
|
||||
health_info->batteryChargeCounterUah = 5000000;
|
||||
health_info->batteryTechnology = "Li-ion";
|
||||
health_info->batteryCapacityLevel = BatteryCapacityLevel::FULL;
|
||||
health_info->batteryFullChargeDesignCapacityUah = 5000000;
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus HealthImpl::getChargeCounterUah(int32_t* out) {
|
||||
*out = 5000000;
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus HealthImpl::getCurrentNowMicroamps(int32_t* out) {
|
||||
*out = 500000;
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus HealthImpl::getCurrentAverageMicroamps(int32_t*) {
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus HealthImpl::getCapacity(int32_t* out) {
|
||||
*out = 100;
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus HealthImpl::getChargeStatus(BatteryStatus* out) {
|
||||
*out = BatteryStatus::FULL;
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus HealthImpl::getBatteryHealthData(BatteryHealthData* out) {
|
||||
out->batteryManufacturingDateSeconds = 1231006505;
|
||||
out->batteryFirstUsageSeconds = 1231469665;
|
||||
out->batteryStateOfHealth = 99;
|
||||
out->batterySerialNumber =
|
||||
"000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f";
|
||||
out->batteryPartStatus = BatteryPartStatus::ORIGINAL;
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
} // namespace aidl::android::hardware::health
|
42
health/HealthImpl.h
Normal file
42
health/HealthImpl.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (C) 2021 The Android Open Source Project
|
||||
* Copyright (C) 2023 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 <health-impl/Health.h>
|
||||
|
||||
using ::aidl::android::hardware::health::Health;
|
||||
|
||||
namespace aidl::android::hardware::health {
|
||||
|
||||
class HealthImpl : public Health {
|
||||
public:
|
||||
using Health::Health;
|
||||
virtual ~HealthImpl() {}
|
||||
|
||||
ndk::ScopedAStatus getChargeCounterUah(int32_t* out) override;
|
||||
ndk::ScopedAStatus getCurrentNowMicroamps(int32_t* out) override;
|
||||
ndk::ScopedAStatus getCurrentAverageMicroamps(int32_t* out) override;
|
||||
ndk::ScopedAStatus getCapacity(int32_t* out) override;
|
||||
ndk::ScopedAStatus getChargeStatus(BatteryStatus* out) override;
|
||||
ndk::ScopedAStatus getBatteryHealthData(BatteryHealthData* out) override;
|
||||
|
||||
protected:
|
||||
void UpdateHealthInfo(HealthInfo* health_info) override;
|
||||
};
|
||||
|
||||
} // namespace aidl::android::hardware::health
|
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 KonstaKANG
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <health2/service.h>
|
||||
#include <healthd/healthd.h>
|
||||
|
||||
int main() {
|
||||
return health_service_main();
|
||||
}
|
||||
|
||||
void healthd_board_init(struct healthd_config*) {}
|
||||
|
||||
int healthd_board_battery_update(struct android::BatteryProperties* battery_props) {
|
||||
battery_props->chargerAcOnline = true;
|
||||
battery_props->batteryLevel = 100;
|
||||
return 0;
|
||||
}
|
6
health/android.hardware.health-service.rpi.rc
Normal file
6
health/android.hardware.health-service.rpi.rc
Normal file
@@ -0,0 +1,6 @@
|
||||
service vendor.health-rpi /apex/com.android.hardware.health.rpi4/bin/hw/android.hardware.health-service.rpi
|
||||
class hal
|
||||
user system
|
||||
group system
|
||||
capabilities WAKE_ALARM BLOCK_SUSPEND
|
||||
file /dev/kmsg w
|
7
health/android.hardware.health-service.rpi.xml
Normal file
7
health/android.hardware.health-service.rpi.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<manifest version="1.0" type="device">
|
||||
<hal format="aidl">
|
||||
<name>android.hardware.health</name>
|
||||
<version>4</version>
|
||||
<fqname>IHealth/default</fqname>
|
||||
</hal>
|
||||
</manifest>
|
@@ -1,5 +0,0 @@
|
||||
service vendor.health-hal-2-0 /vendor/bin/hw/android.hardware.health@2.0-service.rpi
|
||||
class hal
|
||||
user system
|
||||
group system
|
||||
file /dev/kmsg w
|
@@ -1,11 +0,0 @@
|
||||
<manifest version="1.0" type="device">
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.health</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>2.0</version>
|
||||
<interface>
|
||||
<name>IHealth</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
</manifest>
|
3
health/apex_file_contexts
Normal file
3
health/apex_file_contexts
Normal file
@@ -0,0 +1,3 @@
|
||||
(/.*)? u:object_r:vendor_file:s0
|
||||
/etc(/.*)? u:object_r:vendor_configs_file:s0
|
||||
/bin/hw/android\.hardware\.health-service\.rpi u:object_r:hal_health_default_exec:s0
|
4
health/apex_manifest.json
Normal file
4
health/apex_manifest.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "com.android.hardware.health.rpi4",
|
||||
"version": 1
|
||||
}
|
32
health/main.cpp
Normal file
32
health/main.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (C) 2021 The Android Open Source Project
|
||||
* Copyright (C) 2023 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.
|
||||
*/
|
||||
|
||||
#include "HealthImpl.h"
|
||||
|
||||
#include <android/binder_interface_utils.h>
|
||||
#include <health/utils.h>
|
||||
|
||||
using ::aidl::android::hardware::health::HalHealthLoop;
|
||||
using ::aidl::android::hardware::health::HealthImpl;
|
||||
|
||||
int main() {
|
||||
auto config = std::make_unique<healthd_config>();
|
||||
android::hardware::health::InitHealthdConfig(config.get());
|
||||
auto binder = ndk::SharedRefBase::make<HealthImpl>("default", std::move(config));
|
||||
auto hal_health_loop = std::make_shared<HalHealthLoop>(binder, binder);
|
||||
return hal_health_loop->StartLoop();
|
||||
}
|
459
keylayout/Generic-tv.kl
Normal file
459
keylayout/Generic-tv.kl
Normal file
@@ -0,0 +1,459 @@
|
||||
# Copyright (C) 2010 The Android Open Source Project
|
||||
#
|
||||
# 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.
|
||||
|
||||
#
|
||||
# Generic key layout file for full alphabetic US English PC style external keyboards.
|
||||
#
|
||||
# This file is intentionally very generic and is intended to support a broad range of keyboards.
|
||||
# Do not edit the generic key layout to support a specific keyboard; instead, create
|
||||
# a new key layout file with the required keyboard configuration.
|
||||
#
|
||||
|
||||
key 1 ESCAPE
|
||||
key 2 1
|
||||
key 3 2
|
||||
key 4 3
|
||||
key 5 4
|
||||
key 6 5
|
||||
key 7 6
|
||||
key 8 7
|
||||
key 9 8
|
||||
key 10 9
|
||||
key 11 0
|
||||
key 12 MINUS
|
||||
key 13 EQUALS
|
||||
key 14 DEL
|
||||
key 15 TAB
|
||||
key 16 Q
|
||||
key 17 W
|
||||
key 18 E
|
||||
key 19 R
|
||||
key 20 T
|
||||
key 21 Y
|
||||
key 22 U
|
||||
key 23 I
|
||||
key 24 O
|
||||
key 25 P
|
||||
key 26 LEFT_BRACKET
|
||||
key 27 RIGHT_BRACKET
|
||||
key 28 DPAD_CENTER
|
||||
key 29 CTRL_LEFT
|
||||
key 30 A
|
||||
key 31 S
|
||||
key 32 D
|
||||
key 33 F
|
||||
key 34 G
|
||||
key 35 H
|
||||
key 36 J
|
||||
key 37 K
|
||||
key 38 L
|
||||
key 39 SEMICOLON
|
||||
key 40 APOSTROPHE
|
||||
key 41 GRAVE
|
||||
key 42 SHIFT_LEFT
|
||||
key 43 BACKSLASH
|
||||
key 44 Z
|
||||
key 45 X
|
||||
key 46 C
|
||||
key 47 V
|
||||
key 48 B
|
||||
key 49 N
|
||||
key 50 M
|
||||
key 51 COMMA
|
||||
key 52 PERIOD
|
||||
key 53 SLASH
|
||||
key 54 SHIFT_RIGHT
|
||||
key 55 NUMPAD_MULTIPLY
|
||||
key 56 ALT_LEFT
|
||||
key 57 SPACE
|
||||
key 58 CAPS_LOCK
|
||||
key 59 F1
|
||||
key 60 F2
|
||||
key 61 F3
|
||||
key 62 F4
|
||||
key 63 F5
|
||||
key 64 F6
|
||||
key 65 F7
|
||||
key 66 F8
|
||||
key 67 F9
|
||||
key 68 F10
|
||||
key 69 NUM_LOCK
|
||||
key 70 SCROLL_LOCK
|
||||
key 71 NUMPAD_7
|
||||
key 72 NUMPAD_8
|
||||
key 73 NUMPAD_9
|
||||
key 74 NUMPAD_SUBTRACT
|
||||
key 75 NUMPAD_4
|
||||
key 76 NUMPAD_5
|
||||
key 77 NUMPAD_6
|
||||
key 78 NUMPAD_ADD
|
||||
key 79 NUMPAD_1
|
||||
key 80 NUMPAD_2
|
||||
key 81 NUMPAD_3
|
||||
key 82 NUMPAD_0
|
||||
key 83 NUMPAD_DOT
|
||||
# key 84 (undefined)
|
||||
key 85 ZENKAKU_HANKAKU
|
||||
key 86 BACKSLASH
|
||||
key 87 F11
|
||||
key 88 F12
|
||||
key 89 RO
|
||||
# key 90 "KEY_KATAKANA"
|
||||
# key 91 "KEY_HIRAGANA"
|
||||
key 92 HENKAN
|
||||
key 93 KATAKANA_HIRAGANA
|
||||
key 94 MUHENKAN
|
||||
key 95 NUMPAD_COMMA
|
||||
key 96 NUMPAD_ENTER
|
||||
key 97 CTRL_RIGHT
|
||||
key 98 NUMPAD_DIVIDE
|
||||
key 99 SYSRQ
|
||||
key 100 ALT_RIGHT
|
||||
# key 101 "KEY_LINEFEED"
|
||||
key 102 MOVE_HOME
|
||||
key 103 DPAD_UP
|
||||
key 104 PAGE_UP
|
||||
key 105 DPAD_LEFT
|
||||
key 106 DPAD_RIGHT
|
||||
key 107 MOVE_END
|
||||
key 108 DPAD_DOWN
|
||||
key 109 PAGE_DOWN
|
||||
key 110 INSERT
|
||||
key 111 FORWARD_DEL
|
||||
# key 112 "KEY_MACRO"
|
||||
key 113 VOLUME_MUTE
|
||||
key 114 VOLUME_DOWN
|
||||
key 115 VOLUME_UP
|
||||
key 116 POWER
|
||||
key 117 NUMPAD_EQUALS
|
||||
# key 118 "KEY_KPPLUSMINUS"
|
||||
key 119 BREAK
|
||||
# key 120 (undefined)
|
||||
key 121 NUMPAD_COMMA
|
||||
key 122 KANA
|
||||
key 123 EISU
|
||||
key 124 YEN
|
||||
key 125 META_LEFT
|
||||
key 126 META_RIGHT
|
||||
key 127 MENU
|
||||
key 128 MEDIA_STOP
|
||||
# key 129 "KEY_AGAIN"
|
||||
# key 130 "KEY_PROPS"
|
||||
# key 131 "KEY_UNDO"
|
||||
# key 132 "KEY_FRONT"
|
||||
key 133 COPY
|
||||
# key 134 "KEY_OPEN"
|
||||
key 135 PASTE
|
||||
# key 136 "KEY_FIND"
|
||||
key 137 CUT
|
||||
# key 138 "KEY_HELP"
|
||||
key 139 MENU
|
||||
key 140 CALCULATOR
|
||||
# key 141 "KEY_SETUP"
|
||||
key 142 SLEEP
|
||||
key 143 WAKEUP
|
||||
# key 144 "KEY_FILE"
|
||||
# key 145 "KEY_SENDFILE"
|
||||
# key 146 "KEY_DELETEFILE"
|
||||
# key 147 "KEY_XFER"
|
||||
# key 148 "KEY_PROG1"
|
||||
# key 149 "KEY_PROG2"
|
||||
key 150 EXPLORER
|
||||
# key 151 "KEY_MSDOS"
|
||||
key 152 POWER
|
||||
# key 153 "KEY_DIRECTION"
|
||||
# key 154 "KEY_CYCLEWINDOWS"
|
||||
key 155 ENVELOPE
|
||||
key 156 BOOKMARK
|
||||
# key 157 "KEY_COMPUTER"
|
||||
key 158 BACK
|
||||
key 159 FORWARD
|
||||
key 160 MEDIA_CLOSE
|
||||
key 161 MEDIA_EJECT
|
||||
key 162 MEDIA_EJECT
|
||||
key 163 MEDIA_NEXT
|
||||
key 164 MEDIA_PLAY_PAUSE
|
||||
key 165 MEDIA_PREVIOUS
|
||||
key 166 MEDIA_STOP
|
||||
key 167 MEDIA_RECORD
|
||||
key 168 MEDIA_REWIND
|
||||
key 169 CALL
|
||||
# key 170 "KEY_ISO"
|
||||
key 171 MUSIC
|
||||
key 172 HOME
|
||||
key 173 REFRESH
|
||||
# key 174 "KEY_EXIT"
|
||||
# key 175 "KEY_MOVE"
|
||||
# key 176 "KEY_EDIT"
|
||||
key 177 PAGE_UP
|
||||
key 178 PAGE_DOWN
|
||||
key 179 NUMPAD_LEFT_PAREN
|
||||
key 180 NUMPAD_RIGHT_PAREN
|
||||
# key 181 "KEY_NEW"
|
||||
# key 182 "KEY_REDO"
|
||||
# key 183 F13
|
||||
# key 184 F14
|
||||
# key 185 F15
|
||||
# key 186 F16
|
||||
# key 187 F17
|
||||
# key 188 F18
|
||||
# key 189 F19
|
||||
# key 190 F20
|
||||
# key 191 F21
|
||||
# key 192 F22
|
||||
# key 193 F23
|
||||
# key 194 F24
|
||||
# key 195 (undefined)
|
||||
# key 196 (undefined)
|
||||
# key 197 (undefined)
|
||||
# key 198 (undefined)
|
||||
# key 199 (undefined)
|
||||
key 200 MEDIA_PLAY
|
||||
key 201 MEDIA_PAUSE
|
||||
# key 202 "KEY_PROG3"
|
||||
# key 203 "KEY_PROG4"
|
||||
key 204 NOTIFICATION
|
||||
# key 205 "KEY_SUSPEND"
|
||||
# key 206 "KEY_CLOSE"
|
||||
key 207 MEDIA_PLAY
|
||||
key 208 MEDIA_FAST_FORWARD
|
||||
# key 209 "KEY_BASSBOOST"
|
||||
# key 210 "KEY_PRINT"
|
||||
# key 211 "KEY_HP"
|
||||
key 212 CAMERA
|
||||
key 213 MUSIC
|
||||
# key 214 "KEY_QUESTION"
|
||||
key 215 ENVELOPE
|
||||
# key 216 "KEY_CHAT"
|
||||
key 217 ASSIST
|
||||
# key 218 "KEY_CONNECT"
|
||||
# key 219 "KEY_FINANCE"
|
||||
# key 220 "KEY_SPORT"
|
||||
# key 221 "KEY_SHOP"
|
||||
# key 222 "KEY_ALTERASE"
|
||||
# key 223 "KEY_CANCEL"
|
||||
key 224 BRIGHTNESS_DOWN
|
||||
key 225 BRIGHTNESS_UP
|
||||
key 226 HEADSETHOOK
|
||||
|
||||
key 256 BUTTON_1
|
||||
key 257 BUTTON_2
|
||||
key 258 BUTTON_3
|
||||
key 259 BUTTON_4
|
||||
key 260 BUTTON_5
|
||||
key 261 BUTTON_6
|
||||
key 262 BUTTON_7
|
||||
key 263 BUTTON_8
|
||||
key 264 BUTTON_9
|
||||
key 265 BUTTON_10
|
||||
key 266 BUTTON_11
|
||||
key 267 BUTTON_12
|
||||
key 268 BUTTON_13
|
||||
key 269 BUTTON_14
|
||||
key 270 BUTTON_15
|
||||
key 271 BUTTON_16
|
||||
|
||||
key 288 BUTTON_1
|
||||
key 289 BUTTON_2
|
||||
key 290 BUTTON_3
|
||||
key 291 BUTTON_4
|
||||
key 292 BUTTON_5
|
||||
key 293 BUTTON_6
|
||||
key 294 BUTTON_7
|
||||
key 295 BUTTON_8
|
||||
key 296 BUTTON_9
|
||||
key 297 BUTTON_10
|
||||
key 298 BUTTON_11
|
||||
key 299 BUTTON_12
|
||||
key 300 BUTTON_13
|
||||
key 301 BUTTON_14
|
||||
key 302 BUTTON_15
|
||||
key 303 BUTTON_16
|
||||
|
||||
|
||||
key 304 BUTTON_A
|
||||
key 305 BUTTON_B
|
||||
key 306 BUTTON_C
|
||||
key 307 BUTTON_X
|
||||
key 308 BUTTON_Y
|
||||
key 309 BUTTON_Z
|
||||
key 310 BUTTON_L1
|
||||
key 311 BUTTON_R1
|
||||
key 312 BUTTON_L2
|
||||
key 313 BUTTON_R2
|
||||
key 314 BUTTON_SELECT
|
||||
key 315 BUTTON_START
|
||||
key 316 BUTTON_MODE
|
||||
key 317 BUTTON_THUMBL
|
||||
key 318 BUTTON_THUMBR
|
||||
|
||||
|
||||
# key 352 "KEY_OK"
|
||||
key 353 DPAD_CENTER
|
||||
# key 354 "KEY_GOTO"
|
||||
# key 355 "KEY_CLEAR"
|
||||
# key 356 "KEY_POWER2"
|
||||
# key 357 "KEY_OPTION"
|
||||
# key 358 "KEY_INFO"
|
||||
# key 359 "KEY_TIME"
|
||||
# key 360 "KEY_VENDOR"
|
||||
# key 361 "KEY_ARCHIVE"
|
||||
key 362 GUIDE
|
||||
# key 363 "KEY_CHANNEL"
|
||||
# key 364 "KEY_FAVORITES"
|
||||
# key 365 "KEY_EPG"
|
||||
key 366 DVR
|
||||
# key 367 "KEY_MHP"
|
||||
# key 368 "KEY_LANGUAGE"
|
||||
# key 369 "KEY_TITLE"
|
||||
key 370 CAPTIONS
|
||||
# key 371 "KEY_ANGLE"
|
||||
# key 372 "KEY_ZOOM"
|
||||
# key 373 "KEY_MODE"
|
||||
# key 374 "KEY_KEYBOARD"
|
||||
# key 375 "KEY_SCREEN"
|
||||
# key 376 "KEY_PC"
|
||||
key 377 TV
|
||||
# key 378 "KEY_TV2"
|
||||
# key 379 "KEY_VCR"
|
||||
# key 380 "KEY_VCR2"
|
||||
# key 381 "KEY_SAT"
|
||||
# key 382 "KEY_SAT2"
|
||||
# key 383 "KEY_CD"
|
||||
# key 384 "KEY_TAPE"
|
||||
# key 385 "KEY_RADIO"
|
||||
# key 386 "KEY_TUNER"
|
||||
# key 387 "KEY_PLAYER"
|
||||
# key 388 "KEY_TEXT"
|
||||
# key 389 "KEY_DVD"
|
||||
# key 390 "KEY_AUX"
|
||||
# key 391 "KEY_MP3"
|
||||
# key 392 "KEY_AUDIO"
|
||||
# key 393 "KEY_VIDEO"
|
||||
# key 394 "KEY_DIRECTORY"
|
||||
# key 395 "KEY_LIST"
|
||||
# key 396 "KEY_MEMO"
|
||||
key 397 CALENDAR
|
||||
key 398 PROG_RED
|
||||
key 399 PROG_GREEN
|
||||
key 400 PROG_YELLOW
|
||||
key 401 PROG_BLUE
|
||||
key 402 CHANNEL_UP
|
||||
key 403 CHANNEL_DOWN
|
||||
# key 404 "KEY_FIRST"
|
||||
key 405 LAST_CHANNEL
|
||||
# key 406 "KEY_AB"
|
||||
# key 407 "KEY_NEXT"
|
||||
# key 408 "KEY_RESTART"
|
||||
# key 409 "KEY_SLOW"
|
||||
# key 410 "KEY_SHUFFLE"
|
||||
# key 411 "KEY_BREAK"
|
||||
# key 412 "KEY_PREVIOUS"
|
||||
# key 413 "KEY_DIGITS"
|
||||
# key 414 "KEY_TEEN"
|
||||
# key 415 "KEY_TWEN"
|
||||
|
||||
key 429 CONTACTS
|
||||
|
||||
# key 448 "KEY_DEL_EOL"
|
||||
# key 449 "KEY_DEL_EOS"
|
||||
# key 450 "KEY_INS_LINE"
|
||||
# key 451 "KEY_DEL_LINE"
|
||||
|
||||
|
||||
key 464 FUNCTION
|
||||
key 465 ESCAPE FUNCTION
|
||||
key 466 F1 FUNCTION
|
||||
key 467 F2 FUNCTION
|
||||
key 468 F3 FUNCTION
|
||||
key 469 F4 FUNCTION
|
||||
key 470 F5 FUNCTION
|
||||
key 471 F6 FUNCTION
|
||||
key 472 F7 FUNCTION
|
||||
key 473 F8 FUNCTION
|
||||
key 474 F9 FUNCTION
|
||||
key 475 F10 FUNCTION
|
||||
key 476 F11 FUNCTION
|
||||
key 477 F12 FUNCTION
|
||||
key 478 1 FUNCTION
|
||||
key 479 2 FUNCTION
|
||||
key 480 D FUNCTION
|
||||
key 481 E FUNCTION
|
||||
key 482 F FUNCTION
|
||||
key 483 S FUNCTION
|
||||
key 484 B FUNCTION
|
||||
|
||||
|
||||
# key 497 KEY_BRL_DOT1
|
||||
# key 498 KEY_BRL_DOT2
|
||||
# key 499 KEY_BRL_DOT3
|
||||
# key 500 KEY_BRL_DOT4
|
||||
# key 501 KEY_BRL_DOT5
|
||||
# key 502 KEY_BRL_DOT6
|
||||
# key 503 KEY_BRL_DOT7
|
||||
# key 504 KEY_BRL_DOT8
|
||||
|
||||
key 522 STAR
|
||||
key 523 POUND
|
||||
key 580 APP_SWITCH
|
||||
key 582 VOICE_ASSIST
|
||||
|
||||
# CEC
|
||||
key 352 ENTER
|
||||
key 618 HOME
|
||||
key 141 POWER
|
||||
key 174 BACK
|
||||
|
||||
# Keys defined by HID usages
|
||||
key usage 0x0c0067 WINDOW
|
||||
key usage 0x0c006F BRIGHTNESS_UP
|
||||
key usage 0x0c0070 BRIGHTNESS_DOWN
|
||||
key usage 0x0c0173 MEDIA_AUDIO_TRACK
|
||||
|
||||
# Joystick and game controller axes.
|
||||
# Axes that are not mapped will be assigned generic axis numbers by the input subsystem.
|
||||
axis 0x00 X
|
||||
axis 0x01 Y
|
||||
axis 0x02 Z
|
||||
axis 0x03 RX
|
||||
axis 0x04 RY
|
||||
axis 0x05 RZ
|
||||
axis 0x06 THROTTLE
|
||||
axis 0x07 RUDDER
|
||||
axis 0x08 WHEEL
|
||||
axis 0x09 GAS
|
||||
axis 0x0a BRAKE
|
||||
axis 0x10 HAT_X
|
||||
axis 0x11 HAT_Y
|
||||
|
||||
# LEDs
|
||||
led 0x00 NUM_LOCK
|
||||
led 0x01 CAPS_LOCK
|
||||
led 0x02 SCROLL_LOCK
|
||||
led 0x03 COMPOSE
|
||||
led 0x04 KANA
|
||||
led 0x05 SLEEP
|
||||
led 0x06 SUSPEND
|
||||
led 0x07 MUTE
|
||||
led 0x08 MISC
|
||||
led 0x09 MAIL
|
||||
led 0x0a CHARGING
|
||||
|
||||
# SENSORs
|
||||
sensor 0x00 ACCELEROMETER X
|
||||
sensor 0x01 ACCELEROMETER Y
|
||||
sensor 0x02 ACCELEROMETER Z
|
||||
sensor 0x03 GYROSCOPE X
|
||||
sensor 0x04 GYROSCOPE Y
|
||||
sensor 0x05 GYROSCOPE Z
|
502
keylayout/Generic.kl
Normal file
502
keylayout/Generic.kl
Normal file
@@ -0,0 +1,502 @@
|
||||
# Copyright (C) 2010 The Android Open Source Project
|
||||
#
|
||||
# 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.
|
||||
|
||||
#
|
||||
# Generic key layout file for full alphabetic US English PC style external keyboards.
|
||||
#
|
||||
# This file is intentionally very generic and is intended to support a broad range of keyboards.
|
||||
# Do not edit the generic key layout to support a specific keyboard; instead, create
|
||||
# a new key layout file with the required keyboard configuration.
|
||||
#
|
||||
|
||||
key 1 ESCAPE
|
||||
key 2 1
|
||||
key 3 2
|
||||
key 4 3
|
||||
key 5 4
|
||||
key 6 5
|
||||
key 7 6
|
||||
key 8 7
|
||||
key 9 8
|
||||
key 10 9
|
||||
key 11 0
|
||||
key 12 MINUS
|
||||
key 13 EQUALS
|
||||
key 14 DEL
|
||||
key 15 TAB
|
||||
key 16 Q
|
||||
key 17 W
|
||||
key 18 E
|
||||
key 19 R
|
||||
key 20 T
|
||||
key 21 Y
|
||||
key 22 U
|
||||
key 23 I
|
||||
key 24 O
|
||||
key 25 P
|
||||
key 26 LEFT_BRACKET
|
||||
key 27 RIGHT_BRACKET
|
||||
key 28 ENTER
|
||||
key 29 CTRL_LEFT
|
||||
key 30 A
|
||||
key 31 S
|
||||
key 32 D
|
||||
key 33 F
|
||||
key 34 G
|
||||
key 35 H
|
||||
key 36 J
|
||||
key 37 K
|
||||
key 38 L
|
||||
key 39 SEMICOLON
|
||||
key 40 APOSTROPHE
|
||||
key 41 GRAVE
|
||||
key 42 SHIFT_LEFT
|
||||
key 43 BACKSLASH
|
||||
key 44 Z
|
||||
key 45 X
|
||||
key 46 C
|
||||
key 47 V
|
||||
key 48 B
|
||||
key 49 N
|
||||
key 50 M
|
||||
key 51 COMMA
|
||||
key 52 PERIOD
|
||||
key 53 SLASH
|
||||
key 54 SHIFT_RIGHT
|
||||
key 55 NUMPAD_MULTIPLY
|
||||
key 56 ALT_LEFT
|
||||
key 57 SPACE
|
||||
key 58 CAPS_LOCK
|
||||
key 59 F1
|
||||
key 60 F2
|
||||
key 61 F3
|
||||
key 62 F4
|
||||
key 63 F5
|
||||
key 64 F6
|
||||
key 65 F7
|
||||
key 66 F8
|
||||
key 67 F9
|
||||
key 68 F10
|
||||
key 69 NUM_LOCK
|
||||
key 70 SCROLL_LOCK
|
||||
key 71 NUMPAD_7
|
||||
key 72 NUMPAD_8
|
||||
key 73 NUMPAD_9
|
||||
key 74 NUMPAD_SUBTRACT
|
||||
key 75 NUMPAD_4
|
||||
key 76 NUMPAD_5
|
||||
key 77 NUMPAD_6
|
||||
key 78 NUMPAD_ADD
|
||||
key 79 NUMPAD_1
|
||||
key 80 NUMPAD_2
|
||||
key 81 NUMPAD_3
|
||||
key 82 NUMPAD_0
|
||||
key 83 NUMPAD_DOT
|
||||
# key 84 (undefined)
|
||||
key 85 ZENKAKU_HANKAKU
|
||||
key 86 BACKSLASH
|
||||
key 87 F11
|
||||
key 88 F12
|
||||
key 89 RO
|
||||
# key 90 "KEY_KATAKANA"
|
||||
# key 91 "KEY_HIRAGANA"
|
||||
key 92 HENKAN
|
||||
key 93 KATAKANA_HIRAGANA
|
||||
key 94 MUHENKAN
|
||||
key 95 NUMPAD_COMMA
|
||||
key 96 NUMPAD_ENTER
|
||||
key 97 CTRL_RIGHT
|
||||
key 98 NUMPAD_DIVIDE
|
||||
key 99 SYSRQ
|
||||
key 100 ALT_RIGHT
|
||||
# key 101 "KEY_LINEFEED"
|
||||
key 102 MOVE_HOME
|
||||
key 103 DPAD_UP
|
||||
key 104 PAGE_UP
|
||||
key 105 DPAD_LEFT
|
||||
key 106 DPAD_RIGHT
|
||||
key 107 MOVE_END
|
||||
key 108 DPAD_DOWN
|
||||
key 109 PAGE_DOWN
|
||||
key 110 INSERT
|
||||
key 111 FORWARD_DEL
|
||||
# key 112 "KEY_MACRO"
|
||||
key 113 VOLUME_MUTE
|
||||
key 114 VOLUME_DOWN
|
||||
key 115 VOLUME_UP
|
||||
key 116 POWER
|
||||
key 117 NUMPAD_EQUALS
|
||||
# key 118 "KEY_KPPLUSMINUS"
|
||||
key 119 BREAK
|
||||
key 120 RECENT_APPS
|
||||
key 121 NUMPAD_COMMA
|
||||
key 122 KANA
|
||||
key 123 EISU
|
||||
key 124 YEN
|
||||
key 125 META_LEFT
|
||||
key 126 META_RIGHT
|
||||
key 127 MENU
|
||||
key 128 MEDIA_STOP
|
||||
# key 129 "KEY_AGAIN"
|
||||
# key 130 "KEY_PROPS"
|
||||
# key 131 "KEY_UNDO"
|
||||
# key 132 "KEY_FRONT"
|
||||
key 133 COPY
|
||||
# key 134 "KEY_OPEN"
|
||||
key 135 PASTE
|
||||
# key 136 "KEY_FIND"
|
||||
key 137 CUT
|
||||
# key 138 "KEY_HELP"
|
||||
key 139 MENU
|
||||
key 140 CALCULATOR
|
||||
# key 141 "KEY_SETUP"
|
||||
key 142 SLEEP
|
||||
key 143 WAKEUP
|
||||
# key 144 "KEY_FILE"
|
||||
# key 145 "KEY_SENDFILE"
|
||||
# key 146 "KEY_DELETEFILE"
|
||||
# key 147 "KEY_XFER"
|
||||
# key 148 "KEY_PROG1"
|
||||
# key 149 "KEY_PROG2"
|
||||
key 150 EXPLORER
|
||||
# key 151 "KEY_MSDOS"
|
||||
key 152 LOCK
|
||||
# key 153 "KEY_DIRECTION"
|
||||
# key 154 "KEY_CYCLEWINDOWS"
|
||||
key 155 ENVELOPE
|
||||
key 156 BOOKMARK
|
||||
# key 157 "KEY_COMPUTER"
|
||||
key 158 BACK
|
||||
key 159 FORWARD
|
||||
key 160 MEDIA_CLOSE
|
||||
key 161 MEDIA_EJECT
|
||||
key 162 MEDIA_EJECT
|
||||
key 163 MEDIA_NEXT
|
||||
key 164 MEDIA_PLAY_PAUSE
|
||||
key 165 MEDIA_PREVIOUS
|
||||
key 166 MEDIA_STOP
|
||||
key 167 MEDIA_RECORD
|
||||
key 168 MEDIA_REWIND
|
||||
key 169 CALL
|
||||
# key 170 "KEY_ISO"
|
||||
key 171 MUSIC
|
||||
key 172 HOME
|
||||
key 173 REFRESH
|
||||
# key 174 "KEY_EXIT"
|
||||
# key 175 "KEY_MOVE"
|
||||
# key 176 "KEY_EDIT"
|
||||
key 177 PAGE_UP
|
||||
key 178 PAGE_DOWN
|
||||
key 179 NUMPAD_LEFT_PAREN
|
||||
key 180 NUMPAD_RIGHT_PAREN
|
||||
key 181 NEW
|
||||
# key 182 "KEY_REDO"
|
||||
key 183 F13
|
||||
key 184 F14
|
||||
key 185 F15
|
||||
key 186 F16
|
||||
key 187 F17
|
||||
key 188 F18
|
||||
key 189 F19
|
||||
key 190 F20
|
||||
key 191 F21
|
||||
key 192 F22
|
||||
key 193 F23
|
||||
key 194 F24
|
||||
# key 195 (undefined)
|
||||
# key 196 (undefined)
|
||||
# key 197 (undefined)
|
||||
# key 198 (undefined)
|
||||
# key 199 (undefined)
|
||||
key 200 MEDIA_PLAY
|
||||
key 201 MEDIA_PAUSE
|
||||
# key 202 "KEY_PROG3"
|
||||
# key 203 "KEY_PROG4"
|
||||
key 204 NOTIFICATION
|
||||
# key 205 "KEY_SUSPEND"
|
||||
key 206 CLOSE
|
||||
key 207 MEDIA_PLAY
|
||||
key 208 MEDIA_FAST_FORWARD
|
||||
# key 209 "KEY_BASSBOOST"
|
||||
key 210 PRINT
|
||||
# key 211 "KEY_HP"
|
||||
key 212 CAMERA
|
||||
key 213 MUSIC
|
||||
# key 214 "KEY_QUESTION"
|
||||
key 215 ENVELOPE
|
||||
# key 216 "KEY_CHAT"
|
||||
key 217 SEARCH
|
||||
# key 218 "KEY_CONNECT"
|
||||
# key 219 "KEY_FINANCE"
|
||||
# key 220 "KEY_SPORT"
|
||||
# key 221 "KEY_SHOP"
|
||||
# key 222 "KEY_ALTERASE"
|
||||
# key 223 "KEY_CANCEL"
|
||||
key 224 BRIGHTNESS_DOWN
|
||||
key 225 BRIGHTNESS_UP
|
||||
key 226 HEADSETHOOK
|
||||
key 228 KEYBOARD_BACKLIGHT_TOGGLE
|
||||
key 229 KEYBOARD_BACKLIGHT_DOWN
|
||||
key 230 KEYBOARD_BACKLIGHT_UP
|
||||
key 248 MUTE
|
||||
|
||||
key 256 BUTTON_1
|
||||
key 257 BUTTON_2
|
||||
key 258 BUTTON_3
|
||||
key 259 BUTTON_4
|
||||
key 260 BUTTON_5
|
||||
key 261 BUTTON_6
|
||||
key 262 BUTTON_7
|
||||
key 263 BUTTON_8
|
||||
key 264 BUTTON_9
|
||||
key 265 BUTTON_10
|
||||
key 266 BUTTON_11
|
||||
key 267 BUTTON_12
|
||||
key 268 BUTTON_13
|
||||
key 269 BUTTON_14
|
||||
key 270 BUTTON_15
|
||||
key 271 BUTTON_16
|
||||
|
||||
key 288 BUTTON_1
|
||||
key 289 BUTTON_2
|
||||
key 290 BUTTON_3
|
||||
key 291 BUTTON_4
|
||||
key 292 BUTTON_5
|
||||
key 293 BUTTON_6
|
||||
key 294 BUTTON_7
|
||||
key 295 BUTTON_8
|
||||
key 296 BUTTON_9
|
||||
key 297 BUTTON_10
|
||||
key 298 BUTTON_11
|
||||
key 299 BUTTON_12
|
||||
key 300 BUTTON_13
|
||||
key 301 BUTTON_14
|
||||
key 302 BUTTON_15
|
||||
key 303 BUTTON_16
|
||||
|
||||
|
||||
key 304 BUTTON_A
|
||||
key 305 BUTTON_B
|
||||
key 306 BUTTON_C
|
||||
key 307 BUTTON_X
|
||||
key 308 BUTTON_Y
|
||||
key 309 BUTTON_Z
|
||||
key 310 BUTTON_L1
|
||||
key 311 BUTTON_R1
|
||||
key 312 BUTTON_L2
|
||||
key 313 BUTTON_R2
|
||||
key 314 BUTTON_SELECT
|
||||
key 315 BUTTON_START
|
||||
key 316 BUTTON_MODE
|
||||
key 317 BUTTON_THUMBL
|
||||
key 318 BUTTON_THUMBR
|
||||
|
||||
|
||||
key 329 STYLUS_BUTTON_TERTIARY
|
||||
key 331 STYLUS_BUTTON_PRIMARY
|
||||
key 332 STYLUS_BUTTON_SECONDARY
|
||||
|
||||
|
||||
# key 352 "KEY_OK"
|
||||
key 353 DPAD_CENTER
|
||||
# key 354 "KEY_GOTO"
|
||||
# key 355 "KEY_CLEAR"
|
||||
# key 356 "KEY_POWER2"
|
||||
# key 357 "KEY_OPTION"
|
||||
# key 358 "KEY_INFO"
|
||||
# key 359 "KEY_TIME"
|
||||
# key 360 "KEY_VENDOR"
|
||||
# key 361 "KEY_ARCHIVE"
|
||||
key 362 GUIDE
|
||||
# key 363 "KEY_CHANNEL"
|
||||
# key 364 "KEY_FAVORITES"
|
||||
# key 365 "KEY_EPG"
|
||||
key 366 DVR
|
||||
# key 367 "KEY_MHP"
|
||||
key 368 LANGUAGE_SWITCH
|
||||
# key 369 "KEY_TITLE"
|
||||
key 370 CAPTIONS
|
||||
# key 371 "KEY_ANGLE"
|
||||
key 372 FULLSCREEN
|
||||
# key 373 "KEY_MODE"
|
||||
# key 374 "KEY_KEYBOARD"
|
||||
# key 375 "KEY_SCREEN"
|
||||
# key 376 "KEY_PC"
|
||||
key 377 TV
|
||||
# key 378 "KEY_TV2"
|
||||
# key 379 "KEY_VCR"
|
||||
# key 380 "KEY_VCR2"
|
||||
# key 381 "KEY_SAT"
|
||||
# key 382 "KEY_SAT2"
|
||||
# key 383 "KEY_CD"
|
||||
# key 384 "KEY_TAPE"
|
||||
# key 385 "KEY_RADIO"
|
||||
# key 386 "KEY_TUNER"
|
||||
# key 387 "KEY_PLAYER"
|
||||
# key 388 "KEY_TEXT"
|
||||
# key 389 "KEY_DVD"
|
||||
# key 390 "KEY_AUX"
|
||||
# key 391 "KEY_MP3"
|
||||
# key 392 "KEY_AUDIO"
|
||||
# key 393 "KEY_VIDEO"
|
||||
# key 394 "KEY_DIRECTORY"
|
||||
# key 395 "KEY_LIST"
|
||||
# key 396 "KEY_MEMO"
|
||||
key 397 CALENDAR
|
||||
key 398 PROG_RED
|
||||
key 399 PROG_GREEN
|
||||
key 400 PROG_YELLOW
|
||||
key 401 PROG_BLUE
|
||||
key 402 CHANNEL_UP
|
||||
key 403 CHANNEL_DOWN
|
||||
# key 404 "KEY_FIRST"
|
||||
key 405 LAST_CHANNEL
|
||||
# key 406 "KEY_AB"
|
||||
# key 407 "KEY_NEXT"
|
||||
# key 408 "KEY_RESTART"
|
||||
# key 409 "KEY_SLOW"
|
||||
# key 410 "KEY_SHUFFLE"
|
||||
# key 411 "KEY_BREAK"
|
||||
# key 412 "KEY_PREVIOUS"
|
||||
# key 413 "KEY_DIGITS"
|
||||
# key 414 "KEY_TEEN"
|
||||
# key 415 "KEY_TWEN"
|
||||
# key 418 "KEY_ZOOM_IN"
|
||||
key 418 ZOOM_IN
|
||||
# key 419 "KEY_ZOOM_OUT"
|
||||
key 419 ZOOM_OUT
|
||||
key 528 FOCUS
|
||||
|
||||
key 429 CONTACTS
|
||||
|
||||
# key 448 "KEY_DEL_EOL"
|
||||
# key 449 "KEY_DEL_EOS"
|
||||
# key 450 "KEY_INS_LINE"
|
||||
# key 451 "KEY_DEL_LINE"
|
||||
|
||||
|
||||
key 464 FUNCTION
|
||||
key 465 ESCAPE FUNCTION
|
||||
key 466 F1 FUNCTION
|
||||
key 467 F2 FUNCTION
|
||||
key 468 F3 FUNCTION
|
||||
key 469 F4 FUNCTION
|
||||
key 470 F5 FUNCTION
|
||||
key 471 F6 FUNCTION
|
||||
key 472 F7 FUNCTION
|
||||
key 473 F8 FUNCTION
|
||||
key 474 F9 FUNCTION
|
||||
key 475 F10 FUNCTION
|
||||
key 476 F11 FUNCTION
|
||||
key 477 F12 FUNCTION
|
||||
key 478 1 FUNCTION
|
||||
key 479 2 FUNCTION
|
||||
key 480 D FUNCTION
|
||||
key 481 E FUNCTION
|
||||
key 482 F FUNCTION
|
||||
key 483 S FUNCTION
|
||||
key 484 B FUNCTION
|
||||
|
||||
|
||||
# key 497 KEY_BRL_DOT1
|
||||
# key 498 KEY_BRL_DOT2
|
||||
# key 499 KEY_BRL_DOT3
|
||||
# key 500 KEY_BRL_DOT4
|
||||
# key 501 KEY_BRL_DOT5
|
||||
# key 502 KEY_BRL_DOT6
|
||||
# key 503 KEY_BRL_DOT7
|
||||
# key 504 KEY_BRL_DOT8
|
||||
|
||||
key 522 STAR
|
||||
key 523 POUND
|
||||
key 580 APP_SWITCH
|
||||
key 582 VOICE_ASSIST
|
||||
# Linux KEY_ASSISTANT
|
||||
key 583 ASSIST
|
||||
key 585 EMOJI_PICKER
|
||||
key 586 DICTATE
|
||||
key 656 MACRO_1
|
||||
key 657 MACRO_2
|
||||
key 658 MACRO_3
|
||||
key 659 MACRO_4
|
||||
|
||||
# CEC
|
||||
key 352 ENTER
|
||||
key 618 HOME
|
||||
key 141 POWER
|
||||
key 174 BACK
|
||||
|
||||
# Keys defined by HID usages
|
||||
key usage 0x010082 LOCK FALLBACK_USAGE_MAPPING
|
||||
key usage 0x01009B DO_NOT_DISTURB FALLBACK_USAGE_MAPPING
|
||||
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 0x0c00D8 DICTATE 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 0x0c0201 NEW FALLBACK_USAGE_MAPPING
|
||||
key usage 0x0c0203 CLOSE FALLBACK_USAGE_MAPPING
|
||||
key usage 0x0c0208 PRINT FALLBACK_USAGE_MAPPING
|
||||
key usage 0x0c0227 REFRESH FALLBACK_USAGE_MAPPING
|
||||
key usage 0x0c0232 FULLSCREEN 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
|
||||
|
||||
# Joystick and game controller axes.
|
||||
# Axes that are not mapped will be assigned generic axis numbers by the input subsystem.
|
||||
axis 0x00 X
|
||||
axis 0x01 Y
|
||||
axis 0x02 Z
|
||||
axis 0x03 RX
|
||||
axis 0x04 RY
|
||||
axis 0x05 RZ
|
||||
axis 0x06 THROTTLE
|
||||
axis 0x07 RUDDER
|
||||
axis 0x08 WHEEL
|
||||
axis 0x09 RTRIGGER
|
||||
axis 0x0a LTRIGGER
|
||||
axis 0x10 HAT_X
|
||||
axis 0x11 HAT_Y
|
||||
|
||||
# LEDs
|
||||
led 0x00 NUM_LOCK
|
||||
led 0x01 CAPS_LOCK
|
||||
led 0x02 SCROLL_LOCK
|
||||
led 0x03 COMPOSE
|
||||
led 0x04 KANA
|
||||
led 0x05 SLEEP
|
||||
led 0x06 SUSPEND
|
||||
led 0x07 MUTE
|
||||
led 0x08 MISC
|
||||
led 0x09 MAIL
|
||||
led 0x0a CHARGING
|
||||
|
||||
# SENSORs
|
||||
sensor 0x00 ACCELEROMETER X
|
||||
sensor 0x01 ACCELEROMETER Y
|
||||
sensor 0x02 ACCELEROMETER Z
|
||||
sensor 0x03 GYROSCOPE X
|
||||
sensor 0x04 GYROSCOPE Y
|
||||
sensor 0x05 GYROSCOPE Z
|
@@ -1,24 +1,49 @@
|
||||
// Copyright (C) 2018 The LineageOS Project
|
||||
// Copyright (C) 2021-2022 KonstaKANG
|
||||
// Copyright (C) 2020 The Android Open Source Project
|
||||
// Copyright (C) 2023 KonstaKANG
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
cc_binary {
|
||||
name: "android.hardware.light@2.0-service.rpi",
|
||||
init_rc: ["android.hardware.light@2.0-service.rpi.rc"],
|
||||
vintf_fragments: ["android.hardware.light@2.0-service.rpi.xml"],
|
||||
proprietary: true,
|
||||
name: "android.hardware.light-service.rpi",
|
||||
relative_install_path: "hw",
|
||||
vendor: true,
|
||||
srcs: [
|
||||
"Light.cpp",
|
||||
"service.cpp",
|
||||
"Lights.cpp",
|
||||
"main.cpp",
|
||||
],
|
||||
shared_libs: [
|
||||
"android.hardware.light-V2-ndk",
|
||||
"libbase",
|
||||
"libcutils",
|
||||
"libhardware",
|
||||
"libhidlbase",
|
||||
"libutils",
|
||||
"android.hardware.light@2.0",
|
||||
"libbinder_ndk",
|
||||
],
|
||||
installable: false,
|
||||
}
|
||||
|
||||
prebuilt_etc {
|
||||
name: "android.hardware.light-service.rpi.rc",
|
||||
src: "android.hardware.light-service.rpi.rc",
|
||||
installable: false,
|
||||
}
|
||||
|
||||
prebuilt_etc {
|
||||
name: "android.hardware.light-service.rpi.xml",
|
||||
src: "android.hardware.light-service.rpi.xml",
|
||||
sub_dir: "vintf",
|
||||
installable: false,
|
||||
}
|
||||
|
||||
apex {
|
||||
name: "com.android.hardware.light.rpi4",
|
||||
manifest: "apex_manifest.json",
|
||||
file_contexts: "apex_file_contexts",
|
||||
key: "com.android.hardware.key",
|
||||
certificate: ":com.android.hardware.certificate",
|
||||
updatable: false,
|
||||
vendor: true,
|
||||
|
||||
binaries: ["android.hardware.light-service.rpi"],
|
||||
prebuilts: [
|
||||
"android.hardware.light-service.rpi.rc",
|
||||
"android.hardware.light-service.rpi.xml",
|
||||
],
|
||||
}
|
||||
|
@@ -1,93 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 The LineageOS Project
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "LightService"
|
||||
|
||||
#include "Light.h"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
|
||||
namespace {
|
||||
using android::hardware::light::V2_0::LightState;
|
||||
|
||||
static constexpr int DEFAULT_MAX_BRIGHTNESS = 255;
|
||||
|
||||
static uint32_t rgbToBrightness(const LightState& state) {
|
||||
uint32_t color = state.color & 0x00ffffff;
|
||||
return ((77 * ((color >> 16) & 0xff)) + (150 * ((color >> 8) & 0xff)) +
|
||||
(29 * (color & 0xff))) >> 8;
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace light {
|
||||
namespace V2_0 {
|
||||
namespace implementation {
|
||||
|
||||
Light::Light(std::pair<std::ofstream, uint32_t>&& lcd_backlight)
|
||||
: mLcdBacklight(std::move(lcd_backlight)) {
|
||||
auto backlightFn(std::bind(&Light::setLcdBacklight, this, std::placeholders::_1));
|
||||
mLights.emplace(std::make_pair(Type::BACKLIGHT, backlightFn));
|
||||
}
|
||||
|
||||
// Methods from ::android::hardware::light::V2_0::ILight follow.
|
||||
Return<Status> Light::setLight(Type type, const LightState& state) {
|
||||
auto it = mLights.find(type);
|
||||
|
||||
if (it == mLights.end()) {
|
||||
return Status::LIGHT_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
it->second(state);
|
||||
|
||||
return Status::SUCCESS;
|
||||
}
|
||||
|
||||
Return<void> Light::getSupportedTypes(getSupportedTypes_cb _hidl_cb) {
|
||||
std::vector<Type> types;
|
||||
|
||||
for (auto const& light : mLights) {
|
||||
types.push_back(light.first);
|
||||
}
|
||||
|
||||
_hidl_cb(types);
|
||||
|
||||
return Void();
|
||||
}
|
||||
|
||||
void Light::setLcdBacklight(const LightState& state) {
|
||||
std::lock_guard<std::mutex> lock(mLock);
|
||||
|
||||
uint32_t brightness = rgbToBrightness(state);
|
||||
|
||||
// If max panel brightness is not the default (255),
|
||||
// apply linear scaling across the accepted range.
|
||||
if (mLcdBacklight.second != DEFAULT_MAX_BRIGHTNESS) {
|
||||
int old_brightness = brightness;
|
||||
brightness = brightness * mLcdBacklight.second / DEFAULT_MAX_BRIGHTNESS;
|
||||
LOG(VERBOSE) << "scaling brightness " << old_brightness << " => " << brightness;
|
||||
}
|
||||
|
||||
mLcdBacklight.first << brightness << std::endl;
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V2_0
|
||||
} // namespace light
|
||||
} // namespace hardware
|
||||
} // namespace android
|
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 The LineageOS Project
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_LIGHT_V2_0_LIGHT_H
|
||||
#define ANDROID_HARDWARE_LIGHT_V2_0_LIGHT_H
|
||||
|
||||
#include <android/hardware/light/2.0/ILight.h>
|
||||
#include <hidl/Status.h>
|
||||
|
||||
#include <fstream>
|
||||
#include <mutex>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace light {
|
||||
namespace V2_0 {
|
||||
namespace implementation {
|
||||
|
||||
struct Light : public ILight {
|
||||
Light(std::pair<std::ofstream, uint32_t>&& lcd_backlight);
|
||||
|
||||
// Methods from ::android::hardware::light::V2_0::ILight follow.
|
||||
Return<Status> setLight(Type type, const LightState& state) override;
|
||||
Return<void> getSupportedTypes(getSupportedTypes_cb _hidl_cb) override;
|
||||
|
||||
private:
|
||||
void setLcdBacklight(const LightState& state);
|
||||
|
||||
std::pair<std::ofstream, uint32_t> mLcdBacklight;
|
||||
|
||||
std::unordered_map<Type, std::function<void(const LightState&)>> mLights;
|
||||
std::mutex mLock;
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V2_0
|
||||
} // namespace light
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // ANDROID_HARDWARE_LIGHT_V2_0_LIGHT_H
|
96
light/Lights.cpp
Normal file
96
light/Lights.cpp
Normal file
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Copyright (C) 2019 The Android Open Source Project
|
||||
* Copyright (C) 2023 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.light-service.rpi"
|
||||
|
||||
#include "Lights.h"
|
||||
|
||||
#include <android-base/file.h>
|
||||
#include <android-base/logging.h>
|
||||
|
||||
using ::android::base::ReadFileToString;
|
||||
using ::android::base::WriteStringToFile;
|
||||
|
||||
namespace aidl::android::hardware::light {
|
||||
|
||||
static const uint32_t defaultMaxBrightness = 255;
|
||||
|
||||
static const std::string backlightBasePath = "/sys/class/backlight/";
|
||||
|
||||
static const std::string backlightPaths[] = {
|
||||
"10-0045",
|
||||
"11-0045",
|
||||
"rpi_backlight",
|
||||
};
|
||||
|
||||
static const std::vector<HwLight> availableLights = {
|
||||
{.id = (int)LightType::BACKLIGHT, .type = LightType::BACKLIGHT, .ordinal = 0}
|
||||
};
|
||||
|
||||
Lights::Lights() {
|
||||
maxBrightness = defaultMaxBrightness;
|
||||
|
||||
for (auto &path : backlightPaths) {
|
||||
std::string backlightMaxBrightnessPath = backlightBasePath + path + "/max_brightness";
|
||||
if (!access(backlightMaxBrightnessPath.c_str(), R_OK)) {
|
||||
std::string maxBrightnessValue;
|
||||
if (ReadFileToString(backlightMaxBrightnessPath, &maxBrightnessValue)) {
|
||||
maxBrightness = std::stoi(maxBrightnessValue);
|
||||
LOG(INFO) << backlightMaxBrightnessPath << " = " << maxBrightnessValue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus Lights::setLightState(int id, const HwLightState& state) {
|
||||
HwLight const& light = availableLights[id];
|
||||
std::string const brightness = std::to_string(rgbToScaledBrightness(state, maxBrightness));
|
||||
|
||||
switch (light.type) {
|
||||
case LightType::BACKLIGHT:
|
||||
for (auto &path : backlightPaths) {
|
||||
std::string backlightBrightnessPath = backlightBasePath + path + "/brightness";
|
||||
if (!access(backlightBrightnessPath.c_str(), W_OK)) {
|
||||
WriteStringToFile(brightness, backlightBrightnessPath);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
|
||||
}
|
||||
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus Lights::getLights(std::vector<HwLight>* lights) {
|
||||
for (auto i = availableLights.begin(); i != availableLights.end(); i++) {
|
||||
lights->push_back(*i);
|
||||
}
|
||||
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
uint32_t Lights::rgbToScaledBrightness(const HwLightState& state, uint32_t maxBrightness) {
|
||||
uint32_t color = state.color & 0x00ffffff;
|
||||
uint32_t brightness = ((77 * ((color >> 16) & 0xff)) + (150 * ((color >> 8) & 0xff)) +
|
||||
(29 * (color & 0xff))) >> 8;
|
||||
return brightness * maxBrightness / 0xff;
|
||||
}
|
||||
|
||||
} // aidl::android::hardware::light
|
36
light/Lights.h
Normal file
36
light/Lights.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The Android Open Source Project
|
||||
* Copyright (C) 2023 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/light/BnLights.h>
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
} // aidl::android::hardware::light
|
19
light/android.hardware.light-service.rpi.rc
Normal file
19
light/android.hardware.light-service.rpi.rc
Normal file
@@ -0,0 +1,19 @@
|
||||
on early-boot
|
||||
chown system system /sys/class/backlight/10-0045/brightness
|
||||
chown system system /sys/class/backlight/10-0045/max_brightness
|
||||
chown system system /sys/class/backlight/11-0045/brightness
|
||||
chown system system /sys/class/backlight/11-0045/max_brightness
|
||||
chown system system /sys/class/backlight/rpi_backlight/brightness
|
||||
chown system system /sys/class/backlight/rpi_backlight/max_brightness
|
||||
chmod 660 /sys/class/backlight/10-0045/brightness
|
||||
chmod 440 /sys/class/backlight/10-0045/max_brightness
|
||||
chmod 660 /sys/class/backlight/11-0045/brightness
|
||||
chmod 440 /sys/class/backlight/11-0045/max_brightness
|
||||
chmod 660 /sys/class/backlight/rpi_backlight/brightness
|
||||
chmod 440 /sys/class/backlight/rpi_backlight/max_brightness
|
||||
|
||||
service vendor.light-rpi /apex/com.android.hardware.light.rpi4/bin/hw/android.hardware.light-service.rpi
|
||||
class hal
|
||||
user system
|
||||
group system
|
||||
shutdown critical
|
7
light/android.hardware.light-service.rpi.xml
Normal file
7
light/android.hardware.light-service.rpi.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<manifest version="1.0" type="device">
|
||||
<hal format="aidl">
|
||||
<name>android.hardware.light</name>
|
||||
<version>2</version>
|
||||
<fqname>ILights/default</fqname>
|
||||
</hal>
|
||||
</manifest>
|
@@ -1,11 +0,0 @@
|
||||
on init
|
||||
chown system system /sys/class/backlight/rpi_backlight/brightness
|
||||
chmod 660 /sys/class/backlight/rpi_backlight/brightness
|
||||
|
||||
service vendor.light-hal-2-0 /vendor/bin/hw/android.hardware.light@2.0-service.rpi
|
||||
interface android.hardware.light@2.0::ILight default
|
||||
class hal
|
||||
user system
|
||||
group system
|
||||
# shutting off lights while powering-off
|
||||
shutdown critical
|
@@ -1,11 +0,0 @@
|
||||
<manifest version="1.0" type="device">
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.light</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>2.0</version>
|
||||
<interface>
|
||||
<name>ILight</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
</manifest>
|
3
light/apex_file_contexts
Normal file
3
light/apex_file_contexts
Normal file
@@ -0,0 +1,3 @@
|
||||
(/.*)? u:object_r:vendor_file:s0
|
||||
/etc(/.*)? u:object_r:vendor_configs_file:s0
|
||||
/bin/hw/android\.hardware\.light-service\.rpi u:object_r:hal_light_default_exec:s0
|
4
light/apex_manifest.json
Normal file
4
light/apex_manifest.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"name": "com.android.hardware.light.rpi4",
|
||||
"version": 1
|
||||
}
|
36
light/main.cpp
Normal file
36
light/main.cpp
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
* Copyright (C) 2025 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.
|
||||
*/
|
||||
|
||||
#include "Lights.h"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <android/binder_manager.h>
|
||||
#include <android/binder_process.h>
|
||||
|
||||
using ::aidl::android::hardware::light::Lights;
|
||||
|
||||
int main() {
|
||||
ABinderProcess_setThreadPoolMaxThreadCount(0);
|
||||
std::shared_ptr<Lights> lights = ndk::SharedRefBase::make<Lights>();
|
||||
|
||||
const std::string instance = std::string() + Lights::descriptor + "/default";
|
||||
binder_status_t status = AServiceManager_addService(lights->asBinder().get(), instance.c_str());
|
||||
CHECK(status == STATUS_OK);
|
||||
|
||||
ABinderProcess_joinThreadPool();
|
||||
return EXIT_FAILURE; // should not reach
|
||||
}
|
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 The LineageOS Project
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "android.hardware.light@2.0-service.rpi"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <hidl/HidlTransportSupport.h>
|
||||
#include <utils/Errors.h>
|
||||
|
||||
#include "Light.h"
|
||||
|
||||
// libhwbinder:
|
||||
using android::hardware::configureRpcThreadpool;
|
||||
using android::hardware::joinRpcThreadpool;
|
||||
|
||||
// Generated HIDL files
|
||||
using android::hardware::light::V2_0::ILight;
|
||||
using android::hardware::light::V2_0::implementation::Light;
|
||||
|
||||
const static std::string kLcdBacklightPath = "/sys/class/backlight/rpi_backlight/brightness";
|
||||
|
||||
int main() {
|
||||
uint32_t lcdMaxBrightness = 255;
|
||||
|
||||
std::ofstream lcdBacklight(kLcdBacklightPath);
|
||||
if (!lcdBacklight) {
|
||||
LOG(ERROR) << "Failed to open " << kLcdBacklightPath << ", error=" << errno
|
||||
<< " (" << strerror(errno) << ")";
|
||||
//return -errno;
|
||||
}
|
||||
|
||||
android::sp<ILight> service = new Light(
|
||||
{std::move(lcdBacklight), lcdMaxBrightness});
|
||||
|
||||
configureRpcThreadpool(1, true);
|
||||
|
||||
android::status_t status = service->registerAsService();
|
||||
|
||||
if (status != android::OK) {
|
||||
LOG(ERROR) << "Cannot register Light HAL service";
|
||||
//return 1;
|
||||
}
|
||||
|
||||
LOG(INFO) << "Light HAL Ready.";
|
||||
joinRpcThreadpool();
|
||||
// Under normal cases, execution will not reach this line.
|
||||
LOG(ERROR) << "Light HAL failed to join thread pool.";
|
||||
return 1;
|
||||
}
|
82
manifest.xml
82
manifest.xml
@@ -1,8 +1,8 @@
|
||||
<manifest version="1.0" type="device" target-level="6">
|
||||
<manifest version="1.0" type="device" target-level="8">
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.audio</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>7.0</version>
|
||||
<version>7.1</version>
|
||||
<interface>
|
||||
<name>IDevicesFactory</name>
|
||||
<instance>default</instance>
|
||||
@@ -17,85 +17,13 @@
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.bluetooth</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>1.0</version>
|
||||
<interface>
|
||||
<name>IBluetoothHci</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.bluetooth.audio</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>2.0</version>
|
||||
<interface>
|
||||
<name>IBluetoothAudioProvidersFactory</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<hal format="aidl">
|
||||
<name>android.hardware.camera.provider</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>2.5</version>
|
||||
<version>1</version>
|
||||
<interface>
|
||||
<name>ICameraProvider</name>
|
||||
<instance>external/0</instance>
|
||||
<instance>legacy/0</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.drm</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>1.0</version>
|
||||
<interface>
|
||||
<name>ICryptoFactory</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
<interface>
|
||||
<name>IDrmFactory</name>
|
||||
<instance>default</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>
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.keymaster</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>3.0</version>
|
||||
<interface>
|
||||
<name>IKeymasterDevice</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.media.c2</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>1.0</version>
|
||||
<interface>
|
||||
<name>IComponentStore</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.media.omx</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>1.0</version>
|
||||
<interface>
|
||||
<name>IOmx</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
<interface>
|
||||
<name>IOmxStore</name>
|
||||
<instance>default</instance>
|
||||
<instance>libcamera/0</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
</manifest>
|
||||
|
@@ -17,7 +17,8 @@
|
||||
-->
|
||||
|
||||
<MediaCodecs>
|
||||
<!-- <Include href="media_codecs_v4l2_c2_video.xml" /> -->
|
||||
<Include href="media_codecs_ffmpeg_c2.xml" />
|
||||
<Include href="media_codecs_v4l2_c2_video.xml" />
|
||||
<Include href="media_codecs_google_c2_audio.xml" />
|
||||
<Include href="media_codecs_google_c2_tv.xml" />
|
||||
<Include href="media_codecs_google_c2_video.xml" />
|
||||
|
108
media/media_codecs_ffmpeg_c2.xml
Normal file
108
media/media_codecs_ffmpeg_c2.xml
Normal file
@@ -0,0 +1,108 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2022 Michael Goffioul <michael.goffioul@gmail.com>
|
||||
Copyright (C) 2025 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.
|
||||
-->
|
||||
|
||||
<MediaCodecs>
|
||||
<Decoders>
|
||||
<!-- Audio codecs -->
|
||||
<MediaCodec name="c2.ffmpeg.aac.decoder" type="audio/mp4a-latm">
|
||||
<Alias name="OMX.ffmpeg.aac.decoder" />
|
||||
<Limit name="channel-count" max="8" />
|
||||
<Limit name="sample-rate" ranges="8000-192000" />
|
||||
</MediaCodec>
|
||||
<MediaCodec name="c2.ffmpeg.ac3.decoder" type="audio/ac3">
|
||||
<Alias name="OMX.ffmpeg.ac3.decoder" />
|
||||
<Limit name="channel-count" max="8" />
|
||||
<Limit name="sample-rate" ranges="8000-192000" />
|
||||
</MediaCodec>
|
||||
<MediaCodec name="c2.ffmpeg.alac.decoder" type="audio/alac">
|
||||
<Alias name="OMX.ffmpeg.alac.decoder" />
|
||||
<Limit name="channel-count" max="8" />
|
||||
<Limit name="sample-rate" ranges="8000-192000" />
|
||||
</MediaCodec>
|
||||
<MediaCodec name="c2.ffmpeg.flac.decoder" type="audio/flac">
|
||||
<Alias name="OMX.ffmpeg.flac.decoder" />
|
||||
<Limit name="channel-count" max="8" />
|
||||
<Limit name="sample-rate" ranges="8000-192000" />
|
||||
</MediaCodec>
|
||||
<MediaCodec name="c2.ffmpeg.mp2.decoder" type="audio/mpeg-L2">
|
||||
<Alias name="OMX.ffmpeg.mp2.decoder" />
|
||||
<Limit name="channel-count" max="8" />
|
||||
<Limit name="sample-rate" ranges="8000-192000" />
|
||||
</MediaCodec>
|
||||
<MediaCodec name="c2.ffmpeg.mp3.decoder" type="audio/mpeg">
|
||||
<Alias name="OMX.ffmpeg.mp3.decoder" />
|
||||
<Limit name="channel-count" max="8" />
|
||||
<Limit name="sample-rate" ranges="8000-192000" />
|
||||
</MediaCodec>
|
||||
<MediaCodec name="c2.ffmpeg.vorbis.decoder" type="audio/vorbis">
|
||||
<Alias name="OMX.ffmpeg.vorbisac3.decoder" />
|
||||
<Limit name="channel-count" max="8" />
|
||||
<Limit name="sample-rate" ranges="8000-192000" />
|
||||
</MediaCodec>
|
||||
|
||||
<!-- Video codecs -->
|
||||
<MediaCodec name="c2.ffmpeg.av1.decoder" type="video/av01">
|
||||
<Alias name="OMX.ffmpeg.av1.decoder" />
|
||||
<Limit name="size" min="2x2" max="2048x2048" />
|
||||
<Limit name="alignment" value="2x2" />
|
||||
<Feature name="adaptive-playback" />
|
||||
</MediaCodec>
|
||||
<MediaCodec name="c2.ffmpeg.h263.decoder" type="video/3gpp">
|
||||
<Alias name="OMX.ffmpeg.h263.decoder" />
|
||||
<Limit name="size" min="2x2" max="2048x2048" />
|
||||
<Limit name="alignment" value="2x2" />
|
||||
<Feature name="adaptive-playback" />
|
||||
</MediaCodec>
|
||||
<MediaCodec name="c2.ffmpeg.h264.decoder" type="video/avc">
|
||||
<Alias name="OMX.ffmpeg.h264.decoder" />
|
||||
<Limit name="size" min="2x2" max="4080x4080" />
|
||||
<Limit name="alignment" value="2x2" />
|
||||
<Feature name="adaptive-playback" />
|
||||
</MediaCodec>
|
||||
<MediaCodec name="c2.ffmpeg.hevc.decoder" type="video/hevc">
|
||||
<Alias name="OMX.ffmpeg.hevc.decoder" />
|
||||
<Limit name="size" min="2x2" max="4096x4096" />
|
||||
<Limit name="alignment" value="2x2" />
|
||||
<Feature name="adaptive-playback" />
|
||||
</MediaCodec>
|
||||
<MediaCodec name="c2.ffmpeg.mpeg2.decoder" type="video/mpeg2">
|
||||
<Alias name="OMX.ffmpeg.mpeg2.decoder" />
|
||||
<Limit name="size" min="2x2" max="2048x2048" />
|
||||
<Limit name="alignment" value="2x2" />
|
||||
<Feature name="adaptive-playback" />
|
||||
</MediaCodec>
|
||||
<MediaCodec name="c2.ffmpeg.mpeg4.decoder" type="video/mp4v-es">
|
||||
<Alias name="OMX.ffmpeg.mpeg4.decoder" />
|
||||
<Limit name="size" min="2x2" max="2048x2048" />
|
||||
<Limit name="alignment" value="2x2" />
|
||||
<Feature name="adaptive-playback" />
|
||||
</MediaCodec>
|
||||
<MediaCodec name="c2.ffmpeg.vp8.decoder" type="video/x-vnd.on2.vp8">
|
||||
<Alias name="OMX.ffmpeg.vp8.decoder" />
|
||||
<Limit name="size" min="2x2" max="2048x2048" />
|
||||
<Limit name="alignment" value="2x2" />
|
||||
<Feature name="adaptive-playback" />
|
||||
</MediaCodec>
|
||||
<MediaCodec name="c2.ffmpeg.vp9.decoder" type="video/x-vnd.on2.vp9">
|
||||
<Alias name="OMX.ffmpeg.vp9.decoder" />
|
||||
<Limit name="size" min="2x2" max="2048x2048" />
|
||||
<Limit name="alignment" value="2x2" />
|
||||
<Feature name="adaptive-playback" />
|
||||
</MediaCodec>
|
||||
</Decoders>
|
||||
</MediaCodecs>
|
@@ -17,7 +17,6 @@
|
||||
-->
|
||||
|
||||
<Included>
|
||||
<!--
|
||||
<Encoders>
|
||||
<MediaCodec name="c2.v4l2.avc.encoder" type="video/avc">
|
||||
<Limit name="size" min="32x32" max="4096x4096" />
|
||||
@@ -29,10 +28,9 @@
|
||||
<Limit name="performance-point-1280x720" range="30-30" />
|
||||
</MediaCodec>
|
||||
</Encoders>
|
||||
-->
|
||||
|
||||
<Decoders>
|
||||
<MediaCodec name="c2.v4l2.avc.decoder" type="video/avc" >
|
||||
<MediaCodec name="c2.v4l2.avc.decoder" type="video/avc">
|
||||
<Limit name="size" min="16x16" max="4096x4096" />
|
||||
<Limit name="alignment" value="2x2" />
|
||||
<Limit name="block-size" value="16x16" />
|
||||
@@ -42,65 +40,5 @@
|
||||
<Limit name="performance-point-3840x2160" range="30-30" />
|
||||
<Feature name="adaptive-playback" />
|
||||
</MediaCodec>
|
||||
|
||||
<!--
|
||||
<MediaCodec name="c2.v4l2.vp8.decoder" type="video/x-vnd.on2.vp8" >
|
||||
<Limit name="size" min="16x16" max="4096x4096" />
|
||||
<Limit name="alignment" value="2x2" />
|
||||
<Limit name="block-size" value="16x16" />
|
||||
<Limit name="blocks-per-second" min="1" max="1984500" />
|
||||
<Limit name="bitrate" range="1-62500000" />
|
||||
<Limit name="concurrent-instances" max="8" />
|
||||
<Limit name="performance-point-3840x2160" range="30-30" />
|
||||
<Feature name="adaptive-playback" />
|
||||
</MediaCodec>
|
||||
|
||||
<MediaCodec name="c2.v4l2.vp9.decoder" type="video/x-vnd.on2.vp9" >
|
||||
<Limit name="size" min="16x16" max="4096x4096" />
|
||||
<Limit name="alignment" value="2x2" />
|
||||
<Limit name="block-size" value="16x16" />
|
||||
<Limit name="blocks-per-second" min="1" max="2073600" />
|
||||
<Limit name="bitrate" range="1-62500000" />
|
||||
<Limit name="concurrent-instances" max="8" />
|
||||
<Limit name="performance-point-3840x2160" range="30-30" />
|
||||
<Feature name="adaptive-playback" />
|
||||
</MediaCodec>
|
||||
|
||||
<MediaCodec name="c2.v4l2.avc.decoder.secure" type="video/avc" >
|
||||
<Limit name="size" min="16x16" max="4096x4096" />
|
||||
<Limit name="alignment" value="2x2" />
|
||||
<Limit name="block-size" value="16x16" />
|
||||
<Limit name="blocks-per-second" min="1" max="1879200" />
|
||||
<Limit name="bitrate" range="1-62500000" />
|
||||
<Limit name="concurrent-instances" max="8" />
|
||||
<Limit name="performance-point-3840x2160" range="30-30" />
|
||||
<Feature name="adaptive-playback" />
|
||||
<Feature name="secure-playback" required="true" />
|
||||
</MediaCodec>
|
||||
|
||||
<MediaCodec name="c2.v4l2.vp8.decoder.secure" type="video/x-vnd.on2.vp8" >
|
||||
<Limit name="size" min="16x16" max="4096x4096" />
|
||||
<Limit name="alignment" value="2x2" />
|
||||
<Limit name="block-size" value="16x16" />
|
||||
<Limit name="blocks-per-second" min="1" max="1984500" />
|
||||
<Limit name="bitrate" range="1-62500000" />
|
||||
<Limit name="concurrent-instances" max="8" />
|
||||
<Limit name="performance-point-3840x2160" range="30-30" />
|
||||
<Feature name="adaptive-playback" />
|
||||
<Feature name="secure-playback" required="true" />
|
||||
</MediaCodec>
|
||||
|
||||
<MediaCodec name="c2.v4l2.vp9.decoder.secure" type="video/x-vnd.on2.vp9" >
|
||||
<Limit name="size" min="16x16" max="4096x4096" />
|
||||
<Limit name="alignment" value="2x2" />
|
||||
<Limit name="block-size" value="16x16" />
|
||||
<Limit name="blocks-per-second" min="1" max="2073600" />
|
||||
<Limit name="bitrate" range="1-62500000" />
|
||||
<Limit name="concurrent-instances" max="8" />
|
||||
<Limit name="performance-point-3840x2160" range="30-30" />
|
||||
<Feature name="adaptive-playback" />
|
||||
<Feature name="secure-playback" required="true" />
|
||||
</MediaCodec>
|
||||
-->
|
||||
</Decoders>
|
||||
</Included>
|
||||
|
57
mkimg.sh
57
mkimg.sh
@@ -6,14 +6,37 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
VERSION=RaspberryVanillaAOSP12
|
||||
DATE=$(date +%Y%m%d)
|
||||
IMGNAME=${VERSION}-${DATE}-rpi4.img
|
||||
IMGSIZE=7
|
||||
OUTDIR=$(pwd | sed 's/\/device\/brcm\/rpi4$//')/out/target/product/rpi4
|
||||
exit_with_error() {
|
||||
echo $@
|
||||
exit 1
|
||||
}
|
||||
|
||||
echo "Creating image file ${OUTDIR}/${IMGNAME}..."
|
||||
sudo dd if=/dev/zero of="${OUTDIR}/${IMGNAME}" bs=1M count=$(echo "${IMGSIZE}*1024" | bc)
|
||||
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
|
||||
|
||||
for PARTITION in "boot" "system" "vendor"; do
|
||||
if [ ! -f ${ANDROID_PRODUCT_OUT}/${PARTITION}.img ]; then
|
||||
exit_with_error "Partition image not found. Run 'make ${PARTITION}image' first."
|
||||
fi
|
||||
done
|
||||
|
||||
VERSION=RaspberryVanillaAOSP16
|
||||
DATE=$(date +%Y%m%d)
|
||||
TARGET=$(echo ${TARGET_PRODUCT} | sed 's/^aosp_//')
|
||||
IMGNAME=${VERSION}-${DATE}-${TARGET}.img
|
||||
IMGSIZE=15360000000
|
||||
|
||||
if [ -f ${ANDROID_PRODUCT_OUT}/${IMGNAME} ]; then
|
||||
exit_with_error "${ANDROID_PRODUCT_OUT}/${IMGNAME} already exists!"
|
||||
fi
|
||||
|
||||
echo "Creating image file ${ANDROID_PRODUCT_OUT}/${IMGNAME}..."
|
||||
sudo fallocate -l ${IMGSIZE} ${ANDROID_PRODUCT_OUT}/${IMGNAME}
|
||||
sync
|
||||
|
||||
echo "Creating partitions..."
|
||||
@@ -28,7 +51,7 @@ echo n
|
||||
echo p
|
||||
echo 2
|
||||
echo
|
||||
echo +2048M
|
||||
echo +2560M
|
||||
echo n
|
||||
echo p
|
||||
echo 3
|
||||
@@ -44,29 +67,29 @@ echo c
|
||||
echo a
|
||||
echo 1
|
||||
echo w
|
||||
) | sudo fdisk "${OUTDIR}/${IMGNAME}"
|
||||
) | sudo fdisk ${ANDROID_PRODUCT_OUT}/${IMGNAME}
|
||||
sync
|
||||
|
||||
LOOPDEV=$(sudo kpartx -av "${OUTDIR}/${IMGNAME}" | awk 'NR==1{ sub(/p[0-9]$/, "", $3); print $3 }')
|
||||
LOOPDEV=$(sudo kpartx -av ${ANDROID_PRODUCT_OUT}/${IMGNAME} | awk 'NR==1{ sub(/p[0-9]$/, "", $3); print $3 }')
|
||||
if [ -z ${LOOPDEV} ]; then
|
||||
echo "Unable to find loop device!"
|
||||
exit 1
|
||||
exit_with_error "Unable to find loop device!"
|
||||
fi
|
||||
echo "Image mounted as /dev/${LOOPDEV}"
|
||||
sleep 1
|
||||
|
||||
echo "Copying boot..."
|
||||
sudo dd if=${OUTDIR}/boot.img of=/dev/mapper/${LOOPDEV}p1 bs=1M
|
||||
sudo dd if=${ANDROID_PRODUCT_OUT}/boot.img of=/dev/mapper/${LOOPDEV}p1 bs=1M
|
||||
echo "Copying system..."
|
||||
sudo dd if=${OUTDIR}/system.img of=/dev/mapper/${LOOPDEV}p2 bs=1M
|
||||
sudo dd if=${ANDROID_PRODUCT_OUT}/system.img of=/dev/mapper/${LOOPDEV}p2 bs=1M
|
||||
echo "Copying vendor..."
|
||||
sudo dd if=${OUTDIR}/vendor.img of=/dev/mapper/${LOOPDEV}p3 bs=1M
|
||||
sudo dd if=${ANDROID_PRODUCT_OUT}/vendor.img of=/dev/mapper/${LOOPDEV}p3 bs=1M
|
||||
echo "Creating userdata..."
|
||||
sudo mkfs.ext4 /dev/mapper/${LOOPDEV}p4 -I 512 -L userdata
|
||||
sudo resize2fs /dev/mapper/${LOOPDEV}p4 1212156
|
||||
sync
|
||||
|
||||
sudo kpartx -d "/dev/${LOOPDEV}"
|
||||
echo "Done, created ${OUTDIR}/${IMGNAME}!"
|
||||
sudo losetup -d "/dev/${LOOPDEV}"
|
||||
sudo chown ${USER}:${USER} ${ANDROID_PRODUCT_OUT}/${IMGNAME}
|
||||
|
||||
echo "Done, created ${ANDROID_PRODUCT_OUT}/${IMGNAME}!"
|
||||
exit 0
|
||||
|
@@ -6,5 +6,5 @@ runtime_resource_overlay {
|
||||
name: "AndroidRpiOverlay",
|
||||
resource_dirs: ["res"],
|
||||
sdk_version: "current",
|
||||
proprietary: true
|
||||
vendor: true,
|
||||
}
|
||||
|
@@ -46,6 +46,12 @@
|
||||
cell broadcasting sms, and MMS. -->
|
||||
<bool name="config_sms_capable">false</bool>
|
||||
|
||||
<!-- Flag indicating whether the current device allows data.
|
||||
If true, this means that the device supports data connectivity through
|
||||
the telephony network.
|
||||
This can be overridden to false for devices that support voice and/or sms . -->
|
||||
<bool name="config_mobile_data_capable">false</bool>
|
||||
|
||||
<!-- Whether a software navigation bar should be shown. NOTE: in the future this may be
|
||||
autodetected from the Configuration. -->
|
||||
<bool name="config_showNavigationBar">true</bool>
|
||||
@@ -111,4 +117,8 @@
|
||||
-->
|
||||
<integer name="config_defaultNightMode">2</integer>
|
||||
|
||||
<!-- CEC Configuration -->
|
||||
<bool name="config_cecTvSendStandbyOnSleepEnabled_default">false</bool>
|
||||
<bool name="config_cecTvSendStandbyOnSleepDisabled_default">true</bool>
|
||||
|
||||
</resources>
|
||||
|
10
overlay/AndroidTvRpiOverlay/Android.bp
Normal file
10
overlay/AndroidTvRpiOverlay/Android.bp
Normal file
@@ -0,0 +1,10 @@
|
||||
// Copyright (C) 2021-2022 KonstaKANG
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
runtime_resource_overlay {
|
||||
name: "AndroidTvRpiOverlay",
|
||||
resource_dirs: ["res"],
|
||||
sdk_version: "current",
|
||||
vendor: true,
|
||||
}
|
19
overlay/AndroidTvRpiOverlay/AndroidManifest.xml
Normal file
19
overlay/AndroidTvRpiOverlay/AndroidManifest.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?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="android.rpi.tv"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0" >
|
||||
<application android:hasCode="false" />
|
||||
<overlay
|
||||
android:targetPackage="android"
|
||||
android:isStatic="true"
|
||||
android:priority="0" />
|
||||
</manifest>
|
51
overlay/AndroidTvRpiOverlay/res/values/config.xml
Normal file
51
overlay/AndroidTvRpiOverlay/res/values/config.xml
Normal file
@@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2009 The Android Open Source Project
|
||||
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>
|
||||
<!-- Default screen brightness setting.
|
||||
Must be in the range specified by minimum and maximum. -->
|
||||
<integer name="config_screenBrightnessSettingDefault">128</integer>
|
||||
|
||||
<!-- Minimum screen brightness setting allowed by the power manager.
|
||||
The user is forbidden from setting the brightness below this level. -->
|
||||
<integer name="config_screenBrightnessSettingMinimum">20</integer>
|
||||
|
||||
<!-- Screen brightness used to dim the screen when the user activity
|
||||
timeout expires. May be less than the minimum allowed brightness setting
|
||||
that can be set by the user. -->
|
||||
<integer name="config_screenBrightnessDim">20</integer>
|
||||
|
||||
<!-- If true, then we do not ask user for permission for apps to connect to USB devices.
|
||||
Do not set this to true for production devices. Doing so will cause you to fail CTS. -->
|
||||
<bool name="config_disableUsbPermissionDialogs">true</bool>
|
||||
|
||||
<!-- Control the behavior when the user long presses the power button.
|
||||
0 - Nothing
|
||||
1 - Global actions menu
|
||||
2 - Power off (with confirmation)
|
||||
3 - Power off (without confirmation)
|
||||
4 - Go to voice assist
|
||||
5 - Go to assistant (Settings.Secure.ASSISTANT)
|
||||
-->
|
||||
<integer name="config_longPressOnPowerBehavior">1</integer>
|
||||
|
||||
<!-- CEC Configuration -->
|
||||
<bool name="config_cecTvSendStandbyOnSleepEnabled_default">false</bool>
|
||||
<bool name="config_cecTvSendStandbyOnSleepDisabled_default">true</bool>
|
||||
|
||||
</resources>
|
10
overlay/BluetoothRpiOverlay/Android.bp
Normal file
10
overlay/BluetoothRpiOverlay/Android.bp
Normal file
@@ -0,0 +1,10 @@
|
||||
// Copyright (C) 2021-2022 KonstaKANG
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
runtime_resource_overlay {
|
||||
name: "BluetoothRpiOverlay",
|
||||
resource_dirs: ["res"],
|
||||
sdk_version: "current",
|
||||
vendor: true,
|
||||
}
|
19
overlay/BluetoothRpiOverlay/AndroidManifest.xml
Normal file
19
overlay/BluetoothRpiOverlay/AndroidManifest.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?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>
|
24
overlay/BluetoothRpiOverlay/res/values/config.xml
Normal file
24
overlay/BluetoothRpiOverlay/res/values/config.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?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>
|
10
overlay/CarServiceRpiOverlay/Android.bp
Normal file
10
overlay/CarServiceRpiOverlay/Android.bp
Normal file
@@ -0,0 +1,10 @@
|
||||
// Copyright (C) 2021-2023 KonstaKANG
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
runtime_resource_overlay {
|
||||
name: "CarServiceRpiOverlay",
|
||||
resource_dirs: ["res"],
|
||||
sdk_version: "current",
|
||||
vendor: true,
|
||||
}
|
20
overlay/CarServiceRpiOverlay/AndroidManifest.xml
Normal file
20
overlay/CarServiceRpiOverlay/AndroidManifest.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/*
|
||||
** Copyright (C) 2021-2023 KonstaKANG
|
||||
**
|
||||
** SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
-->
|
||||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.android.car.resources.rpi"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
<application android:hasCode="false" />
|
||||
<overlay
|
||||
android:targetPackage="com.android.car.updatable"
|
||||
android:targetName="CarServiceCustomization"
|
||||
android:isStatic="true"
|
||||
android:priority="0" />
|
||||
</manifest>
|
71
overlay/CarServiceRpiOverlay/res/values/config.xml
Normal file
71
overlay/CarServiceRpiOverlay/res/values/config.xml
Normal file
@@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2015 The Android Open Source Project
|
||||
Copyright (C) 2021-2023 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">
|
||||
|
||||
<!--
|
||||
Specifies configuration of displays in system telling its usage / type and assigned
|
||||
occupant. DEFAULT_DISPLAY, if assigned here, should be always assigned to the DRIVER zone.
|
||||
|
||||
Some examples are:
|
||||
<item>displayPort=0,displayType=MAIN,occupantZoneId=0,inputTypes=DPAD_KEYS|
|
||||
NAVIGATE_KEYS|ROTARY_NAVIGATION</item>
|
||||
<item>displayPort=1,displayType=INSTRUMENT_CLUSTER,occupantZoneId=0,
|
||||
inputTypes=DPAD_KEYS</item>
|
||||
<item>displayPort=2,displayType=MAIN,occupantZoneId=1,
|
||||
inputTypes=TOUCH_SCREEN</item>
|
||||
<item>displayPort=3,displayType=MAIN,occupantZoneId=2,
|
||||
inputTypes=TOUCH_SCREEN</item>
|
||||
<item>displayUniqueId=virtual:com.example:MainD,displayType=MAIN,occupantZoneId=3,
|
||||
inputTypes=TOUCH_SCREEN</item>
|
||||
|
||||
NOTE: each item should have displayPort or displayUniqueId, if it has both, displayPort
|
||||
will be used.
|
||||
displayPort: Unique Port id for the physical display.
|
||||
displayUniqueId: Unique Id for the display.
|
||||
The unique id of the virtual display will be the form of 'virtual:<PACKAGE>:<ID>'.
|
||||
displayType: Display type for the display. Use * part from
|
||||
CarOccupantZoneManager.DISPLAY_TYPE_* like MAIN, INSTRUMENT_CLUSTER and
|
||||
etc.
|
||||
occupantZoneId: occupantZoneId specified from config_occupant_zones.
|
||||
inputTypes: supported input types for the corresponding display.
|
||||
|
||||
-->
|
||||
<string-array translatable="false" name="config_occupant_display_mapping">
|
||||
<item>displayPort=0,displayType=MAIN,occupantZoneId=0,inputTypes=TOUCH_SCREEN|DPAD_KEYS|NAVIGATE_KEYS|ROTARY_NAVIGATION</item>
|
||||
<item>displayPort=1,displayType=INSTRUMENT_CLUSTER,occupantZoneId=0,inputTypes=DPAD_KEYS</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Specifies notice UI that will be launched when user starts a car or do user
|
||||
switching. It is recommended to use dialog with at least TYPE_APPLICATION_OVERLAY window
|
||||
type to show the UI regardless of activity launches. Target package will be auto-granted
|
||||
necessary permission for TYPE_APPLICATION_OVERLAY window type. The UI package should
|
||||
resolve permission by itself to use any higher priority window type.
|
||||
Setting this string to empty will disable the feature. -->
|
||||
<string name="config_userNoticeUiService" translatable="false"></string>
|
||||
|
||||
<!-- A name of a camera device that provides the rearview through EVS service -->
|
||||
<string name="config_evsRearviewCameraId" translatable="false">/dev/video0</string>
|
||||
|
||||
<!-- The camera Activity name for EVS, if defined, the Activity will be launched by
|
||||
CarEvsService. -->
|
||||
<string name="config_evsCameraActivity" translatable="false">
|
||||
com.google.android.car.evs/com.google.android.car.evs.CarEvsCameraPreviewActivity
|
||||
</string>
|
||||
|
||||
</resources>
|
@@ -6,5 +6,5 @@ runtime_resource_overlay {
|
||||
name: "SettingsProviderRpiOverlay",
|
||||
resource_dirs: ["res"],
|
||||
sdk_version: "current",
|
||||
proprietary: true
|
||||
vendor: true,
|
||||
}
|
||||
|
@@ -18,6 +18,9 @@
|
||||
|
||||
<resources>
|
||||
|
||||
<!-- 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>
|
||||
|
||||
|
10
overlay/SettingsProviderTvRpiOverlay/Android.bp
Normal file
10
overlay/SettingsProviderTvRpiOverlay/Android.bp
Normal file
@@ -0,0 +1,10 @@
|
||||
// Copyright (C) 2021-2022 KonstaKANG
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
runtime_resource_overlay {
|
||||
name: "SettingsProviderTvRpiOverlay",
|
||||
resource_dirs: ["res"],
|
||||
sdk_version: "current",
|
||||
vendor: true,
|
||||
}
|
19
overlay/SettingsProviderTvRpiOverlay/AndroidManifest.xml
Normal file
19
overlay/SettingsProviderTvRpiOverlay/AndroidManifest.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?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.providers.settings.rpi.tv"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0" >
|
||||
<application android:hasCode="false" />
|
||||
<overlay
|
||||
android:targetPackage="com.android.providers.settings"
|
||||
android:isStatic="true"
|
||||
android:priority="0" />
|
||||
</manifest>
|
34
overlay/SettingsProviderTvRpiOverlay/res/values/defaults.xml
Normal file
34
overlay/SettingsProviderTvRpiOverlay/res/values/defaults.xml
Normal file
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2009 The Android Open Source Project
|
||||
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>
|
||||
|
||||
<!-- 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>
|
||||
|
||||
<!-- Disable location by default -->
|
||||
<integer name="def_location_mode">0</integer>
|
||||
|
||||
<!-- No setup wizard -->
|
||||
<bool name="def_device_provisioned">true</bool>
|
||||
<bool name="def_user_setup_complete">true</bool>
|
||||
|
||||
</resources>
|
@@ -6,5 +6,5 @@ runtime_resource_overlay {
|
||||
name: "SettingsRpiOverlay",
|
||||
resource_dirs: ["res"],
|
||||
sdk_version: "current",
|
||||
proprietary: true
|
||||
vendor: true,
|
||||
}
|
||||
|
@@ -24,7 +24,16 @@
|
||||
<!-- Whether charging_sounds should be shown or not. -->
|
||||
<bool name="config_show_charging_sounds">false</bool>
|
||||
|
||||
<!-- Whether data_saver should be shown or not. -->
|
||||
<bool name="config_show_data_saver">false</bool>
|
||||
|
||||
<!-- Whether battery from app_info_settings is available or not. -->
|
||||
<bool name="config_show_app_info_settings_battery">false</bool>
|
||||
|
||||
<!-- Whether top_level_battery should be shown or not. -->
|
||||
<bool name="config_show_top_level_battery">false</bool>
|
||||
|
||||
<!-- Whether sim related information is visible to the end user. -->
|
||||
<bool name="config_show_sim_info">false</bool>
|
||||
|
||||
</resources>
|
||||
|
@@ -6,5 +6,5 @@ runtime_resource_overlay {
|
||||
name: "SystemUIRpiOverlay",
|
||||
resource_dirs: ["res"],
|
||||
sdk_version: "current",
|
||||
proprietary: true
|
||||
vendor: true,
|
||||
}
|
||||
|
@@ -20,7 +20,7 @@
|
||||
|
||||
<!-- The default tiles to display in QuickSettings -->
|
||||
<string name="quick_settings_tiles_default" translatable="false">
|
||||
internet,bt,airplane,hotspot,dark,screenrecord
|
||||
internet,bt,airplane,hotspot,dark,screenrecord,custom(com.android.permissioncontroller/.permission.service.v33.SafetyCenterQsTileService)
|
||||
</string>
|
||||
|
||||
</resources>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user