38 Commits

Author SHA1 Message Date
Konsta
57cdc04899 build EmergencyInfo
* Fixes crash on Settings -> Safety & emergency.
2024-04-08 10:36:41 +03:00
aloshchilov
073f50878f car: BT AVRCP target enabled 2024-03-28 20:06:36 +04:00
adufftpc
973797e543 car: Disabled BT MAP causing cyclic BT reconnect
Disabled BT Message Access Profile. Allows to keep connection to the paired device
2024-03-28 19:53:58 +04:00
Konsta
b7ac80d55f external camera: switch to aidl 2024-02-07 14:33:29 +02:00
Konsta
eef70eed76 libcamera: add override service for logging 2024-02-07 14:33:29 +02:00
Konsta
49655668d2 libcamera: update ipa config 2024-01-04 17:06:53 +02:00
Konsta
e47485495e graphics: bump opengles/vulkan deqp levels 2024-01-04 17:06:44 +02:00
Konsta
d9457507d1 overlay: hide data saver from settings 2023-12-07 20:18:08 +02:00
Konsta
9dd0d06c97 overlay: hide more battery info from settings 2023-12-07 20:17:59 +02:00
Konsta
810864227d use system property to disable lockscreen
* d1645f8d0f
* This reverts commit 2632bb5db3.
2023-12-07 20:17:51 +02:00
Konsta
77d8091ba1 cec: don't add port info if physical address is invalid
* Fixes https://github.com/raspberry-vanilla/android_local_manifest/issues/37.
2023-11-26 21:29:46 +02:00
Konsta
f5db2884d7 boot: enable arm_boost
* Increases arm_freq to 1800 on Pi4B R1.4+.
  https://www.raspberrypi.com/documentation/computers/config_txt.html#arm_boost-raspberry-pi-4-only
  https://www.raspberrypi.com/documentation/computers/config_txt.html#overclocking
2023-11-24 11:49:21 +02:00
Konsta
38a5c9ff94 media: create input surface on the framework side
* Fixes native screen recording on Android 14.
2023-11-23 17:32:53 +02:00
Konsta
0205059ddb audio: probe pcm card for jack & dac 2023-11-23 17:32:53 +02:00
Konsta
ef056e1f91 hdmi audio: snake_case 2023-11-23 17:28:54 +02:00
Konsta
51d93e9116 boot: disable firmware kms setup
* https://www.raspberrypi.com/documentation/computers/config_txt.html#disable_fw_kms_setup
2023-11-23 17:28:09 +02:00
Konsta
54a1d67860 graphics: disable gpu color transform matrix 2023-11-23 17:26:33 +02:00
Konsta
cafac234ff libcamera: update for v0.1.0 2023-11-23 17:25:52 +02:00
Konsta
c1f7f3e677 car: reorganize makefile 2023-10-13 19:52:07 +03:00
Konsta
c4a082a910 car: add broadcastradio aidl 2023-10-13 19:43:11 +03:00
Konsta
8a64b0130c car: add activities_on_secondary_displays permission
* Needed to display maps in home screen.
  f5124bfe5a
2023-10-13 16:36:32 +03:00
Konsta
58de1fd5f1 car: move evs config to vendor
* b62b8ea383
2023-10-13 12:44:10 +03:00
Konsta
3f4462dd77 usb: add gadget hal
* Copy from hardware/interfaces/usb/gadget/1.2/default with udc
  path changed and service renamed for Raspberry Pi.
2023-10-12 10:23:56 +03:00
Konsta
1ac293a581 usb: switch to aidl 2023-10-12 10:23:56 +03:00
Konsta
99f26e997f enable updatable apex
* This already gets enabled by inheriting virtualization makefile
  where this was enabled for Android 14 in
  3a747a655c
* Add this also here for clarity and redundancy.
2023-10-12 10:23:56 +03:00
Konsta
2632bb5db3 overlay: disable lockscreen
* SettingsProvider option no longer seems to work on Android 14.
2023-10-12 10:23:56 +03:00
Konsta
eeeab1fb7e bump shipping API level to 34 and FCM level to 8
* Does not pass 'make check-vintf-all'.
* Following HALs are deprecated at FCM level 8:
    android.hardware.camera.provider@2.5::ICameraProvider/external/0
    android.hardware.camera.provider@2.5::ICameraProvider/legacy/0
    android.hardware.gatekeeper@1.0::IGatekeeper/default
    android.hardware.graphics.allocator@4.0::IAllocator/default
    android.hardware.graphics.composer@2.4::IComposer/default
    android.hardware.keymaster@4.1::IKeymasterDevice/default
    android.hardware.tv.cec@1.0::IHdmiCec/default
2023-10-12 10:23:56 +03:00
Konsta
2dc938adef remove android.system.net.netd from compatility matrix 2023-10-12 10:23:56 +03:00
Konsta
a1b1670f1c remove android.hardware.media.omx from device manifest 2023-10-12 10:23:56 +03:00
Konsta
31b0958771 graphics: set egl hardware to mesa 2023-10-12 10:23:56 +03:00
Konsta
d1476ec29f sepolicy: update for ffmpeg service
* There's no suffix in the service's name so drop the wildcard.
2023-10-12 10:23:56 +03:00
Konsta
c9cb165c19 sepolicy: update drm for aidl
* There no need for the wildcards for the HIDL versions.
* Widevine service can have a suffix in Android 14.
2023-10-12 10:23:56 +03:00
Konsta
2df5bd40b4 wifi: switch to aidl
* Remove android.system.wifi.keystore from compatibility matrix
  as it's been removed in Android 14.
2023-10-12 10:19:53 +03:00
Konsta
003d08a615 thermal: switch to aidl 2023-10-12 10:19:53 +03:00
Konsta
29e89ed615 health: update aidl to v2
* f219a02e1c
2023-10-12 10:19:53 +03:00
Konsta
7e2e50fdb5 boot: remove obsolete config.txt options for 6.1 kernel
* ec08e93837
* 9b523e1fc8
2023-10-12 10:19:53 +03:00
Konsta
68d59d4e59 keylayout: update for Android 14
* Changes from frameworks/base/data/keyboards/Generic.kl
2023-10-12 10:08:27 +03:00
Konsta
5193e6ce38 readme: mkimg: Raspberry Vanilla AOSP 14 2023-10-09 15:46:26 +03:00
24 changed files with 651 additions and 137 deletions

View File

