]> rtime.felk.cvut.cz Git - socketcan-simulink.git/commitdiff
Update robotic arm configuration script to bring up can0 interface if not configured.
authorPavel Pisa <pisa@cmp.felk.cvut.cz>
Fri, 10 Oct 2014 19:09:22 +0000 (21:09 +0200)
committerPavel Pisa <pisa@cmp.felk.cvut.cz>
Fri, 10 Oct 2014 19:09:22 +0000 (21:09 +0200)
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
demo/canopen_2j_arm/canopen_2j_arm_setup

index debd040011960b7941ec101701292adc66f1885d..188d79862d9d52a3adff6e95d04521951276ff2d 100755 (executable)
@@ -1,5 +1,16 @@
 #!/bin/sh
 
+if ! ip link show can0 | grep -q '^[^ ]*: can0:' ; then
+  echo "No can0 interface"
+  exit 1
+fi
+
+if ip link show can0 | grep -q '^[^ ]*: can0:.* state DOWN ' ; then
+  echo "can0 intreface is down - interface is to be configured"
+  ip link set can0 type can bitrate 1000000 || exit 1
+  ip link set can0 up || exit 1
+fi
+
 cansend can0 '000#02.00'
 cansend can0 '601#23.00.1A.01.10.00.41.60'
 cansend can0 '601#23.00.1A.02.10.00.64.60'