3 # control-mote.sh TTY CMD
7 # Rostislav Spinar 2008
8 # rostislav.spinar@cit.ie
10 #Get parameters from command line
14 #Have it as a env. variable
17 #Check the parameters first
18 #Suppose to have 2 args
19 if [ "$#" -ne 2 ]; then
20 echo "Uncorrect number of arguments"
24 if [[ -n "$TTY" && -c "$TTY" ]]; then
25 echo "Using port $TTY..."
27 echo "Port has to be defined..."
31 #Run command(reset, stop & start(reset from DIKU_MCH))
33 "reset" |
"stop" |
"start")
34 if [ "$PLATFORM" = "TMoteSky" ]; then
35 echo "The $PLATFORM mote...$CMD"
36 if [ "$CMD" = "start" ]; then
39 #echo "tos-bsl --telosb -c $TTY --$CMD"
40 echo "cppbsl -D -b -c $TTY --$CMD"
41 #tos-bsl --telosb -c "$TTY" --"$CMD"
42 cppbsl
-D -b -c "$TTY" --"$CMD"
43 elif [ "$PLATFORM" = "MicaZ" ]; then
44 echo "The $PLATFORM mote...$CMD"
45 if [ "$CMD" = "start" ]; then
48 echo "uisp -dprog=mib510 -dserial=$TTY -dpart=ATmega128 --$CMD"
49 uisp
-dprog=mib510
-dserial=$TTY -dpart=ATmega128
--"$CMD"
51 echo "Unknown platform..."
56 echo "Unknown command..."