summaryrefslogtreecommitdiff
path: root/test_nmea2000
diff options
context:
space:
mode:
authorReinhard Arlt <reinhard.arlt@t-online.de>2015-01-29 14:10:11 +0100
committerReinhard Arlt <reinhard.arlt@t-online.de>2015-01-29 14:10:11 +0100
commit663e292b8017142d0400ebc517e026867dd6af60 (patch)
tree4a432d8f3786ed8a063a4a5d1d589d2fa5314a65 /test_nmea2000
parent9004cdfc569c5bd63d73cb968afc997e6df3ffee (diff)
downloadgpsd-663e292b8017142d0400ebc517e026867dd6af60.tar.gz
Add more help to test_nmea2000.
Diffstat (limited to 'test_nmea2000')
-rwxr-xr-xtest_nmea200040
1 files changed, 34 insertions, 6 deletions
diff --git a/test_nmea2000 b/test_nmea2000
index 59b59da3..bfc53ede 100755
--- a/test_nmea2000
+++ b/test_nmea2000
@@ -6,8 +6,6 @@
GPSD_PORT=2948
CAN_PLAYER=canplayer
-TMP_PID_FILE=`mktemp`
-TMP_OUT_FILE=`mktemp`
CAN_UNIT="vcan0"
# Requires GNU date extensions
@@ -23,22 +21,46 @@ fi
version()
{
+ echo
echo `basename $0`" : Version v0.10";
+ echo
}
usage()
{
- version; echo;
- echo "usage :" `basename $0` " [-S <portnumber>] [-u <can_device>] testfile";
+ version;
+ echo "usage :" `basename $0` " [-S <portnumber>] [-u <can_device>] [-p <canplayer>] testfile";
echo " :" `basename $0` " -v";
echo " :" `basename $0` " -h";
+ echo
+}
+
+device()
+{
+ echo
+ echo "CAN device \"${CAN_UNIT}\" do not exit."
+ echo "Try: sudo ./gpsinit vcan "
+ echo
}
-while getopts :S:u:vh opt
+can_utils()
+(
+ echo
+ echo "Command to play CAN logfile \"${CAN_PLAYER}\" do not exist."
+ echo "Try to install \"can-utils\" from your distribution."
+ echo "I your distibution do not provide \"can-utils\", then"
+ echo "git clone https://gitorious.org/linux-can/can-utils.git"
+ echo "in a directory outside of gpsd, build and install it."
+ echo "On most linux systems, \"make\", and then \"sudo make install\" works."
+ echo
+)
+
+while getopts :S:u:p:vh opt
do
case ${opt} in
S) GPSD_PORT=${OPTARG};;
- u) CAN_DEVICE=${OPTARG};;
+ u) CAN_UNIT=${OPTARG};;
+ p) CAN_PLAYER=${OPTARG};;
v) version; exit 0;;
h) usage; exit 0;;
\?) usage; exit 1;;
@@ -51,6 +73,12 @@ if [ -z $1 ]; then usage; exit 1; fi
TEST_FILE=$1
+if [ `ifconfig -a | grep ${CAN_UNIT} | wc -c` -eq 0 ]; then device; exit 1; fi
+
+if [ `command -v ${CAN_PLAYER} | wc -c` -eq 0 ]; then can_utils; exit 1; fi
+
+TMP_PID_FILE=`mktemp`
+TMP_OUT_FILE=`mktemp`
${GPSD_HOME}/gpsd -n -G -D0 -S ${GPSD_PORT} -P ${TMP_PID_FILE} nmea2000://${CAN_UNIT}