RE: SocketCAN configuration » config_can.sh
| 1 | 
      #! /bin/sh
     | 
  
|---|---|
| 2 | 
       | 
  
| 3 | 
      can_name=$1  | 
  
| 4 | 
      bitrate=$2  | 
  
| 5 | 
       | 
  
| 6 | 
      if [ $# != 2 ]; then  | 
  
| 7 | 
      echo "Usage config_can.sh can_name desired_bitrate"  | 
  
| 8 | 
      else
     | 
  
| 9 | 
      	# Make sure the can interface is down
     | 
  
| 10 | 
      	ifconfig $can_name down
     | 
  
| 11 | 
       | 
  
| 12 | 
      	# Setup the can interface
     | 
  
| 13 | 
      ip link set $can_name type can bitrate $bitrate triple-sampling on  | 
  
| 14 | 
       | 
  
| 15 | 
      	# Bring the can interfae back up
     | 
  
| 16 | 
      	ifconfig $can_name up
     | 
  
| 17 | 
      fi
     | 
  
| 18 | 
       |