SPARCstation Monitor

Slack is full of contradictions. dd at mips.com
Thu Jan 10 09:54:59 AEST 1991


In article <17394 at brahms.udel.edu> gdtltr at brahms.udel.edu (root at research.bdi.com (Systems Research Supervisor)) writes:
>
>   Just get a SPARC? Miss the blinking LED's on your old Sun-3?
>
>   Try blink.c !

I think it's more interesting to do this with a shell script...

#! /bin/sh
# $Header: sunbell,v 1.6 90/02/14 18:43:55 david Exp $
# ring the bell or rotate the LEDs on a Sun keyboard
# D. DiGiacomo

if sun ; then
	:
else
	echo "`basename $0`: not a Sun"
	exit 1
fi

if [ -f /lib/ld.so ] ; then
	# SunOS 4.x
	belldev=/dev/kbd
else
	# SunOS 3.x
	belldev=/dev/bell
	if [ ! -c $belldev ] ; then
		echo "$belldev does not exist"
		echo "try \"mknod $belldev c 12 2; chmod 666 /dev/bell\""
		exit 1
	fi
fi

if [ ! -w $belldev ] ; then
	echo "`basename $0`: $belldev is not writable"
	echo "(try \"chmod 666 $belldev\")"
	exit 2
fi

if (echo "x" > $belldev) 2> /dev/null ; then
	:
else
	echo "`basename $0`: cannot write to $belldev"
 	echo "(no keyboard connected?)"
	exit 3
fi

case $# in
0) set - $0 ;;
esac

case "$1" in

*bell*)
	echo -n "beeeeeeeeeep!" | tr 'bp!' '\002\003\013' > $belldev
	;;

*[lL][eE][dD]*|*)
	# rotate LEDs -- type 4 only

	case "`type usleep`" in
	*not*found)
		sleep="sleep 1"
 		ledpat="8 2 4 1 4 2"
		;;
	*)
		sleep="usleep 250m"
 		ledpat="8 2 4 1 0"
		;;
	esac

	setled=`echo -n a | tr a '\016'`
	noclick=`echo -n a | tr a '\013'`
	trap 'echo -n "${setled}0${noclick}" > $belldev; exit' 1 2 15
	while true
	do
		for led in $ledpat
		do
			echo -n "${setled}${led}${noclick}"
			$sleep
		done > $belldev
	done
	;;
esac


--
David DiGiacomo, MIPS Computer Systems, Sunnyvale, CA  dd at mips.com



More information about the Alt.sources mailing list