@@ -29,8 +29,8 @@ BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := $(DEVICE_PATH)/bluetooth
BOARD_HAVE_BLUETOOTH := true BOARD_HAVE_BLUETOOTH := true
# Camera # Camera
BOARD_LIBCAMERA_IPAS := raspberrypi BOARD_LIBCAMERA_IPAS := rpi/vc4
BOARD_LIBCAMERA_PIPELINES := raspberrypi BOARD_LIBCAMERA_PIPELINES := rpi/vc4
BOARD_LIBCAMERA_USES_MESON_BUILD := true BOARD_LIBCAMERA_USES_MESON_BUILD := true
# Display # Display

View File

@@ -1 +1 @@
Raspberry Vanilla AOSP 13 device configuration for Raspberry Pi 4. Raspberry Vanilla AOSP 14 device configuration for Raspberry Pi 4.

View File

@@ -37,7 +37,7 @@ PRODUCT_VENDOR_PROPERTIES += \
# Broadcast radio # Broadcast radio
PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \
android.hardware.broadcastradio@2.0-service android.hardware.broadcastradio-service.default
PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.broadcastradio.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.broadcastradio.xml frameworks/native/data/etc/android.hardware.broadcastradio.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.broadcastradio.xml
@@ -52,7 +52,7 @@ ENABLE_EVS_SERVICE := true
ENABLE_REAR_VIEW_CAMERA_SAMPLE := true ENABLE_REAR_VIEW_CAMERA_SAMPLE := true
PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \
device/brcm/rpi4/camera/evs_config_override.json:${TARGET_COPY_OUT_SYSTEM}/etc/automotive/evs/config_override.json device/brcm/rpi4/camera/evs_config_override.json:${TARGET_COPY_OUT_VENDOR}/etc/automotive/evs/config_override.json
# Overlays # Overlays
PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \

View File

@@ -87,7 +87,7 @@ struct alsa_stream_out {
static int probe_pcm_out_card() { static int probe_pcm_out_card() {
FILE *fp; FILE *fp;
char card_node[] = "/proc/asound/card0/id"; char card_node[] = "/proc/asound/card0/id";
char card_id[16]; char card_id[64];
char card_prop[PROPERTY_VALUE_MAX]; char card_prop[PROPERTY_VALUE_MAX];
property_get("persist.audio.device", card_prop, ""); property_get("persist.audio.device", card_prop, "");

View File

@@ -8,9 +8,6 @@ initramfs ramdisk.img followkernel
# Audio # Audio
dtparam=audio=on dtparam=audio=on
# Bluetooth
dtparam=krnbt=on
# Camera # Camera
camera_auto_detect=1 camera_auto_detect=1
start_x=1 start_x=1
@@ -28,7 +25,6 @@ disable_overscan=1
# Graphics acceleration # Graphics acceleration
disable_fw_kms_setup=1 disable_fw_kms_setup=1
dtoverlay=vc4-kms-v3d dtoverlay=vc4-kms-v3d
dtoverlay=cma,cma-512
# I2C # I2C
#dtparam=i2c_arm=on #dtparam=i2c_arm=on

View File

@@ -248,8 +248,10 @@ static void hdmicec_get_port_info(const struct hdmi_cec_device *dev,
ctx->port_info.arc_supported, ctx->port_info.arc_supported,
ctx->port_info.physical_address); ctx->port_info.physical_address);
*list = &ctx->port_info; if (ctx->port_info.physical_address != CEC_PHYS_ADDR_INVALID) {
*total = 1; *list = &ctx->port_info;
*total = 1;
}
} }
static void hdmicec_set_option(const struct hdmi_cec_device *dev, int flag, int value) static void hdmicec_set_option(const struct hdmi_cec_device *dev, int flag, int value)

View File

@@ -31,20 +31,4 @@
<instance>default</instance> <instance>default</instance>
</interface> </interface>
</hal> </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> </compatibility-matrix>

View File

