Index: tools/setup_canbus.sh =================================================================== diff -u -r028952270169971af5075574ba7b7b4ba241acd3 -r32e628abcbbd3fd70866505d9f2836a6f732ef06 --- tools/setup_canbus.sh (.../setup_canbus.sh) (revision 028952270169971af5075574ba7b7b4ba241acd3) +++ tools/setup_canbus.sh (.../setup_canbus.sh) (revision 32e628abcbbd3fd70866505d9f2836a6f732ef06) @@ -1,19 +1,28 @@ #!/bin/bash ########################################################################### # -# Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. +# Copyright (c) 2020-2024 Diality Inc. - All Rights Reserved. # -# THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN -# WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. +# THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN +# WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. # -# @file setup_canbus.sh +# @file setup_canbus.sh # -# @date 29-Apr-2020 -# @author P. Lucia +# @author (last) Peter Lucia +# @date (last) 02-Jun-2021 +# @author (original) Peter Lucia +# @date (original) 01-Apr-2020 # -# @brief Initializes the canbus interface -# ############################################################################ +iface="can0" +if [ "$#" -gt 1 ]; then + echo "Please provide only one can interface." + echo "Usage (defaults to can0): setup_canbus.sh " + echo " Use instead: setup_canbus.sh " + exit 1 +elif [ "$#" -eq 1 ]; then + iface="$1" +fi -sudo ip link set can0 up type can bitrate 250000 restart-ms 100 - +sudo ip link set "$iface" up type can bitrate 250000 restart-ms 100 +sudo ifconfig can0 txqueuelen 4000 \ No newline at end of file