RK3568 android13 user模式下HDMI没有声音
问题描述:
在android13,RK3568平台上。userdebug模式下,HDMI有声音。user模式没有声音。
log分析:
06-04 07:53:15.706 484 504 E ExtconStateObserver: Could not get the alias name. 06-04 07:53:15.706 484 504 E ExtconStateObserver: java.io.FileNotFoundException: /sys/class/extcon/extcon4/device/uevent: open failed: EACCES (Permission denied)
可以看到是没有权限去打开文件。
通过log提示,使用ADB查看/sys/class/extcon/extcon4 的信息。找到extcon4是属于fe0a0000.hdmi下面的。
QP1100:/sys/class/extcon/extcon4 # ls cable.0 device name power state subsystem uevent QP1100:/sys/class/extcon/extcon4 # cat name fe0a0000.hdmi QP1100:/sys/class/extcon/extcon4 #
在 device/rockchip/common/sepolicy/vendor/genfs_contexts 下面添加如下权限。
genfscon sysfs /devices/platform/fe0a0000.hdmi/extcon/extcon4 u:object_r:sysfs_extcon:s0
genfscon sysfs /devices/platform/fe0a0000.hdmi/uevent u:object_r:sysfs_extcon:s0
最后编译成user版本,测试OK。
在调试HDMI user模式下,还有其他类似的权限问题,也一起解决了。如下:
06-04 07:53:15.724 484 504 E ExtconStateObserver: java.io.FileNotFoundException: /sys/class/extcon/extcon0/device/uevent: open failed: EACCES (Permission denied) 06-04 07:53:15.727 484 504 E ExtconStateObserver: java.io.FileNotFoundException: /sys/class/extcon/extcon1/device/uevent: open failed: EACCES (Permission denied) 06-04 07:53:26.838 484 484 W ExtconUEventObserver: java.io.FileNotFoundException: /sys/class/extcon/extcon3/cable.0/name: open failed: EACCES (Permission denied) 06-04 07:53:30.874 484 484 E ExtconStateObserver: java.io.FileNotFoundException: /sys/class/extcon/extcon2/device/uevent: open failed: EACCES (Permission denied) 06-04 07:53:30.877 484 484 E ExtconStateObserver: java.io.FileNotFoundException: /sys/class/extcon/extcon5/device/uevent: open failed: EACCES (Permission denied)
通过adb 查找对应信息
QP1100:/sys/class/extcon # ls extcon0 extcon1 extcon2 extcon3 extcon4 extcon5 QP1100:/sys/class/extcon # cat extcon0/name fe8a0000.usb2-phy QP1100:/sys/class/extcon # cat extcon1/name fe8b0000.usb2-phy QP1100:/sys/class/extcon # cat extcon2/name rk809-sound QP1100:/sys/class/extcon # cat extcon3/name fe0c0000.edp QP1100:/sys/class/extcon # cat extcon5/name rk-headset QP1100:/sys/class/extcon #
添加权限:
genfscon sysfs /devices/platform/fe8a0000.usb2-phy/extcon/extcon0 u:object_r:sysfs_extcon:s0 genfscon sysfs /devices/platform/fe8b0000.usb2-phy/extcon/extcon1 u:object_r:sysfs_extcon:s0 genfscon sysfs /devices/platform/rk809-sound/extcon/extcon2 u:object_r:sysfs_extcon:s0 genfscon sysfs /devices/platform/fe0c0000.edp/extcon/extcon3 u:object_r:sysfs_extcon:s0 genfscon sysfs /devices/platform/rk-headset/extcon/extcon5 u:object_r:sysfs_extcon:s0 genfscon sysfs /devices/platform/fe8a0000.usb2-phy/uevent u:object_r:sysfs_extcon:s0 genfscon sysfs /devices/platform/fe8b0000.usb2-phy/uevent u:object_r:sysfs_extcon:s0 genfscon sysfs /devices/platform/rk809-sound/uevent u:object_r:sysfs_extcon:s0 genfscon sysfs /devices/platform/fe0c0000.edp/uevent u:object_r:sysfs_extcon:s0 genfscon sysfs /devices/platform/rk-headset/uevent u:object_r:sysfs_extcon:s0