@@ -11,8 +11,11 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
$(call inherit-product, frameworks/native/build/tablet-7in-xhdpi-2048-dalvik-heap.mk) $(call inherit-product, frameworks/native/build/tablet-7in-xhdpi-2048-dalvik-heap.mk)
$(call inherit-product, vendor/brcm/rpi4/rpi4-vendor.mk) $(call inherit-product, vendor/brcm/rpi4/rpi4-vendor.mk)
# APEX
$(call inherit-product, $(SRC_TARGET_DIR)/product/updatable_apex.mk)
# API level # API level
PRODUCT_SHIPPING_API_LEVEL := 33 PRODUCT_SHIPPING_API_LEVEL := 34
# Audio # Audio
PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \
@@ -87,7 +90,7 @@ PRODUCT_COPY_FILES += \
# Camera # Camera
PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \
android.hardware.camera.provider@2.5-external-service android.hardware.camera.provider-V1-external-service
PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \
$(DEVICE_PATH)/camera/external_camera_config.xml:$(TARGET_COPY_OUT_VENDOR)/etc/external_camera_config.xml $(DEVICE_PATH)/camera/external_camera_config.xml:$(TARGET_COPY_OUT_VENDOR)/etc/external_camera_config.xml
@@ -98,27 +101,26 @@ PRODUCT_COPY_FILES += \
PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \
android.hardware.camera.provider@2.5-service_64 \ android.hardware.camera.provider@2.5-service_64 \
camera.libcamera \ camera.libcamera \
ipa_rpi ipa_rpi_vc4
PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \
$(DEVICE_PATH)/camera/android.hardware.camera.provider@2.5-service_64.rpi.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/android.hardware.camera.provider@2.5-service_64.rpi.rc $(DEVICE_PATH)/camera/android.hardware.camera.provider@2.5-service_64.rpi.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/android.hardware.camera.provider@2.5-service_64.rpi.rc
PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \
$(DEVICE_PATH)/camera/camera_hal.yaml:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/camera_hal.yaml \ $(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/rpi/vc4/data/imx219.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/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/rpi/vc4/data/imx219_noir.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/imx219_noir.json \
external/libcamera/src/ipa/raspberrypi/data/imx296.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/raspberrypi/imx296.json \ external/libcamera/src/ipa/rpi/vc4/data/imx296.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/imx296.json \
external/libcamera/src/ipa/raspberrypi/data/imx296_mono.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/raspberrypi/imx296_mono.json \ external/libcamera/src/ipa/rpi/vc4/data/imx296_mono.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/imx296_mono.json \
external/libcamera/src/ipa/raspberrypi/data/imx477.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/raspberrypi/imx477.json \ external/libcamera/src/ipa/rpi/vc4/data/imx477.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/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/rpi/vc4/data/imx477_noir.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/imx477_noir.json \
external/libcamera/src/ipa/raspberrypi/data/imx477_scientific.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/raspberrypi/imx477_scientific.json \ external/libcamera/src/ipa/rpi/vc4/data/imx477_scientific.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/imx477_scientific.json \
external/libcamera/src/ipa/raspberrypi/data/imx477_v1.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/raspberrypi/imx477_v1.json \ external/libcamera/src/ipa/rpi/vc4/data/imx708.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/imx708.json \
external/libcamera/src/ipa/raspberrypi/data/imx708.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/raspberrypi/imx708.json \ external/libcamera/src/ipa/rpi/vc4/data/imx708_noir.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/imx708_noir.json \
external/libcamera/src/ipa/raspberrypi/data/imx708_noir.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/raspberrypi/imx708_noir.json \ external/libcamera/src/ipa/rpi/vc4/data/imx708_wide.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/imx708_wide.json \
external/libcamera/src/ipa/raspberrypi/data/imx708_wide.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/raspberrypi/imx708_wide.json \ external/libcamera/src/ipa/rpi/vc4/data/imx708_wide_noir.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/imx708_wide_noir.json \
external/libcamera/src/ipa/raspberrypi/data/imx708_wide_noir.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/raspberrypi/imx708_wide_noir.json \ external/libcamera/src/ipa/rpi/vc4/data/ov5647.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/ov5647.json \
external/libcamera/src/ipa/raspberrypi/data/ov5647.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/raspberrypi/ov5647.json \ external/libcamera/src/ipa/rpi/vc4/data/ov5647_noir.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/rpi/vc4/ov5647_noir.json
external/libcamera/src/ipa/raspberrypi/data/ov5647_noir.json:$(TARGET_COPY_OUT_VENDOR)/etc/libcamera/ipa/raspberrypi/ov5647_noir.json
PRODUCT_COPY_FILES += \ 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 \
@@ -147,6 +149,10 @@ PRODUCT_SET_DEBUGFS_RESTRICTIONS := false
PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \
android.hardware.drm-service.clearkey android.hardware.drm-service.clearkey
# Emergency info
PRODUCT_PACKAGES += \
EmergencyInfo
# Ethernet # Ethernet
PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.ethernet.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.ethernet.xml frameworks/native/data/etc/android.hardware.ethernet.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.ethernet.xml
@@ -177,7 +183,7 @@ PRODUCT_PACKAGES += \
libglapi libglapi
PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.software.opengles.deqp.level-2022-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.opengles.deqp.level.xml frameworks/native/data/etc/android.software.opengles.deqp.level-2023-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.opengles.deqp.level.xml
PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \
vulkan.broadcom vulkan.broadcom
@@ -185,7 +191,7 @@ PRODUCT_PACKAGES += \
PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \
$(DEVICE_PATH)/vulkan/android.hardware.vulkan.version-1_2.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.version.xml \ $(DEVICE_PATH)/vulkan/android.hardware.vulkan.version-1_2.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.version.xml \
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.level-0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.level.xml \
frameworks/native/data/etc/android.software.vulkan.deqp.level-2022-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.vulkan.deqp.level.xml frameworks/native/data/etc/android.software.vulkan.deqp.level-2023-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.vulkan.deqp.level.xml
# Health # Health
PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \
@@ -241,11 +247,12 @@ PRODUCT_PACKAGES += \
# Thermal # Thermal
PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \
android.hardware.thermal@2.0-service.mock android.hardware.thermal-service.example
# USB # USB
PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \
android.hardware.usb@1.0-service android.hardware.usb-service.example \
android.hardware.usb.gadget@1.2-service.rpi
PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.usb.accessory.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.usb.accessory.xml \ frameworks/native/data/etc/android.hardware.usb.accessory.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.usb.accessory.xml \
@@ -267,7 +274,7 @@ $(call inherit-product, packages/modules/Virtualization/apex/product_packages.mk
# Wifi # Wifi
PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \
android.hardware.wifi@1.0-service \ android.hardware.wifi-service \
hostapd \ hostapd \
hostapd_cli \ hostapd_cli \
libwpa_client \ libwpa_client \

View File

@@ -26,7 +26,7 @@ cc_binary {
"libhidlbase", "libhidlbase",
"liblog", "liblog",
"libutils", "libutils",
"android.hardware.health-V1-ndk", "android.hardware.health-V2-ndk",
], ],
overrides: ["charger"], overrides: ["charger"],
} }

View File

@@ -1,7 +1,7 @@
<manifest version="1.0" type="device"> <manifest version="1.0" type="device">
<hal format="aidl"> <hal format="aidl">
<name>android.hardware.health</name> <name>android.hardware.health</name>
<version>1</version> <version>2</version>
<fqname>IHealth/default</fqname> <fqname>IHealth/default</fqname>
</hal> </hal>
</manifest> </manifest>

View File

