Date Tags bash / ibss

Our batch of Raspberry Pis are all equipped with a TP-LINK TL-WN722N WiFi Dongle, which we use for testing our protocols. During the initial setup of the testbed, we have experience quite some trouble with these devices, as they didn’t always bring up the interface in a proper manner. And even worse: This ocurred between arbitrary pairs of devices, even though they were all placed in the same room.

To test wether the wireless links were running between every possible pair of devices, I created this little neat script:

mesh_ping.sh download
#!/bin/bash
 
# command to run with ssh
cmd='failed="";\
     for w in 0 1 2 8 9 11 13 14 15 16; do\
         ping -c1 w$w &> /dev/null || failed="$failed $w";\
     done;\
     if [ "$failed" != "" ]; then\
         echo " Failed $failed";\
         exit 1;\
     fi;\
     exit 0;'
 
# for each node number
for n in 00 01 02 08 09 11 13 14 15 16; do
    # ssh into node $n and execute the lines in $cmd
    echo -n "testing rasp$n..."
    ssh rasp$n.lab.es.aau.dk "eval $cmd" && echo " OK"
done

It simply logs into to every device given in the second for-loop, from which it will ping every device given in the first for-loop. The result tells you, in a nice way, which devices aren’t able to communicate.