me8100-driver
changeset 0 c9b8efdb5369
child 3 fc24e3b47731
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/me8100-driver	Wed Jan 16 14:01:55 2002 +0100
@@ -0,0 +1,79 @@
+#! /bin/sh
+# You can use this script to install the device driver
+# with automatically assigned major number. 
+
+# Please modify these lines according to your needs
+PATH=/sbin:/bin:/usr/bin
+module="me8100"
+device="me8100"
+group="users"
+mode="664"
+
+
+### I hope you don't have to modify anything below this line ###
+rc_done="\033[71G\033[32mdone\033[m"
+rc_failed="\033[71G\033[31m\033[1mfailed\033[m"   
+
+return=$rc_done
+
+case "$1" in
+    start)
+	echo -n "Starting me8100 driver "
+	/sbin/insmod -f $module.o || return=$rc_failed
+	rm -f /dev/${device}
+	rm -f /dev/${device}_[0-3]
+	major=`cat /proc/devices | awk "\\$2==\"$module\" {print \\$1}"`
+
+	echo -n "with major number $major"
+
+	# Make the device nodes in the dev. file system for 4 boards
+	mknod /dev/${device}_0 c $major 0
+	mknod /dev/${device}_1 c $major 1
+	mknod /dev/${device}_2 c $major 2
+	mknod /dev/${device}_3 c $major 3
+	
+	# Set a default link to the first dev
+	ln -s /dev/${device}_0 /dev/${device}
+
+	# Give appropriate group permissions
+	chgrp $group /dev/${device}_?
+	chmod $mode  /dev/${device}_?
+
+	;;
+    stop)
+	echo -n "Removing me8100 driver "
+	/sbin/rmmod $module
+
+	# Remove the default link
+	rm -f /dev/${device}
+	# Remove the nodes
+	rm -f /dev/${device}_[0-3]
+
+	;;
+    restart)
+	## If first returns OK call the second, if first or
+	## second command fails, set echo return value.
+	$0 stop  &&  $0 start  ||  return=$rc_failed
+	;;
+    status)
+	echo -e "Enty in /proc/modules is:"
+	cat /proc/modules | grep $module
+	echo -e "Entry in /proc/devices is:"
+	cat /proc/devices | grep $module
+	echo -e "Entry in /proc/interrupts is:"
+	cat /proc/interrupts | grep $module
+
+	;;
+    *)
+	echo "Usage: $0 {start|stop|restart|status}"
+	exit 1
+	;;
+esac
+
+# Inform the caller not only verbosely and set an exit status.
+echo -e "$return"
+test "$return" = "$rc_done" || exit 1
+exit 0
+
+
+