From 8a3a609e3ba80597484455b97d7589bd81c95c16 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Mon, 17 May 2021 16:43:56 +1000 Subject: [PATCH] Tools: add can_sitl_nodev.sh which doesn't require a (e.g.) babel to run --- Tools/scripts/CAN/can_sitl_nodev.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 Tools/scripts/CAN/can_sitl_nodev.sh diff --git a/Tools/scripts/CAN/can_sitl_nodev.sh b/Tools/scripts/CAN/can_sitl_nodev.sh new file mode 100755 index 0000000000..36c2145f52 --- /dev/null +++ b/Tools/scripts/CAN/can_sitl_nodev.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# once run, you can configure SITL for CAN just like a real board, with the CAN parameters +# +# CAN_P1_DRIVER=1 +# CAN_D1_PROTOCOL=1 + +# once running you can also attach uavcan_gui_tool to vcan0 to monitor the CAN bus + +set -e +set -x + +# cleanup from a previous run +sudo killall -9 slcand 2> /dev/null || true +for m in slcan can-gw vcan can_raw can; do + sudo rmmod $m 2> /dev/null || true +done + +sudo modprobe vcan +sudo ip link add dev vcan0 type vcan +sudo ip link set up vcan0 +sudo modprobe can-gw