@@ -139,7 +139,7 @@ key 116 POWER
key 117 NUMPAD_EQUALS key 117 NUMPAD_EQUALS
# key 118 "KEY_KPPLUSMINUS" # key 118 "KEY_KPPLUSMINUS"
key 119 BREAK key 119 BREAK
# key 120 (undefined) key 120 RECENT_APPS
key 121 NUMPAD_COMMA key 121 NUMPAD_COMMA
key 122 KANA key 122 KANA
key 123 EISU key 123 EISU
@@ -246,6 +246,10 @@ key 217 SEARCH
key 224 BRIGHTNESS_DOWN key 224 BRIGHTNESS_DOWN
key 225 BRIGHTNESS_UP key 225 BRIGHTNESS_UP
key 226 HEADSETHOOK 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 256 BUTTON_1
key 257 BUTTON_2 key 257 BUTTON_2
@@ -299,6 +303,11 @@ key 317 BUTTON_THUMBL
key 318 BUTTON_THUMBR key 318 BUTTON_THUMBR
key 329 STYLUS_BUTTON_TERTIARY
key 331 STYLUS_BUTTON_PRIMARY
key 332 STYLUS_BUTTON_SECONDARY
# key 352 "KEY_OK" # key 352 "KEY_OK"
key 353 DPAD_CENTER key 353 DPAD_CENTER
# key 354 "KEY_GOTO" # key 354 "KEY_GOTO"
@@ -363,6 +372,11 @@ key 405 LAST_CHANNEL
# key 413 "KEY_DIGITS" # key 413 "KEY_DIGITS"
# key 414 "KEY_TEEN" # key 414 "KEY_TEEN"
# key 415 "KEY_TWEN" # 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 429 CONTACTS
@@ -410,6 +424,10 @@ key 580 APP_SWITCH
key 582 VOICE_ASSIST key 582 VOICE_ASSIST
# Linux KEY_ASSISTANT # Linux KEY_ASSISTANT
key 583 ASSIST key 583 ASSIST
key 656 MACRO_1
key 657 MACRO_2
key 658 MACRO_3
key 659 MACRO_4
# CEC # CEC
key 352 ENTER key 352 ENTER
@@ -421,9 +439,14 @@ key 174 BACK
key usage 0x0c0067 WINDOW key usage 0x0c0067 WINDOW
key usage 0x0c006F BRIGHTNESS_UP key usage 0x0c006F BRIGHTNESS_UP
key usage 0x0c0070 BRIGHTNESS_DOWN key usage 0x0c0070 BRIGHTNESS_DOWN
key usage 0x0c0079 KEYBOARD_BACKLIGHT_UP
key usage 0x0c007A KEYBOARD_BACKLIGHT_DOWN
key usage 0x0c007C KEYBOARD_BACKLIGHT_TOGGLE
key usage 0x0c0173 MEDIA_AUDIO_TRACK key usage 0x0c0173 MEDIA_AUDIO_TRACK
key usage 0x0c019C PROFILE_SWITCH key usage 0x0c019C PROFILE_SWITCH
key usage 0x0c01A2 ALL_APPS key usage 0x0c01A2 ALL_APPS
key usage 0x0d0044 STYLUS_BUTTON_PRIMARY
key usage 0x0d005a STYLUS_BUTTON_SECONDARY
# Joystick and game controller axes. # Joystick and game controller axes.
# Axes that are not mapped will be assigned generic axis numbers by the input subsystem. # Axes that are not mapped will be assigned generic axis numbers by the input subsystem.
@@ -436,8 +459,8 @@ axis 0x05 RZ
axis 0x06 THROTTLE axis 0x06 THROTTLE
axis 0x07 RUDDER axis 0x07 RUDDER
axis 0x08 WHEEL axis 0x08 WHEEL
axis 0x09 GAS axis 0x09 RTRIGGER
axis 0x0a BRAKE axis 0x0a LTRIGGER
axis 0x10 HAT_X axis 0x10 HAT_X
axis 0x11 HAT_Y axis 0x11 HAT_Y

View File

@@ -1,4 +1,4 @@
<manifest version="1.0" type="device" target-level="7"> <manifest version="1.0" type="device" target-level="8">
<hal format="hidl"> <hal format="hidl">
<name>android.hardware.audio</name> <name>android.hardware.audio</name>
<transport>hwbinder</transport> <transport>hwbinder</transport>
@@ -26,13 +26,20 @@
<instance>default</instance> <instance>default</instance>
</interface> </interface>
</hal> </hal>
<hal format="aidl">
<name>android.hardware.camera.provider</name>
<version>1</version>
<interface>
<name>ICameraProvider</name>
<instance>external/0</instance>
</interface>
</hal>
<hal format="hidl"> <hal format="hidl">
<name>android.hardware.camera.provider</name> <name>android.hardware.camera.provider</name>
<transport>hwbinder</transport> <transport>hwbinder</transport>
<version>2.5</version> <version>2.5</version>
<interface> <interface>
<name>ICameraProvider</name> <name>ICameraProvider</name>
<instance>external/0</instance>
<instance>legacy/0</instance> <instance>legacy/0</instance>
</interface> </interface>
</hal> </hal>
@@ -45,19 +52,6 @@
<instance>default</instance> <instance>default</instance>
</interface> </interface>
</hal> </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>
</interface>
</hal>
<hal format="hidl"> <hal format="hidl">
<name>android.hardware.tv.cec</name> <name>android.hardware.tv.cec</name>
<transport>hwbinder</transport> <transport>hwbinder</transport>

View File

@@ -6,7 +6,7 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
VERSION=RaspberryVanillaAOSP13 VERSION=RaspberryVanillaAOSP14
DATE=$(date +%Y%m%d) DATE=$(date +%Y%m%d)
IMGNAME=${VERSION}-${DATE}-rpi4.img IMGNAME=${VERSION}-${DATE}-rpi4.img
IMGSIZE=7 IMGSIZE=7

View File

@@ -12,6 +12,9 @@ on post-fs-data
mkdir /data/vendor/wifi/wpa 0770 wifi wifi mkdir /data/vendor/wifi/wpa 0770 wifi wifi
mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi
# Set indication (checked by vold) that we have finished this action
setprop vold.post_fs_data_done 1
on property:sys.boot_completed=1 on property:sys.boot_completed=1
# Reinit lmkd to reconfigure lmkd properties # Reinit lmkd to reconfigure lmkd properties
setprop lmkd.reinit 1 setprop lmkd.reinit 1

View File

