openwifi/user_space/rssi_show.sh

37 lines
1.2 KiB
Bash
Raw Normal View History

2023-01-10 15:16:08 +00:00
#!/bin/bash
# Reads RSSI in dB from RX1, let's call it "r".
# Linear fit offset "o" depends on frequency (2.4GHz or 5GHz and FMCOMMS2/3).
# RSSI(dBm) = -r + o
# 2.4GHz FMCOMMS2: o = 16.74
# 2.4GHz FMCOMMS3: o = 17.44
# 5GHz FMCOMMS2: o = 25.41
# 5GHz FMCOMMS3: o = 24.58
home_dir=$(pwd)
set -x
if test -f "/sys/bus/iio/devices/iio:device0/in_voltage0_rssi"; then
cd /sys/bus/iio/devices/iio:device0/
else if test -f "/sys/bus/iio/devices/iio:device1/in_voltage0_rssi"; then
cd /sys/bus/iio/devices/iio:device1/
else if test -f "/sys/bus/iio/devices/iio:device2/in_voltage0_rssi"; then
cd /sys/bus/iio/devices/iio:device2/
else if test -f "/sys/bus/iio/devices/iio:device3/in_voltage0_rssi"; then
cd /sys/bus/iio/devices/iio:device3/
else if test -f "/sys/bus/iio/devices/iio:device4/in_voltage0_rssi"; 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
cat in_voltage0_rssi
cd $home_dir