3 # Low Level CAN Framework
4 # Copyright (c) 2005 Volkswagen Group Electronic Research
8 # Simple script to start CAN and VCAN interfaces
10 # Exit if ifconfig is not installed
11 test -x /sbin/ifconfig || exit 0
13 # On some systems the automatic module loading via
14 # /etc/modules.conf is quite slow. To ensure the immediately
15 # availability of specific modules you can define critical
16 # modules in the PROBE variable. E.g. PROBE="can-tp20"
18 # Exit if modprobe is not installed
19 test -x /sbin/modprobe || exit 0
22 VCAN_IF="vcan0 vcan1 vcan2 vcan3"
26 if [ $CREATE_VCANS -gt 0 ] ; then
27 # Exit if vcan tool is not installed
28 test -x /sbin/vcan || exit 0
33 if [ -n "$PROBE" ] ; then
34 echo -n "Extra probing CAN modules:"
35 for MODULE in $PROBE; do
36 /sbin/modprobe $MODULE
41 if [ $CREATE_VCANS -gt 0 ] ; then
42 echo -n "Creating "$CREATE_VCANS" virtual CAN interfaces: "
43 for IF in `seq 1 $CREATE_VCANS`; do
49 if [ -n "$CAN_IF" ] ; then
50 echo -n "Enabling CAN interfaces:"
57 if [ -n "$VCAN_IF" ] ; then
58 echo -n "Enabling virtual CAN interfaces:"
59 for IF in $VCAN_IF; do
67 if [ -n "$CAN_IF" ] ; then
68 echo -n "Restarting CAN interfaces:"
70 /sbin/ifconfig $IF down
76 if [ -n "$VCAN_IF" ] ; then
77 echo -n "Restarting virtual CAN interfaces:"
78 for IF in $VCAN_IF; do
79 /sbin/ifconfig $IF down
87 if [ -n "$CAN_IF" ] ; then
88 echo -n "Shutting down CAN interfaces:"
90 /sbin/ifconfig $IF down
95 if [ -n "$VCAN_IF" ] ; then
96 echo -n "Shutting down virtual CAN interfaces:"
97 for IF in $VCAN_IF; do
98 /sbin/ifconfig $IF down
105 echo "Usage: /etc/init.d/can_if {start|stop|restart|reload|force-reload}"