@@ -1,8 +1,8 @@
on boot on boot
mount configfs none /config mount configfs none /config
mkdir /config/usb_gadget/g1 0770 shell shell mkdir /config/usb_gadget/g1 0770
mkdir /config/usb_gadget/g1/strings/0x409 0770 shell shell mkdir /config/usb_gadget/g1/strings/0x409 0770
write /config/usb_gadget/g1/bcdDevice 0x0223 write /config/usb_gadget/g1/bcdDevice 0x0440
write /config/usb_gadget/g1/bcdUSB 0x0200 write /config/usb_gadget/g1/bcdUSB 0x0200
write /config/usb_gadget/g1/idVendor 0x18d1 write /config/usb_gadget/g1/idVendor 0x18d1
write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno} write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno}
@@ -15,8 +15,8 @@ on boot
mkdir /config/usb_gadget/g1/functions/audio_source.gs3 mkdir /config/usb_gadget/g1/functions/audio_source.gs3
mkdir /config/usb_gadget/g1/functions/rndis.gs4 mkdir /config/usb_gadget/g1/functions/rndis.gs4
mkdir /config/usb_gadget/g1/functions/midi.gs5 mkdir /config/usb_gadget/g1/functions/midi.gs5
mkdir /config/usb_gadget/g1/configs/b.1 0770 shell shell mkdir /config/usb_gadget/g1/configs/b.1 0770
mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770
write /config/usb_gadget/g1/configs/b.1/MaxPower 500 write /config/usb_gadget/g1/configs/b.1/MaxPower 500
write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1 write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1
write /config/usb_gadget/g1/os_desc/qw_sign "MSFT100" write /config/usb_gadget/g1/os_desc/qw_sign "MSFT100"
@@ -25,66 +25,65 @@ on boot
mkdir /dev/usb-ffs/mtp 0770 mtp mtp mkdir /dev/usb-ffs/mtp 0770 mtp mtp
mkdir /dev/usb-ffs/ptp 0770 mtp mtp mkdir /dev/usb-ffs/ptp 0770 mtp mtp
setprop sys.usb.mtp.device_type 3 setprop sys.usb.mtp.device_type 3
setprop sys.usb.mtp.batchcancel true
setprop vendor.usb.rndis.config rndis.gs4
symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1 symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1
chown system system /config/usb_gadget/
chown system system /config/usb_gadget/g1
chown system system /config/usb_gadget/g1/UDC
chown system system /config/usb_gadget/g1/bDeviceClass
chown system system /config/usb_gadget/g1/bDeviceProtocol
chown system system /config/usb_gadget/g1/bDeviceSubClass
chown system system /config/usb_gadget/g1/bMaxPacketSize0
chown system system /config/usb_gadget/g1/bcdDevice
chown system system /config/usb_gadget/g1/bcdUSB
chown system system /config/usb_gadget/g1/configs
chown system system /config/usb_gadget/g1/configs/b.1
chown system system /config/usb_gadget/g1/configs/b.1/MaxPower
chown system system /config/usb_gadget/g1/configs/b.1/bmAttributes
chown system system /config/usb_gadget/g1/configs/b.1/strings
chown system system /config/usb_gadget/g1/functions
chown system system /config/usb_gadget/g1/functions/accessory.gs2
chown system system /config/usb_gadget/g1/functions/audio_source.gs3
chown system system /config/usb_gadget/g1/functions/ffs.adb
chown system system /config/usb_gadget/g1/functions/ffs.mtp
chown system system /config/usb_gadget/g1/functions/ffs.ptp
chown system system /config/usb_gadget/g1/functions/midi.gs5
chown system system /config/usb_gadget/g1/functions/midi.gs5/buflen
chown system system /config/usb_gadget/g1/functions/midi.gs5/id
chown system system /config/usb_gadget/g1/functions/midi.gs5/in_ports
chown system system /config/usb_gadget/g1/functions/midi.gs5/index
chown system system /config/usb_gadget/g1/functions/midi.gs5/out_ports
chown system system /config/usb_gadget/g1/functions/midi.gs5/qlen
chown system system /config/usb_gadget/g1/functions/rndis.gs4
chown system system /config/usb_gadget/g1/functions/rndis.gs4/class
chown system system /config/usb_gadget/g1/functions/rndis.gs4/dev_addr
chown system system /config/usb_gadget/g1/functions/rndis.gs4/host_addr
chown system system /config/usb_gadget/g1/functions/rndis.gs4/ifname
chown system system /config/usb_gadget/g1/functions/rndis.gs4/os_desc
chown system system /config/usb_gadget/g1/functions/rndis.gs4/os_desc/interface.rndis
chown system system /config/usb_gadget/g1/functions/rndis.gs4/os_desc/interface.rndis/compatible_id
chown system system /config/usb_gadget/g1/functions/rndis.gs4/os_desc/interface.rndis/sub_compatible_id
chown system system /config/usb_gadget/g1/functions/rndis.gs4/protocol
chown system system /config/usb_gadget/g1/functions/rndis.gs4/qmult
chown system system /config/usb_gadget/g1/functions/rndis.gs4/subclass
chown system system /config/usb_gadget/g1/idProduct
chown system system /config/usb_gadget/g1/idVendor
chown system system /config/usb_gadget/g1/max_speed
chown system system /config/usb_gadget/g1/os_desc
chown system system /config/usb_gadget/g1/os_desc/b.1
chown system system /config/usb_gadget/g1/os_desc/b_vendor_code
chown system system /config/usb_gadget/g1/os_desc/qw_sign
chown system system /config/usb_gadget/g1/os_desc/use
chown system system /config/usb_gadget/g1/strings
chown system system /config/usb_gadget/g1/strings/0x409
chown system system /config/usb_gadget/g1/strings/0x409/manufacturer
chown system system /config/usb_gadget/g1/strings/0x409/product
chown system system /config/usb_gadget/g1/strings/0x409/serialnumber
on property:sys.usb.controller=* on property:sys.usb.controller=*
mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000 mount functionfs adb /dev/usb-ffs/adb rmode=0770,fmode=0660,uid=2000,gid=2000,no_disconnect=1
mount functionfs mtp /dev/usb-ffs/mtp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1 mount functionfs mtp /dev/usb-ffs/mtp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1
mount functionfs ptp /dev/usb-ffs/ptp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1 mount functionfs ptp /dev/usb-ffs/ptp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1
setprop sys.usb.configfs 1 setprop sys.usb.configfs 2
on property:sys.usb.config=none && property:sys.usb.configfs=1
write /config/usb_gadget/g1/os_desc/use 0
on property:sys.usb.config=mtp && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x4ee1
write /config/usb_gadget/g1/os_desc/use 1
symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,adb && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x4ee2
write /config/usb_gadget/g1/os_desc/use 1
symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
on property:sys.usb.config=rndis && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x4ee3
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,adb && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x4ee4
on property:sys.usb.config=ptp && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x4ee5
write /config/usb_gadget/g1/os_desc/use 1
symlink /config/usb_gadget/g1/functions/ffs.ptp /config/usb_gadget/g1/configs/b.1/f1
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=ptp,adb && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x4ee6
write /config/usb_gadget/g1/os_desc/use 1
symlink /config/usb_gadget/g1/functions/ffs.ptp /config/usb_gadget/g1/configs/b.1/f1
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=adb && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x4ee7
on property:sys.usb.config=midi && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x4ee8
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=midi,adb && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x4ee9
on property:sys.usb.config=accessory && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x2d00
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=accessory,adb && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x2d01
on property:sys.usb.config=audio_source && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x2d02
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=audio_source,adb && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x2d03
on property:sys.usb.config=accessory,audio_source && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x2d04
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=accessory,audio_source,adb && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x2d05

View File

@@ -16,6 +16,9 @@
# ION # ION
/dev/ion 0664 system system /dev/ion 0664 system system
# USB
/sys/class/udc/fe980000.usb current_speed 0664 system system
# V4L2 # V4L2
/dev/media0 0660 media media /dev/media0 0660 media media
/dev/media1 0660 media media /dev/media1 0660 media media

