This repository has been archived on 2025-09-03. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
device_motorola_sanders-lin…/rootdir/etc/init.mmi.laser.sh
Sohamlad7 d751dc3717 sanders: Change audio.calfile and rild path
* and change sbin path to vendor

Change-Id: Iee8427abfdfc999ab8ca00161065105ec3eb6f84
2018-07-19 03:02:50 -03:00

49 lines
1019 B
Bash

#!/vendor/bin/sh
scriptname=${0##*/}
dbg_on=1
debug()
{
[ $dbg_on ] && echo "Debug: $*"
}
notice()
{
echo "$*"
echo "$scriptname: $*" > /dev/kmsg
}
error_and_leave()
{
local err_msg
local err_code=$1
case $err_code in
1) err_msg="Error: No response";;
2) err_msg="Error: in factory mode";;
3) err_msg="Error: calibration file not exist";;
4) err_msg="Error: the calibration sys file not show up";;
esac
notice "$err_msg"
exit $err_code
}
bootmode=`getprop ro.bootmode`
if [ $bootmode == "mot-factory" ]
then
error_and_leave 2
fi
laser_offset_path=/sys/kernel/range/offset
laser_offset_string=$(ls $laser_offset_path)
[ -z "$laser_offset_string" ] && error_and_leave 4
cal_offset_path=/persist/camera/focus/offset_cal
cal_offset_string=$(ls $cal_offset_path)
[ -z "$cal_offset_string" ] && error_and_leave 3
offset_cal=$(cat $cal_offset_path)
debug "offset cal value [$offset_cal]"
debug "set cal value to kernel"
echo $offset_cal > $laser_offset_path
notice "laser cal data update success"