blob: efdfd6b0aa023217f677cf6dfdaa4042352f0f59 [file] [log] [blame]
Victor Liuc85025d2022-02-15 08:19:10 -08001#!/vendor/bin/sh
2# only use xtal_trim from factory calibration
3if [ -z "$2" ]
4then
5 echo "usage is $0 input-calibration output_calibration"
6 exit 0
7fi
8OUTPUT_CALIB="$2"
9if [ ! -f "$OUTPUT_CALIB" ]; then
10 touch $OUTPUT_CALIB
Victor Liu4fd515b2022-03-09 10:40:48 -080011 chmod 0644 $OUTPUT_CALIB
Victor Liuc85025d2022-02-15 08:19:10 -080012 file="$1"
13 while IFS=, read -r f1 f2
14 do
15 case $f1 in
16 "UWB_cal_tx_xtal_reg_final_value")
17 if [ $((0x$f2)) -gt 63 ]; then
18 f2=63
19 fi
20 echo 'xtal_trim=0x'$f2 >> $OUTPUT_CALIB
21 ;;
22 esac
23 done <"$file"
24 exit 0
25fi