View File

@@ -7,7 +7,7 @@
# DRM # DRM
/vendor/bin/hw/android\.hardware\.drm-service\.clearkey u:object_r:hal_drm_clearkey_exec:s0 /vendor/bin/hw/android\.hardware\.drm-service\.clearkey u:object_r:hal_drm_clearkey_exec:s0
/vendor/bin/hw/android\.hardware\.drm-service\.widevine u:object_r:hal_drm_widevine_exec:s0 /vendor/bin/hw/android\.hardware\.drm-service\.widevine(.*)? u:object_r:hal_drm_widevine_exec:s0
# FFmpeg # FFmpeg
/vendor/bin/hw/android\.hardware\.media\.c2@1\.2-service-ffmpeg u:object_r:mediacodec_exec:s0 /vendor/bin/hw/android\.hardware\.media\.c2@1\.2-service-ffmpeg u:object_r:mediacodec_exec:s0
@@ -47,8 +47,8 @@
# Suspend # Suspend
/vendor/bin/suspend_blocker_rpi u:object_r:suspend_blocker_exec:s0 /vendor/bin/suspend_blocker_rpi u:object_r:suspend_blocker_exec:s0
# Thermal # USB
/vendor/bin/hw/android\.hardware\.thermal@2\.0-service\.mock u:object_r:hal_thermal_default_exec:s0 /vendor/bin/hw/android\.hardware\.usb\.gadget@1\.2-service\.rpi u:object_r:hal_usb_gadget_default_exec:s0
# V4L2 # V4L2
/vendor/bin/hw/android\.hardware\.media\.c2@1\.0-service-v4l2(.*)? u:object_r:mediacodec_exec:s0 /vendor/bin/hw/android\.hardware\.media\.c2@1\.0-service-v4l2(.*)? u:object_r:mediacodec_exec:s0

29
usb/Android.bp Normal file
View File

@@ -0,0 +1,29 @@
// Copyright (C) 2020 The Android Open Source Project
// Copyright (C) 2023 KonstaKANG
//
// SPDX-License-Identifier: Apache-2.0
cc_binary {
name: "android.hardware.usb.gadget@1.2-service.rpi",
defaults: ["hidl_defaults"],
relative_install_path: "hw",
init_rc: ["android.hardware.usb.gadget@1.2-service.rpi.rc"],
vintf_fragments: ["android.hardware.usb.gadget@1.2-service.rpi.xml"],
vendor: true,
srcs: [
"service.cpp",
"UsbGadget.cpp",
],
shared_libs: [
"android.hardware.usb.gadget@1.0",
"android.hardware.usb.gadget@1.1",
"android.hardware.usb.gadget@1.2",
"libbase",
"libcutils",
"libhardware",
"libhidlbase",
"liblog",
"libutils",
],
static_libs: ["libusbconfigfs-2"],
}

287
usb/UsbGadget.cpp Normal file
View File

