Index: tools/setup_virtual_can.sh =================================================================== diff -u -ra08757ab36f7555f49526e28b7d2eb799e64769d -r82615ab9d1757ef67810f9fc267cd89a19a2e4c8 --- tools/setup_virtual_can.sh (.../setup_virtual_can.sh) (revision a08757ab36f7555f49526e28b7d2eb799e64769d) +++ tools/setup_virtual_can.sh (.../setup_virtual_can.sh) (revision 82615ab9d1757ef67810f9fc267cd89a19a2e4c8) @@ -14,17 +14,19 @@ # @brief Initializes the virtual can interfaces # ############################################################################ -sudo ifconfig vcan0 down -sudo ifconfig vcan1 down -sudo ip link delete dev vcan0 -sudo ip link delete dev vcan1 +iface="can0" +if [ "$#" -gt 1 ]; then + echo "Please provide only one can interface." + echo "Usage (defaults to can0): ./bring_can_iface_down.sh " + echo " Use instead: setup_canbus.sh " + exit 1 +elif [ "$#" -eq 1 ]; then + iface="$1" +fi -sudo ip link add dev vcan0 type vcan -sudo ip link add dev vcan1 type vcan +sudo ip link add dev "$iface" type vcan -sudo ip link set vcan0 up -sudo ifconfig vcan0 txqueuelen 10000 +sudo ip link set "$iface" up +sudo ifconfig "$iface" txqueuelen 10000 -sudo ip link set vcan1 up -sudo ifconfig vcan1 txqueuelen 10000