From 4eaae4b893f31c9697b86828d754de2af3a1d316 Mon Sep 17 00:00:00 2001 From: Xianjun Jiao Date: Mon, 28 Mar 2022 12:11:15 +0200 Subject: [PATCH] add on board helper script cd_adi_iio_dir.sh: to find out the correct adi iio sysfs directory --- user_space/cd_adi_iio_dir.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 user_space/cd_adi_iio_dir.sh diff --git a/user_space/cd_adi_iio_dir.sh b/user_space/cd_adi_iio_dir.sh new file mode 100755 index 0000000..32e941d --- /dev/null +++ b/user_space/cd_adi_iio_dir.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +# Author: Xianjun Jiao +# SPDX-FileCopyrightText: 2022 UGent +# SPDX-License-Identifier: AGPL-3.0-or-later + +set -x +if test -f "/sys/bus/iio/devices/iio:device0/in_voltage_rf_bandwidth"; then + cd /sys/bus/iio/devices/iio:device0/ +else if test -f "/sys/bus/iio/devices/iio:device1/in_voltage_rf_bandwidth"; then + cd /sys/bus/iio/devices/iio:device1/ + else if test -f "/sys/bus/iio/devices/iio:device2/in_voltage_rf_bandwidth"; then + cd /sys/bus/iio/devices/iio:device2/ + else if test -f "/sys/bus/iio/devices/iio:device3/in_voltage_rf_bandwidth"; then + cd /sys/bus/iio/devices/iio:device3/ + else if test -f "/sys/bus/iio/devices/iio:device4/in_voltage_rf_bandwidth"; then + cd /sys/bus/iio/devices/iio:device4/ + else + echo "Can not find in_voltage_rf_bandwidth!" + echo "Check log to make sure ad9361 driver is loaded!" + exit 1 + fi + fi + fi + fi +fi +set +x