#!/bin/sh # # altro: Starts the ALTRO driver (for 2.6 kernels) # # Version: @(#) /etc/rc.d/init.d/altro 1.0 # # chkconfig: 5 95 5 # description: Starts and stops the ALTRO driver at boot time and shutdown. # # processname: altro # hide: true # Source function library. #. /etc/rc.d/init.d/functions . /etc/init.d/functions DriverLocation="/home/goofie/code/onLine/Hardware/driver/altro" # See how we were called. case "$1" in stop) echo "Shutting down ALTRO driver " /sbin/rmmod $DriverLocation/altro_driver_26 echo ;; status) cat /proc/altro ;; restart) echo "Shutting down altro driver " /sbin/rmmod $DriverLocation/altro_driver_26 echo "Starting altro driver " /sbin/insmod -f $DriverLocation/altro_driver_26.ko echo ;; restart_debug) echo "Shutting down altro driver " /sbin/rmmod $DriverLocation/altro_driver_26 echo "Starting altro driver " /sbin/insmod -f $DriverLocation/altro_driver_26.ko debug=1 errorlog=1 echo ;; help) echo "*** Usage: altro {start|stop|status|restart|restart_debug}" exit 1 ;; *) echo "Starting ALTRO driver " # load the module /sbin/insmod -f $DriverLocation/altro_driver_26.ko ddump=0 debug=0 errorlog=1 # remove old device nodes rm -fr /dev/usb/altro0 rm -fr /dev/usb/altro1 rm -fr /dev/usb/altro2 rm -fr /dev/usb/altro3 rm -fr /dev/usb/altro4 # create /dev/usb/ node if [ -d /dev/usb/ ]; then echo "Directory /dev/usb/ exist" else mkdir /dev/usb/ fi # get major number major=`awk "\\$2==\"usb\" {print \\$1}" /proc/devices` echo major number is $major # make device node mknod /dev/usb/altro0 c $major 192 mknod /dev/usb/altro1 c $major 193 mknod /dev/usb/altro2 c $major 194 mknod /dev/usb/altro3 c $major 195 mknod /dev/usb/altro4 c $major 196 #give permissions chmod 666 /dev/usb/altro0 chmod 666 /dev/usb/altro1 chmod 666 /dev/usb/altro2 chmod 666 /dev/usb/altro3 chmod 666 /dev/usb/altro4 echo ;; esac exit 0