-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make sure to check and set pluto fw attrs to ad9361
- Loading branch information
Showing
5 changed files
with
98 additions
and
3 deletions.
There are no files selected for viewing
80 changes: 80 additions & 0 deletions
80
data_collection_model_and_results/rover/rover_v3.1/check_and_set_pluto.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#!/bin/bash | ||
|
||
eths=`ls /sys/class/net/ -l | awk '{print $NF}' | grep usb | xargs -l basename` | ||
|
||
function turn_on_eths { | ||
for ethx in ${eths}; do | ||
sudo ifconfig ${ethx} up | ||
done | ||
} | ||
|
||
function turn_off_eths { | ||
for ethx in ${eths}; do | ||
sudo ifconfig ${ethx} down | ||
done | ||
} | ||
|
||
|
||
function check_pluto { | ||
rm -f pluto_env | ||
sshpass -panalog ssh root@192.168.2.1 'fw_printenv' > pluto_env 2> /dev/null | ||
grep 'attr_name=compatible' pluto_env > /dev/null | ||
if [ $? -ne 0 ]; then | ||
return 1 | ||
fi | ||
grep 'attr_val=ad9361' pluto_env > /dev/null | ||
if [ $? -ne 0 ]; then | ||
return 1 | ||
fi | ||
grep 'compatible=ad9361' pluto_env > /dev/null | ||
if [ $? -ne 0 ]; then | ||
return 1 | ||
fi | ||
return 0 | ||
} | ||
|
||
function set_and_reboot_pluto { | ||
sshpass -panalog ssh root@192.168.2.1 'fw_setenv attr_name compatible; fw_setenv attr_val ad9361; fw_setenv compatible ad9361; fw_setenv mode 2r2t' > /dev/null 2>&1 | ||
sshpass -panalog ssh root@192.168.2.1 'reboot' > /dev/null 2>&1 | ||
|
||
|
||
} | ||
|
||
function wait_for_pluto { | ||
while [ 0 -eq 0 ]; do | ||
sshpass -panalog ssh -o ConnectTimeout=1 root@192.168.2.1 uptime > /dev/null 2>&1 | ||
if [ $? -eq 0 ]; then | ||
return 0 | ||
fi | ||
sleep 0.5 | ||
done | ||
} | ||
|
||
for eth in ${eths}; do | ||
turn_off_eths | ||
sudo ifconfig ${eth} up | ||
echo "Wait for pluto on $eth" | ||
wait_for_pluto | ||
check_pluto | ||
if [ $? -ne 0 ]; then | ||
echo "Setting fw param on $eth" | ||
set_and_reboot_pluto | ||
sleep 10 # wait for reboot to start | ||
echo "Waiting for pluto to come back up" | ||
wait_for_pluto | ||
check_pluto | ||
if [ $? -ne 0 ]; then | ||
echo "FAILED TO SET PARAMS ON $eth" | ||
else | ||
echo "Successfully set params on $eth" | ||
fi | ||
else | ||
echo "Params already set on $eth" | ||
fi | ||
wait_for_pluto # lets make sure its online before we turn off this interface again | ||
done | ||
|
||
turn_on_eths | ||
sleep 0.5 | ||
|
||
lsusb -t | grep usb-storage | sed 's/.*Port \([0-9]*\): Dev \([0-9]*\),.*/\1 \2/g' > ~/device_mapping # update out USB mappings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
data_collection_model_and_results/rover/rover_v3.1/install_deps.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
sudo apt-get update | ||
sudo apt-get install git screen libiio-dev libiio-utils vim python3-dev uhubctl libusb-dev libusb-1.0-0-dev sshpass -y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
data_collection_model_and_results/rover/rover_v3.1/ssh_config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Host 192.168.2.* | ||
StrictHostKeyChecking no | ||
UserKnownHostsFile=/dev/null |