From dce2bea9db2265074c3c5edf1269d6ac8ffd9fec Mon Sep 17 00:00:00 2001 From: thavinga Date: Mon, 28 Mar 2022 12:10:55 +0200 Subject: [PATCH] Make check_calib_inf.sh work for all boards Search for direct_reg_access location. --- user_space/check_calib_inf.sh | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/user_space/check_calib_inf.sh b/user_space/check_calib_inf.sh index 46b61ac..14c43eb 100644 --- a/user_space/check_calib_inf.sh +++ b/user_space/check_calib_inf.sh @@ -1,9 +1,30 @@ #!/bin/bash +set -x +if test -f "/sys/kernel/debug/iio/iio:device0/direct_reg_access"; then + device_path=/sys/kernel/debug/iio/iio:device0/ +else if test -f "/sys/kernel/debug/iio/iio:device1/direct_reg_access"; then + device_path=/sys/kernel/debug/iio/iio:device1/ + else if test -f "/sys/kernel/debug/iio/iio:device2/direct_reg_access"; then + device_path=/sys/kernel/debug/iio/iio:device2/ + else if test -f "/sys/kernel/debug/iio/iio:device3/direct_reg_access"; then + device_path=/sys/kernel/debug/iio/iio:device3/ + else if test -f "/sys/kernel/debug/iio/iio:device4/direct_reg_access"; then + device_path=/sys/kernel/debug/iio/iio:device4/ + else + echo "Check log to make sure ad9361 driver is loaded!" + exit 1 + fi + fi + fi + fi +fi +set +x + (bash -c 'echo $PPID' > /tmp/check_calib_inf.pid while true; do - echo 0x0A7 > /sys/kernel/debug/iio/iio:device2/direct_reg_access - status=$( cat /sys/kernel/debug/iio/iio:device2/direct_reg_access ) + echo 0x0A7 > ${device_path}direct_reg_access + status=$( cat ${device_path}direct_reg_access ) if [ $status == "0xFF" ]; then echo "WARNING: Tx Quadrature Calibration failed." fi