1#!/bin/bash
2
3# This script is used to generate uwb conuntry configuration file,
4# and the PRODUCT_COPY_FILES list in uwb.mk based on uwb_country.conf
5# Bug: 196073172
6
7project=("r4" "p7")
8count=1
9
10while read line ; do
11    if [[ "$line" =~ ^"*" ]]; then
12        header=${line:1}
13    elif [[ "$line" =~ ^"\"" ]]; then
14        line=$(echo ${line/,} | tr -d "\"")
15        country[count]=$(echo $line | cut -d ':' -f1)
16        code[count]=$(echo $line | cut -d ':' -f2 | tr -d " ")
17
18            if [ "$header" = "restricted_channels=0x20" ]; then
19                echo "alternate_pulse_shape=0x01" > UWB-calibration-${code[$count]}.conf
20                echo "$header" >> UWB-calibration-${code[$count]}.conf
21            else
22            echo "$header" > UWB-calibration-${code[$count]}.conf
23            fi
24    fi
25((count++))
26done < uwb_country.conf
27
28    echo "==============  $var  =============="
29    for var2 in ${code[@]}; do
30            echo "\$(LOCAL_UWB_CAL_DIR)/UWB-calibration-$var2.conf:\$(TARGET_COPY_OUT_VENDOR)/etc/UWB-calibration-$var2.conf \\"
31    done
32