From 1b32c75a560c1b5c6bff9913e5a0e6f52bdfad06 Mon Sep 17 00:00:00 2001 From: Akash Srivastava Date: Mon, 18 Jul 2022 07:49:47 +0000 Subject: [PATCH] star: Fix laser autofocus * Star uses stmvl53l5 sensor for laser autofocus --- rootdir/etc/init.target.rc | 3 +++ sepolicy/vendor/file_contexts | 3 +++ sepolicy/vendor/hal_camera_default.te | 2 ++ sepolicy/vendor/hal_sensors_default.te | 2 ++ sepolicy/vendor/stmvl53l5_device.te | 1 + 5 files changed, 11 insertions(+) create mode 100644 sepolicy/vendor/stmvl53l5_device.te diff --git a/rootdir/etc/init.target.rc b/rootdir/etc/init.target.rc index b647d83..e0f9850 100644 --- a/rootdir/etc/init.target.rc +++ b/rootdir/etc/init.target.rc @@ -125,6 +125,9 @@ on boot chown system system /dev/xiaomi-touch chmod 0660 /dev/xiaomi-touch + chmod 0666 /dev/stmvl53l5 + chown system system /dev/stmvl53l5 + write /dev/cpuset/audio-app/cpus 1-2 chown system /sys/devices/system/cpu/hyp_core_ctl/enable diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts index fe84a20..3f55a2b 100644 --- a/sepolicy/vendor/file_contexts +++ b/sepolicy/vendor/file_contexts @@ -20,6 +20,9 @@ # IR /dev/ir_spi u:object_r:ir_spi_device:s0 +# Laser autofocus +/dev/stmvl53l5 u:object_r:stmvl53l5_device:s0 + # Mlipay /(vendor|system/vendor)/bin/mlipayd@1.1 u:object_r:hal_mlipay_default_exec:s0 diff --git a/sepolicy/vendor/hal_camera_default.te b/sepolicy/vendor/hal_camera_default.te index adec227..bcc2bbb 100644 --- a/sepolicy/vendor/hal_camera_default.te +++ b/sepolicy/vendor/hal_camera_default.te @@ -10,4 +10,6 @@ add_hwservice(hal_camera_default, hal_camerapostproc_xiaomi_hwservice) allow hal_camera_default system_server:binder { call }; allow hal_camera_default mnt_vendor_file:dir { search }; +allow hal_camera_default stmvl53l5_device:chr_file { ioctl read write open }; + vendor_public_prop(vendor_camera_sensor_prop) diff --git a/sepolicy/vendor/hal_sensors_default.te b/sepolicy/vendor/hal_sensors_default.te index a5418fc..25a8f8f 100644 --- a/sepolicy/vendor/hal_sensors_default.te +++ b/sepolicy/vendor/hal_sensors_default.te @@ -4,6 +4,8 @@ allow hal_sensors_default audio_socket:sock_file rw_file_perms; allow hal_sensors_default sound_device:chr_file rw_file_perms; allow hal_sensors_default hal_audio_default:unix_stream_socket connectto; +allow hal_sensors_default stmvl53l5_device:chr_file { ioctl read write open }; + allow hal_sensors_default iio_device:chr_file r_file_perms; allow hal_sensors_default vendor_sysfs_iio:dir r_dir_perms; allow hal_sensors_default vendor_sysfs_iio:file rw_file_perms; diff --git a/sepolicy/vendor/stmvl53l5_device.te b/sepolicy/vendor/stmvl53l5_device.te new file mode 100644 index 0000000..8e8c34e --- /dev/null +++ b/sepolicy/vendor/stmvl53l5_device.te @@ -0,0 +1 @@ +type stmvl53l5_device, dev_type;