How do I ring a bell?

Polytropon freebsd at edvax.de
Tue Oct 8 01:46:26 UTC 2013


On Mon, 07 Oct 2013 21:09:44 +0100, Frank Leonhardt wrote:
> On 07/10/2013 13:36, Polytropon wrote:
> > > Is there any way to make a noise through the built in "bell" speaker
> > > found on an IBM PC compatible server box? Writing 007 to the BIOS cout
> > > routine might do it, but I've realised I haven't got a clue how to 
> > do that.
>  > Making it audible is part of the local terminal emulator,
>  > either the TTY (text mode) driver or via xterm (or the
>  > preferred alternative terminal emulator in X).
> 
> Yers, but I'm not running X. Or a character terminal come to that :-)

In that case, something line

	printf "\a" > /dev/console

should work - I've just tried it. You can do that from a
shell script or maybe even via fprintf() from your own code.



>  > See the following shell script as an example of what you
>  > can do: <snip>
> 
> Overkill. I have proper work to do rather than working out how to play 
> appropriate bit silly little tunes for every eventuality. Actually 
> spkr.c has some useful comments in it - apparently it works the same as 
> IBM PC BASIC. Now how do I make it polyphonic...

By adding more computers. This is the established solution
to _every_ IT-related problem. :-)

The code in /usr/src/sys/dev/speaker/spkr.c provides a more
streamlined interface to sound generation. It's even more
"bare metal" than what I remember from Borland Turbo-C:

	sound(1000);
	delay(2500);
	nosound();

It was important not to miss the 3rd line or the "fun" would
never end. :-)



>  > Always make sure that the system actually _has_ got an
>  > internal speaker! I assume that modern PC hardware could
>  > have it removed along with floppy drive connector, parallel
>  > port or power switch.
> 
> Remains to be seen, but most still seem to have one so the BIOS ROM can 
> make "beep" diagnostic codes if it can't do anything else.

This proves that it is present, even if it's not an attached
speaker anymore. Many mainboards contain a little piezo speaker
directly mounted (my ultracheap home PC does, for example).



>  >> P.S. "cdcontrol -f /dev/mycdrom eject" is the best I've come up with so
>  >> far for getting attention.
>  > That's a really clever idea, never heared of that. It has
>  > the advantage of being permanent because the drive will
>  > stay open when the sound of its motor has finished. :-)
> 
> I use it all the time, especially when directing a tech to the 
> appropriate server in a rack. "It's the one I just popped the CD drive 
> on". These days servers have the spring-loaded notebook drives instead 
> of the motorised trays, which is a pity. You could keep winding the 
> motorised ones in and out until someone spotted it.

This seems to be better than those "slot-in" drives I had
in one server: no moving parts to the outside.



> I suppose if you did 
> it energetically enough it might catch fire and set off the smoke alarm 
> (audible).

This procedure has been part of an independent quality test
of CD recorders, performed by a PC maganzine many years ago.
Interesting result: the cheapest drive would last longer than
the most expensive one in which the gears automatically had
disassembled. :-)



> Or leave it wound out with a tin can balanced on it; to make 
> a noise wind it back in and hear it clatter to the floor.

Interesting use for the "4X cup holder". :-)



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list