device_google_tangorpro/uwb/init.uwb.calib.xtal.sh
Rex Lin a5f757134c uwb: enable production stack on T6P
Bug: 236791087
Test: ranging works
Signed-off-by: Rex Lin <rexcylin@google.com>
Change-Id: Id912e57c1282bbfc75560da4f87d62ddbbe1e9a0
2022-06-29 11:24:37 +08:00

25 lines
592 B
Bash

#!/vendor/bin/sh
# only use xtal_trim from factory calibration
if [ -z "$2" ]
then
echo "usage is $0 input-calibration output_calibration"
exit 0
fi
OUTPUT_CALIB="$2"
if [ ! -f "$OUTPUT_CALIB" ]; then
touch $OUTPUT_CALIB
chmod 0644 $OUTPUT_CALIB
file="$1"
while IFS=, read -r f1 f2
do
case $f1 in
"UWB_cal_tx_xtal_reg_final_value")
if [ $((0x$f2)) -gt 63 ]; then
f2=63
fi
echo 'xtal_trim=0x'$f2 >> $OUTPUT_CALIB
;;
esac
done <"$file"
exit 0
fi