mirror of
https://github.com/Evolution-X-Devices/device_google_taimen
synced 2026-01-27 15:59:12 +00:00
Fix ALS/prox calibration at init if needed
Bug: 38066490 Test: loaded on taimen and verified behavior and registry Change-Id: I08c27bd3f62dcad90854815e70be49fb21294db9
This commit is contained in:
@@ -21,6 +21,7 @@ BOARD_KERNEL_CMDLINE += console=ttyMSM0,115200,n8 earlycon=msm_serial_dm,0xc1b00
|
||||
|
||||
include device/google/wahoo/BoardConfig.mk
|
||||
|
||||
BOARD_SEPOLICY_DIRS += device/google/taimen/sepolicy
|
||||
BOARD_BOOTIMAGE_PARTITION_SIZE := 41943040
|
||||
BOARD_AVB_ENABLE := true
|
||||
|
||||
|
||||
@@ -82,3 +82,7 @@ PRODUCT_COPY_FILES += \
|
||||
PRODUCT_PROPERTY_OVERRIDES += \
|
||||
persist.config.calibration_cad=/vendor/etc/sensors/calibration_cad.xml \
|
||||
persist.config.calibration_fac=/persist/sensors/calibration/calibration.xml
|
||||
|
||||
# Temporary ALS/prox calibration reset
|
||||
PRODUCT_COPY_FILES += \
|
||||
device/google/taimen/init.resetcalib.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.resetcalib.sh
|
||||
|
||||
@@ -2,6 +2,9 @@ on init && property:ro.boot.slot=*
|
||||
# will remove this once slot_suffix is deprecated
|
||||
setprop ro.boot.slot_suffix _${ro.boot.slot}
|
||||
|
||||
on late-fs && property:ro.boot.revision=rev_a
|
||||
start resetcalib_sh
|
||||
|
||||
on post-fs-data
|
||||
# QC Sensors
|
||||
mkdir /persist/sensors
|
||||
@@ -16,3 +19,10 @@ on property:init.svc.fps_hal=running && property:ro.boot.revision=rev_0
|
||||
on property:sys.all.modules.ready=1
|
||||
# Update touch firmware if required
|
||||
write /sys/devices/virtual/input/ftm4_touch/check_fw 1
|
||||
|
||||
service resetcalib_sh /vendor/bin/init.resetcalib.sh
|
||||
class main
|
||||
user root
|
||||
group root system
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
19
init.resetcalib.sh
Executable file
19
init.resetcalib.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/system/bin/sh
|
||||
ALS_FACTOR=$(od -An -t d2 -j 0x114 -N 2 /persist/sensors/sns.reg | xargs echo)
|
||||
PROX_THRESHOLD=$(od -An -t d2 -j 0x104 -N 2 /persist/sensors/sns.reg | xargs echo)
|
||||
# Set ALS calibration factor to default if needed
|
||||
if [[ $ALS_FACTOR = "1200" ]]; then
|
||||
cp /persist/sensors/sns.reg /persist/sensors/sns.reg.orig
|
||||
xxd /persist/sensors/sns.reg.orig | sed 's/\(00000110: .... ....\) ..../\1 9411/' | xxd -r > /persist/sensors/sns.reg
|
||||
RECALIBRATED=1
|
||||
fi
|
||||
# Overwrite prox threshold if needed
|
||||
if [[ $PROX_THRESHOLD = "6656" ]]; then
|
||||
cp /persist/sensors/sns.reg /persist/sensors/sns.reg.orig
|
||||
xxd /persist/sensors/sns.reg.orig | sed 's/\(00000100: .... ....\) ..../\1 0002/' | xxd -r > /persist/sensors/sns.reg
|
||||
RECALIBRATED=1
|
||||
fi
|
||||
if [[ -n $RECALIBRATED ]]; then
|
||||
echo related > /sys/bus/msm_subsys/devices/subsys5/restart_level
|
||||
echo restart > /sys/kernel/debug/msm_subsys/slpi
|
||||
fi
|
||||
2
sepolicy/file_contexts
Normal file
2
sepolicy/file_contexts
Normal file
@@ -0,0 +1,2 @@
|
||||
# files in /vendor
|
||||
/vendor/bin/init\.resetcalib\.sh u:object_r:init-resetcalib-sh_exec:s0
|
||||
15
sepolicy/init-resetcalib-sh.te
Normal file
15
sepolicy/init-resetcalib-sh.te
Normal file
@@ -0,0 +1,15 @@
|
||||
type init-resetcalib-sh, domain, vendor_executes_system_violators;
|
||||
type init-resetcalib-sh_exec, exec_type, vendor_file_type, file_type;
|
||||
|
||||
init_daemon_domain(init-resetcalib-sh)
|
||||
|
||||
allow init-resetcalib-sh shell_exec:file rx_file_perms;
|
||||
allow init-resetcalib-sh persist_file:dir search;
|
||||
allow init-resetcalib-sh persist_sensors_file:dir search;
|
||||
allow init-resetcalib-sh persist_sensors_file:file { getattr open read write };
|
||||
allow init-resetcalib-sh self:capability dac_override;
|
||||
allow init-resetcalib-sh toolbox_exec:file { execute execute_no_trans getattr open read };
|
||||
allow init-resetcalib-sh sysfs_msm_subsys:dir search;
|
||||
allow init-resetcalib-sh sysfs_msm_subsys:file { open write };
|
||||
allow init-resetcalib-sh sysfs_msm_subsys:lnk_file read;
|
||||
allow init-resetcalib-sh system_data_file:dir getattr;
|
||||
Reference in New Issue
Block a user