@@ -0,0 +1,287 @@
/*
* 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.
*/
#define LOG_TAG "android.hardware.usb.gadget@1.2-service.rpi"
#include "UsbGadget.h"
#include <dirent.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys/inotify.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
namespace android {
namespace hardware {
namespace usb {
namespace gadget {
namespace V1_2 {
namespace implementation {
UsbGadget::UsbGadget() {
if (access(OS_DESC_PATH, R_OK) != 0) {
ALOGE("configfs setup not done yet");
abort();
}
}
void currentFunctionsAppliedCallback(bool functionsApplied, void* payload) {
UsbGadget* gadget = (UsbGadget*)payload;
gadget->mCurrentUsbFunctionsApplied = functionsApplied;
}
Return<void> UsbGadget::getCurrentUsbFunctions(const sp<V1_0::IUsbGadgetCallback>& callback) {
Return<void> ret = callback->getCurrentUsbFunctionsCb(
mCurrentUsbFunctions, mCurrentUsbFunctionsApplied ? Status::FUNCTIONS_APPLIED
: Status::FUNCTIONS_NOT_APPLIED);
if (!ret.isOk()) ALOGE("Call to getCurrentUsbFunctionsCb failed %s", ret.description().c_str());
return Void();
}
Return<void> UsbGadget::getUsbSpeed(const sp<V1_2::IUsbGadgetCallback>& callback) {
std::string current_speed;
if (ReadFileToString(SPEED_PATH, &current_speed)) {
current_speed = Trim(current_speed);
ALOGI("current USB speed is %s", current_speed.c_str());
if (current_speed == "low-speed")
mUsbSpeed = UsbSpeed::LOWSPEED;
else if (current_speed == "full-speed")
mUsbSpeed = UsbSpeed::FULLSPEED;
else if (current_speed == "high-speed")
mUsbSpeed = UsbSpeed::HIGHSPEED;
else if (current_speed == "super-speed")
mUsbSpeed = UsbSpeed::SUPERSPEED;
else if (current_speed == "super-speed-plus")
mUsbSpeed = UsbSpeed::SUPERSPEED_10Gb;
else if (current_speed == "UNKNOWN")
mUsbSpeed = UsbSpeed::UNKNOWN;
else {
/**
* This part is used for USB4 or reserved speed.
*
* If reserved speed is detected, it needs to convert to other speeds.
* For example:
* If the bandwidth of new speed is 7G, adding new if
* statement and set mUsbSpeed to SUPERSPEED.
* If the bandwidth of new speed is 80G, adding new if
* statement and set mUsbSpeed to USB4_GEN3_40Gb.
*/
mUsbSpeed = UsbSpeed::RESERVED_SPEED;
}
} else {
ALOGE("Fail to read current speed");
mUsbSpeed = UsbSpeed::UNKNOWN;
}
if (callback) {
Return<void> ret = callback->getUsbSpeedCb(mUsbSpeed);
if (!ret.isOk()) ALOGE("Call to getUsbSpeedCb failed %s", ret.description().c_str());
}
return Void();
}
V1_0::Status UsbGadget::tearDownGadget() {
if (resetGadget() != V1_0::Status::SUCCESS) return V1_0::Status::ERROR;
if (monitorFfs.isMonitorRunning()) {
monitorFfs.reset();
} else {
ALOGI("mMonitor not running");
}
return V1_0::Status::SUCCESS;
}
Return<Status> UsbGadget::reset() {
if (!WriteStringToFile("none", PULLUP_PATH)) {
ALOGI("Gadget cannot be pulled down");
return Status::ERROR;
}
usleep(kDisconnectWaitUs);
if (!WriteStringToFile(kGadgetName, PULLUP_PATH)) {
ALOGI("Gadget cannot be pulled up");
return Status::ERROR;
}
return Status::SUCCESS;
}
static V1_0::Status validateAndSetVidPid(uint64_t functions) {
V1_0::Status ret = V1_0::Status::SUCCESS;
switch (functions) {
case static_cast<uint64_t>(V1_2::GadgetFunction::MTP):
ret = setVidPid("0x18d1", "0x4ee1");
break;
case V1_2::GadgetFunction::ADB | V1_2::GadgetFunction::MTP:
ret = setVidPid("0x18d1", "0x4ee2");
break;
case static_cast<uint64_t>(V1_2::GadgetFunction::RNDIS):
ret = setVidPid("0x18d1", "0x4ee3");
break;
case V1_2::GadgetFunction::ADB | V1_2::GadgetFunction::RNDIS:
ret = setVidPid("0x18d1", "0x4ee4");
break;
case static_cast<uint64_t>(V1_2::GadgetFunction::PTP):
ret = setVidPid("0x18d1", "0x4ee5");
break;
case V1_2::GadgetFunction::ADB | V1_2::GadgetFunction::PTP:
ret = setVidPid("0x18d1", "0x4ee6");
break;
case static_cast<uint64_t>(V1_2::GadgetFunction::ADB):
ret = setVidPid("0x18d1", "0x4ee7");
break;
case static_cast<uint64_t>(V1_2::GadgetFunction::MIDI):
ret = setVidPid("0x18d1", "0x4ee8");
break;
case V1_2::GadgetFunction::ADB | V1_2::GadgetFunction::MIDI:
ret = setVidPid("0x18d1", "0x4ee9");
break;
case static_cast<uint64_t>(V1_2::GadgetFunction::NCM):
ret = setVidPid("0x18d1", "0x4eeb");
break;
case V1_2::GadgetFunction::ADB | V1_2::GadgetFunction::NCM:
ret = setVidPid("0x18d1", "0x4eec");
break;
case static_cast<uint64_t>(V1_2::GadgetFunction::ACCESSORY):
ret = setVidPid("0x18d1", "0x2d00");
break;
case V1_2::GadgetFunction::ADB | V1_2::GadgetFunction::ACCESSORY:
ret = setVidPid("0x18d1", "0x2d01");
break;
case static_cast<uint64_t>(V1_2::GadgetFunction::AUDIO_SOURCE):
ret = setVidPid("0x18d1", "0x2d02");
break;
case V1_2::GadgetFunction::ADB | V1_2::GadgetFunction::AUDIO_SOURCE:
ret = setVidPid("0x18d1", "0x2d03");
break;
case V1_2::GadgetFunction::ACCESSORY | V1_2::GadgetFunction::AUDIO_SOURCE:
ret = setVidPid("0x18d1", "0x2d04");
break;
case V1_2::GadgetFunction::ADB | V1_2::GadgetFunction::ACCESSORY |
V1_2::GadgetFunction::AUDIO_SOURCE:
ret = setVidPid("0x18d1", "0x2d05");
break;
default:
ALOGE("Combination not supported");
ret = V1_0::Status::CONFIGURATION_NOT_SUPPORTED;
}
return ret;
}
V1_0::Status UsbGadget::setupFunctions(uint64_t functions,
const sp<V1_0::IUsbGadgetCallback>& callback,
uint64_t timeout) {
bool ffsEnabled = false;
int i = 0;
if (addGenericAndroidFunctions(&monitorFfs, functions, &ffsEnabled, &i) !=
V1_0::Status::SUCCESS)
return V1_0::Status::ERROR;
if ((functions & V1_2::GadgetFunction::ADB) != 0) {
ffsEnabled = true;
if (addAdb(&monitorFfs, &i) != V1_0::Status::SUCCESS) return V1_0::Status::ERROR;
}
// Pull up the gadget right away when there are no ffs functions.
if (!ffsEnabled) {
if (!WriteStringToFile(kGadgetName, PULLUP_PATH)) return V1_0::Status::ERROR;
mCurrentUsbFunctionsApplied = true;
if (callback) callback->setCurrentUsbFunctionsCb(functions, V1_0::Status::SUCCESS);
return V1_0::Status::SUCCESS;
}
monitorFfs.registerFunctionsAppliedCallback(&currentFunctionsAppliedCallback, this);
// Monitors the ffs paths to pull up the gadget when descriptors are written.
// Also takes of the pulling up the gadget again if the userspace process
// dies and restarts.
monitorFfs.startMonitor();
if (kDebug) ALOGI("Mainthread in Cv");
if (callback) {
bool pullup = monitorFfs.waitForPullUp(timeout);
Return<void> ret = callback->setCurrentUsbFunctionsCb(
functions, pullup ? V1_0::Status::SUCCESS : V1_0::Status::ERROR);
if (!ret.isOk()) ALOGE("setCurrentUsbFunctionsCb error %s", ret.description().c_str());
}
return V1_0::Status::SUCCESS;
}
Return<void> UsbGadget::setCurrentUsbFunctions(uint64_t functions,
const sp<V1_0::IUsbGadgetCallback>& callback,
uint64_t timeout) {
std::unique_lock<std::mutex> lk(mLockSetCurrentFunction);
mCurrentUsbFunctions = functions;
mCurrentUsbFunctionsApplied = false;
// Unlink the gadget and stop the monitor if running.
V1_0::Status status = tearDownGadget();
if (status != V1_0::Status::SUCCESS) {
goto error;
}
ALOGI("Returned from tearDown gadget");
// Leave the gadget pulled down to give time for the host to sense disconnect.
usleep(kDisconnectWaitUs);
if (functions == static_cast<uint64_t>(V1_2::GadgetFunction::NONE)) {
if (callback == NULL) return Void();
Return<void> ret = callback->setCurrentUsbFunctionsCb(functions, V1_0::Status::SUCCESS);
if (!ret.isOk())
ALOGE("Error while calling setCurrentUsbFunctionsCb %s", ret.description().c_str());
return Void();
}
status = validateAndSetVidPid(functions);
if (status != V1_0::Status::SUCCESS) {
goto error;
}
status = setupFunctions(functions, callback, timeout);
if (status != V1_0::Status::SUCCESS) {
goto error;
}
ALOGI("Usb Gadget setcurrent functions called successfully");
return Void();
error:
ALOGI("Usb Gadget setcurrent functions failed");
if (callback == NULL) return Void();
Return<void> ret = callback->setCurrentUsbFunctionsCb(functions, status);
if (!ret.isOk())
ALOGE("Error while calling setCurrentUsbFunctionsCb %s", ret.description().c_str());
return Void();
}
} // namespace implementation
} // namespace V1_2
} // namespace gadget
} // namespace usb
} // namespace hardware
} // namespace android

