#!/bin/sh
### BEGIN INIT INFO
# Provides:          socketcan canconfig
# Required-Start:    $local_fs $remote_fs $console-screen
# Required-Stop:     $local_fs $remote_fs
# Default-Start:     S 
# Default-Stop:      0 1 6
# Description:       This script configures the socketcan interface.
# Short-Description:	This script configures the socketcan interface.
### END INIT INFO

start()
{
    canconfig can0 bitrate 250000 ctrlmode triple sampling on restart-ms 100
    canconfig can0 start
}

stop()
{
    canconfig can0 stop
}

restart()
{
    canconfig can0 stop
    canconfig can0 start
}


case "$1" in
    start)
	echo "Configuring socketcan interface"
	start
	;;
    stop)
	echo "Stopping socketcan interface"
	stop
	;;
    restart)
	echo "Restarting socketcan interface"
	restart
	;;
    *)
	echo "Usage: $SCRIPTNAME {start|stop|restart}" >&2
	exit 3
	;;
esac
