#!/bin/sh 
module="tap"
device="tap"
mode="664"


case `cat /var/run/platform` in
	RazorL|RazorM|RazorS)
		tdi=31
		tdo=52
		tms=53
		tck=54
		trst=58
		;;
	Absolut)
		tdi=74
		tdo=75
		tms=76
		tck=77
		trst=78
		;;
	*)
		exit 0
	;;
	esac


case "$1" in 
	start)

		modprobe $module.ko tdi=$tdi tdo=$tdo tms=$tms tck=$tck trst=$trst ||  exit 1

		# retrieve major number
		major=$(awk "\$2==\"$module\" {print \$1}" /proc/devices)

		# Remove stale nodes and replace them, then give gid and perms
		rm -f /dev/${device}0
		mknod /dev/${device}0 c $major 0
		ln -sf ${device}0 /dev/${device}

		;;

	stop)
		rmmod $module
		rm -f /dev/${device}0
		rm -f /dev/${device}
		;;

esac
