Fix syntax error in the remote.sh UDEV script
[remote/remote-mci.git] / contrib / scripts / control-mote.sh
blob948cc28d0f32cf8b53afd41b61f6f2cbf5d70e8a
1 #!/bin/bash
3 # control-mote.sh TTY CMD
5 # TODO: Description!
7 # Rostislav Spinar 2008
8 # rostislav.spinar@cit.ie
10 #Get parameters from command line
11 TTY="$1"
12 CMD="$2"
14 #Have it as a env. variable
15 PLATFORM="$platform"
17 #Check the parameters first
18 #Suppose to have 2 args
19 if [ "$#" -ne 2 ]; then
20 echo "Uncorrect number of arguments"
21 exit
24 if [[ -n "$TTY" && -c "$TTY" ]]; then
25 echo "Using port $TTY..."
26 else
27 echo "Port has to be defined..."
28 exit
31 #Run command(reset, stop & start(reset from DIKU_MCH))
32 case "$CMD" in
33 "reset" | "stop" | "start")
34 if [ "$PLATFORM" = "TMoteSky" ]; then
35 echo "The $PLATFORM mote...$CMD"
36 if [ "$CMD" = "start" ]; then
37 CMD="reset"
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
46 CMD="reset"
48 echo "uisp -dprog=mib510 -dserial=$TTY -dpart=ATmega128 --$CMD"
49 uisp -dprog=mib510 -dserial=$TTY -dpart=ATmega128 --"$CMD"
50 else
51 echo "Unknown platform..."
52 exit
56 echo "Unknown command..."
57 exit
59 esac
61 echo "We are done."