109
usb/UsbGadget.h Normal file
View File

@@ -0,0 +1,109 @@
/*
* 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.
*/
#ifndef ANDROID_HARDWARE_USB_GADGET_V1_2_USBGADGET_H
#define ANDROID_HARDWARE_USB_GADGET_V1_2_USBGADGET_H
#include <UsbGadgetCommon.h>
#include <android-base/file.h>
#include <android-base/properties.h>
#include <android-base/strings.h>
#include <android-base/unique_fd.h>
#include <android/hardware/usb/gadget/1.2/IUsbGadget.h>
#include <android/hardware/usb/gadget/1.2/types.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
#include <sys/epoll.h>
#include <sys/eventfd.h>
#include <utils/Log.h>
#include <chrono>
#include <condition_variable>
#include <mutex>
#include <string>
#include <thread>
namespace android {
namespace hardware {
namespace usb {
namespace gadget {
namespace V1_2 {
namespace implementation {
using ::android::sp;
using ::android::base::GetProperty;
using ::android::base::ReadFileToString;
using ::android::base::SetProperty;
using ::android::base::Trim;
using ::android::base::unique_fd;
using ::android::base::WriteStringToFile;
using ::android::hardware::hidl_array;
using ::android::hardware::hidl_memory;
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::usb::gadget::addAdb;
using ::android::hardware::usb::gadget::addEpollFd;
using ::android::hardware::usb::gadget::getVendorFunctions;
using ::android::hardware::usb::gadget::kDebug;
using ::android::hardware::usb::gadget::kDisconnectWaitUs;
using ::android::hardware::usb::gadget::linkFunction;
using ::android::hardware::usb::gadget::MonitorFfs;
using ::android::hardware::usb::gadget::resetGadget;
using ::android::hardware::usb::gadget::setVidPid;
using ::android::hardware::usb::gadget::unlinkFunctions;
using ::std::string;
constexpr char kGadgetName[] = "fe980000.usb";
static MonitorFfs monitorFfs(kGadgetName);
#define UDC_PATH "/sys/class/udc/fe980000.usb/"
#define SPEED_PATH UDC_PATH "current_speed"
struct UsbGadget : public IUsbGadget {
UsbGadget();
// Makes sure that only one request is processed at a time.
std::mutex mLockSetCurrentFunction;
uint64_t mCurrentUsbFunctions;
bool mCurrentUsbFunctionsApplied;
UsbSpeed mUsbSpeed;
Return<void> setCurrentUsbFunctions(uint64_t functions,
const sp<V1_0::IUsbGadgetCallback>& callback,
uint64_t timeout) override;
Return<void> getCurrentUsbFunctions(const sp<V1_0::IUsbGadgetCallback>& callback) override;
Return<Status> reset() override;
Return<void> getUsbSpeed(const sp<V1_2::IUsbGadgetCallback>& callback) override;
private:
V1_0::Status tearDownGadget();
V1_0::Status setupFunctions(uint64_t functions, const sp<V1_0::IUsbGadgetCallback>& callback,
uint64_t timeout);
};
} // namespace implementation
} // namespace V1_2
} // namespace gadget
} // namespace usb
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_USB_V1_2_USBGADGET_H

View File

@@ -0,0 +1,7 @@
service vendor.usb-gadget-hal-1-2 /vendor/bin/hw/android.hardware.usb.gadget@1.2-service.rpi
interface android.hardware.usb.gadget@1.0::IUsbGadget default
interface android.hardware.usb.gadget@1.1::IUsbGadget default
interface android.hardware.usb.gadget@1.2::IUsbGadget default
class hal
user system
group system shell mtp

View File

@@ -0,0 +1,11 @@
<manifest version="1.0" type="device">
<hal format="hidl">
<name>android.hardware.usb.gadget</name>
<transport>hwbinder</transport>
<version>1.2</version>
<interface>
<name>IUsbGadget</name>
<instance>default</instance>
</interface>
</hal>
</manifest>

53
usb/service.cpp Normal file
View File

@@ -0,0 +1,53 @@
/*
* 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.
*/
#define LOG_TAG "android.hardware.usb.gadget@1.2-service.rpi"
#include <hidl/HidlTransportSupport.h>
#include "UsbGadget.h"
using android::sp;
// libhwbinder:
using android::hardware::configureRpcThreadpool;
using android::hardware::joinRpcThreadpool;
// Generated HIDL files
using android::hardware::usb::gadget::V1_2::IUsbGadget;
using android::hardware::usb::gadget::V1_2::implementation::UsbGadget;
using android::OK;
using android::status_t;
int main() {
configureRpcThreadpool(1, true /*callerWillJoin*/);
android::sp<IUsbGadget> service = new UsbGadget();
status_t status = service->registerAsService();
if (status != OK) {
ALOGE("Cannot register USB Gadget HAL service");
return 1;
}
ALOGI("USB Gadget HAL Ready.");
joinRpcThreadpool();
// Under noraml cases, execution will not reach this line.
ALOGI("USB Gadget HAL failed to join thread pool.");
return 1;
}

View File

@@ -50,6 +50,7 @@ persist.ffmpeg_codec2.v4l2.h264=false
persist.ffmpeg_codec2.v4l2.h265=true persist.ffmpeg_codec2.v4l2.h265=true
# Graphics # Graphics
ro.hardware.egl=mesa
ro.hardware.hwcomposer=drm ro.hardware.hwcomposer=drm
ro.hardware.vulkan=broadcom ro.hardware.vulkan=broadcom
ro.opengles.version=196609 ro.opengles.version=196609
@@ -67,6 +68,12 @@ ro.lmk.medium=800
ro.lmk.upgrade_pressure=100 ro.lmk.upgrade_pressure=100
ro.lmk.use_minfree_levels=true ro.lmk.use_minfree_levels=true
# Lockscreen
ro.lockscreen.disable.default=true
# Media
debug.stagefright.c2inputsurface=-1
# MGLRU # MGLRU
persist.device_config.mglru_native.lru_gen_config=core persist.device_config.mglru_native.lru_gen_config=core