]> rtime.felk.cvut.cz Git - omk/sssa.git/blob - omk-devel/linux/test-can-in-konsole
Cleanup in repository.
[omk/sssa.git] / omk-devel / linux / test-can-in-konsole
1 #!/bin/sh
2 # Script to test native build of LinCAN in the KDE konsole window
3 # This script uses command DCOP scripting capabilities of konsole
4 # and if it is started from already running console, scripting has to be enabled.
5 # Parameter "--script" is required when konsole has been started.
6 #   konsole --script
7
8 #CAN_SRC_DIR=~/ocera/ocera-pc104/components/comm/can
9 #CAN_BIN_DIR=~/ocera/ocera-pc104/target-i386/usr/bin
10 #CAN_UTILS_DIR=~/ocera/ocera-pc104/target-i386/usr/bin
11
12 if [ -z "$CAN_BIN_DIR" ] ; then
13   MAKERULES_DIR=$( cd `dirname $0` ; old_pwd="" ;  while [ ! -e Makefile.rules ] ; do if [ "$old_pwd" == `pwd`  ] ; \
14    then exit 1 ; else old_pwd=`pwd` ; cd -L .. 2>/dev/null ; fi ; done ; pwd )
15   CAN_BIN_DIR="$MAKERULES_DIR/_compiled/bin"
16   CAN_UTILS_DIR="$MAKERULES_DIR/_compiled/bin-utils"
17   CAN_MODULES_DIR="$MAKERULES_DIR/_compiled/modules"
18 fi
19
20 if [ -z "$CAN_SRC_DIR" ] ; then
21   CAN_SRC_DIR=$(cd `dirname $0` ; pwd)
22 fi
23
24 if [ -z "$(lsmod | grep '^lincan' )" ] ; then
25   echo Inserting LinCAN module
26   echo insmod $CAN_MODULES_DIR/lincan.*o hw=virtual io=0
27   insmod $CAN_MODULES_DIR/lincan.*o hw=virtual io=0
28   if [ $? -ne 0 ] ; then
29     echo "Trying to insert LinCAN in the supervisor/root mode"
30     su -c "insmod $CAN_MODULES_DIR/lincan.*o hw=virtual io=0"
31     if [ $? -ne 0 ] ; then
32       echo LinCAN has not been inserted and attempt to insert it failed
33       exit 1
34     fi
35   fi
36 fi
37
38 if [ -n "$KONSOLE_DCOP" ] ; then
39   #DCOPRef(konsole-9272,konsole)
40   konsole=$(echo "$KONSOLE_DCOP" | sed -n 's/DCOPRef(\([^,]*\),konsole)/\1/p')
41 else
42   konsole=$(dcopstart konsole-script)
43 fi
44
45 echo "INVOKING: cd $CAN_SRC_DIR"
46 session=$(dcop $konsole konsole newSession)
47 dcop $konsole $session renameSession Compile
48 dcop $konsole $session sendSession "cd $CAN_SRC_DIR"
49
50 echo "INVOKING: cd $CAN_BIN_DIR ; ./canblaster -g 15"
51 session=$(dcop $konsole konsole newSession)
52 dcop $konsole $session renameSession canblaster
53 dcop $konsole $session sendSession "cd $CAN_BIN_DIR ; ./canblaster -g 15"
54
55 echo "INVOKING: cd $CAN_BIN_DIR ; ./canslave -g 15 -e $CAN_SRC_DIR/nascan.eds -s $CAN_SRC_DIR/nascan.hds"
56 session=$(dcop $konsole konsole newSession)
57 dcop $konsole $session renameSession canslave
58 dcop $konsole $session sendSession "cd $CAN_BIN_DIR ; ./canslave -g 15 -e $CAN_SRC_DIR/candev/nascan.eds -s $CAN_SRC_DIR/candev/nascan.hds"
59
60 echo "INVOKING: cd $CAN_BIN_DIR ; ./canmonitor"
61 session=$(dcop $konsole konsole newSession)
62 dcop $konsole $session renameSession canmonitor
63 dcop $konsole $session sendSession "cd $CAN_BIN_DIR ; ./canmonitor"
64
65 echo "INVOKING: cd $CAN_UTILS_DIR ; ./readburst"
66 session=$(dcop $konsole konsole newSession)
67 dcop $konsole $session renameSession readburst
68 dcop $konsole $session sendSession "cd $CAN_UTILS_DIR ; ./readburst"