[comp.windows.news] Real bells in NeWS???

montnaro@sprite (Skip Montanaro) (02/24/88)

Is there some way to get real bell ringing in NeWS 1.1? Visible bells just
don't cut it if you are distracted at the time the bell "rings".

Thanks,
Skip (montanaro@ge-crd.arpa, uunet!steinmetz!sprite!montanaro)

bill@RESEARCH.ATT.COM (04/07/88)

Here's the canonical way to ring the bell on a sun.
It doesn't need any new devices created in /dev.  The idea is to
call turn_bell_on() and sometime later (probably after doing
a select() call to wait for some fraction of a second) call
turn_bell_off().

-Bill Schell
 AT&T Bell Labs, Murray Hill, NJ
 allegra!bill

#include <sys/types.h>
#include <sys/ioctl.h>
#include <sundev/kbio.h>
#include <sundev/kbd.h>

turn_on_bell() {
	int bell, bell_on = KBD_CMD_BELL;
	bell = open("/dev/kbd",1);
	ioctl(bell, KIOCCMD, &bell_on);
	close(bell);
}

turn_off_bell() {
	int bell, bell_off = KBD_CMD_NOBELL;
	bell = open("/dev/kbd",1);
	ioctl(bell, KIOCCMD, &bell_off);
	close(bell);
}