Skip to content
Snippets Groups Projects
Commit 8d7222b7 authored by Alejandro Lopez Gestoso's avatar Alejandro Lopez Gestoso
Browse files

Added can configuration script

parent 18cd771c
No related branches found
No related tags found
No related merge requests found
#!/bin/sh
set -e
DEVICE=
NAME=
usage() {
echo "Usage: $0 [-d <device>] [-n <name>]"
echo " -d specify device route."
echo " -n specify human friendly device's name."
exit 1
}
while getopts ":hd:n:" arg; do
case $arg in
d) DEVICE=$OPTARG;;
n) NAME=$OPTARG;;
h) usage;;
*) usage;;
esac
done
shift $((OPTIND-1))
#check if device parameter is filled up
if [ ! "${DEVICE}" ]
then
echo "No device provided, aborting ..."
usage
exit 1
fi
#check if name parameter is filled up
if [ ! "${NAME}" ]
then
echo "No name provided, aborting ..."
usage
exit 1
fi
#Can
sudo slcand -o -s6 -S3000000 $DEVICE $NAME
sudo ifconfig $NAME up
exit 0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment