xref: /openwifi/user_space/check_calib_inf.sh (revision dce2bea9db2265074c3c5edf1269d6ac8ffd9fec)
1#!/bin/bash
2
3set -x
4if test -f "/sys/kernel/debug/iio/iio:device0/direct_reg_access"; then
5  device_path=/sys/kernel/debug/iio/iio:device0/
6else if test -f "/sys/kernel/debug/iio/iio:device1/direct_reg_access"; then
7       device_path=/sys/kernel/debug/iio/iio:device1/
8     else if test -f "/sys/kernel/debug/iio/iio:device2/direct_reg_access"; then
9            device_path=/sys/kernel/debug/iio/iio:device2/
10          else if test -f "/sys/kernel/debug/iio/iio:device3/direct_reg_access"; then
11                 device_path=/sys/kernel/debug/iio/iio:device3/
12               else if test -f "/sys/kernel/debug/iio/iio:device4/direct_reg_access"; then
13                      device_path=/sys/kernel/debug/iio/iio:device4/
14                    else
15                      echo "Check log to make sure ad9361 driver is loaded!"
16                      exit 1
17                    fi
18               fi
19          fi
20     fi
21fi
22set +x
23
24(bash -c 'echo $PPID' > /tmp/check_calib_inf.pid
25while true; do
26	echo 0x0A7 > ${device_path}direct_reg_access
27	status=$( cat ${device_path}direct_reg_access )
28	if [ $status == "0xFF" ]; then
29		echo "WARNING: Tx Quadrature Calibration failed."
30	fi
31	sleep 5
32done) &
33
34