uwb: add calibration script to device folder
copy calibration script in uwb make Bug: 219611318 Test: builds Signed-off-by: Victor Liu <victorliu@google.com> Change-Id: I3d75f4cbdc046082c7ce005e58a2b68e1d65ddfe
This commit is contained in:
parent
d945dc90a1
commit
c85025d971
3 changed files with 84 additions and 1 deletions
57
uwb/calibration/init.uwb.calib.sh
Normal file
57
uwb/calibration/init.uwb.calib.sh
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
#!/vendor/bin/sh
|
||||||
|
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 0600 $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
|
||||||
|
;;
|
||||||
|
"UWB_TX1RX1_CH5_tx_ant_delay_cal_data")
|
||||||
|
echo 'ant0.ch5.prf64.ant_delay=0x'$f2 >> $OUTPUT_CALIB
|
||||||
|
;;
|
||||||
|
"UWB_TX1RX1_CH5_rx_ant_delay_cal_data")
|
||||||
|
echo 'ant1.ch5.prf64.ant_delay=0x'$f2 >> $OUTPUT_CALIB
|
||||||
|
;;
|
||||||
|
"UWB_TX1RX1_CH9_tx_ant_delay_cal_data")
|
||||||
|
echo 'ant0.ch9.prf64.ant_delay=0x'$f2 >> $OUTPUT_CALIB
|
||||||
|
;;
|
||||||
|
"UWB_TX1RX1_CH9_rx_ant_delay_cal_data")
|
||||||
|
echo 'ant1.ch9.prf64.ant_delay=0x'$f2 >> $OUTPUT_CALIB
|
||||||
|
;;
|
||||||
|
"UWB_RX2_CH5_cal_pdoa_data")
|
||||||
|
# float value * 2048
|
||||||
|
#/vendor/bin/sh does not support "bc"
|
||||||
|
base=2048
|
||||||
|
ones=${f2%%.*}
|
||||||
|
dec=${f2#*.}
|
||||||
|
ones="$(($ones*$base))"
|
||||||
|
if [ ${#dec} -eq 2 ]; then
|
||||||
|
dec="$(($dec*$base/100))"
|
||||||
|
echo 'ant1.ant3.ch5.pdoa_offset='$(($ones+$dec)) >> $OUTPUT_CALIB
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"UWB_RX2_CH9_cal_pdoa_data")
|
||||||
|
base=2048
|
||||||
|
ones=${f2%%.*}
|
||||||
|
dec=${f2#*.}
|
||||||
|
ones="$(($ones*$base))"
|
||||||
|
if [ ${#dec} -eq 2 ]; then
|
||||||
|
dec="$(($dec*$base/100))"
|
||||||
|
echo 'ant1.ant3.ch9.pdoa_offset='$(($ones+$dec)) >> $OUTPUT_CALIB
|
||||||
|
fi
|
||||||
|
esac
|
||||||
|
done <"$file"
|
||||||
|
exit 0
|
||||||
|
fi
|
25
uwb/calibration/init.uwb.calib.xtal.sh
Normal file
25
uwb/calibration/init.uwb.calib.xtal.sh
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#!/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 0600 $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
|
|
@ -35,7 +35,8 @@ PRODUCT_COPY_FILES += \
|
||||||
$(LOCAL_UWB_CAL_DIR)/UWB-calibration-tj.conf:$(TARGET_COPY_OUT_VENDOR)/etc/UWB-calibration-tj.conf \
|
$(LOCAL_UWB_CAL_DIR)/UWB-calibration-tj.conf:$(TARGET_COPY_OUT_VENDOR)/etc/UWB-calibration-tj.conf \
|
||||||
$(LOCAL_UWB_CAL_DIR)/UWB-calibration-tm.conf:$(TARGET_COPY_OUT_VENDOR)/etc/UWB-calibration-tm.conf \
|
$(LOCAL_UWB_CAL_DIR)/UWB-calibration-tm.conf:$(TARGET_COPY_OUT_VENDOR)/etc/UWB-calibration-tm.conf \
|
||||||
$(LOCAL_UWB_CAL_DIR)/UWB-calibration-ua.conf:$(TARGET_COPY_OUT_VENDOR)/etc/UWB-calibration-ua.conf \
|
$(LOCAL_UWB_CAL_DIR)/UWB-calibration-ua.conf:$(TARGET_COPY_OUT_VENDOR)/etc/UWB-calibration-ua.conf \
|
||||||
$(LOCAL_UWB_CAL_DIR)/UWB-calibration-uz.conf:$(TARGET_COPY_OUT_VENDOR)/etc/UWB-calibration-uz.conf
|
$(LOCAL_UWB_CAL_DIR)/UWB-calibration-uz.conf:$(TARGET_COPY_OUT_VENDOR)/etc/UWB-calibration-uz.conf \
|
||||||
|
$(LOCAL_UWB_CAL_DIR)/init.uwb.calib.xtal.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.uwb.calib.sh \
|
||||||
|
|
||||||
PRODUCT_COPY_FILES += \
|
PRODUCT_COPY_FILES += \
|
||||||
frameworks/native/data/etc/android.hardware.uwb.xml:$(TARGET_COPY_OUT_SYSTEM_EXT)/etc/permissions/android.hardware.uwb.xml
|
frameworks/native/data/etc/android.hardware.uwb.xml:$(TARGET_COPY_OUT_SYSTEM_EXT)/etc/permissions/android.hardware.uwb.xml
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue