How do I ring a bell?

2013-10-07 Thread Frank Leonhardt
In the good'ol days I could make UNIX ring a bell (literally) by sending 
\a to the console TTY (an ASR33 in my case). Now there's an electronic 
synthesised ting or beep from an terminal emulator IF it's got a sound 
card and so on, and an IBM-PC had a beep routine in the BIOS.


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.


I could easily knock up a bit of hardware to go on a serial port (or 
similar) that could be triggered to make a noise, but these things have 
already got the hardware built in and I'm looking to use what I've 
already got.


Thanks, Frank.

P.S. cdcontrol -f /dev/mycdrom eject is the best I've come up with so 
far for getting attention.


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: How do I ring a bell?

2013-10-07 Thread Peter Boosten

On 7 okt. 2013, at 13:37, Frank Leonhardt fra...@fjl.co.uk wrote:

 In the good'ol days I could make UNIX ring a bell (literally) by sending \a 
 to the console TTY (an ASR33 in my case). Now there's an electronic 
 synthesised ting or beep from an terminal emulator IF it's got a sound card 
 and so on, and an IBM-PC had a beep routine in the BIOS.
 
 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.
 
 I could easily knock up a bit of hardware to go on a serial port (or similar) 
 that could be triggered to make a noise, but these things have already got 
 the hardware built in and I'm looking to use what I've already got.
 
 Thanks, Frank.
 
 P.S. cdcontrol -f /dev/mycdrom eject is the best I've come up with so far 
 for getting attention.
 
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


echo CTRL-V CTRL-G should do the trick 

-- 
Peter Boosten
http://www.boosten.org


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: How do I ring a bell?

2013-10-07 Thread Polytropon
On Mon, 07 Oct 2013 12:37:35 +0100, Frank Leonhardt wrote:
 In the good'ol days I could make UNIX ring a bell (literally) by sending 
 \a to the console TTY (an ASR33 in my case).

Ah, the famous ^G control character... :-)



 Now there's an electronic 
 synthesised ting or beep from an terminal emulator IF it's got a sound 
 card and so on, and an IBM-PC had a beep routine in the BIOS.

The terminal beep routine will primarily address the system's
speaker (located at or connected to the mainboard). A side
effect on the sound card is possible (the Logitech SoundMan
did have that feature), but it's not really in relation.



 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).

A simple

printf \a

from the shell prompt should be sufficient. Note that if
you're running this in X, you have to make sure the bell
is not disabled. For example, put

xset b 100 1000 15

in your ~/.xinitrc (or ~/.xsession respectively).

A more sophisticated interface is provided as soon as your
kernel has

device speaker

compiled in (or speaker.ko has been loaded). Now you can
play wonderful music through the speaker. :-)

See man 4 speaker for details.

See the following shell script as an example of what you
can do:

#!/bin/sh
read -p CW ===  TEXT
echo ${TEXT} | morse | awk '{
if(length($0) == 0)
printf(P4\n);
else {
gsub( dit, P32L32E, $0);
gsub( di,  P32L32E, $0);
gsub( dah, P32L8E,  $0);
printf(%sP16\n, $0);
}
}' | dd bs=256 of=/dev/speaker  /dev/null 21

Feel free to add support for reading from stdin so you can
listen to your console messages piped into the script. :-)

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.



 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. :-)


-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: How do I ring a bell?

2013-10-07 Thread Frank Leonhardt

On 07/10/2013 13:06, Peter Boosten wrote:


On 7 okt. 2013, at 13:37, Frank Leonhardt fra...@fjl.co.uk 
mailto:fra...@fjl.co.uk wrote:


In the good'ol days I could make UNIX ring a bell (literally) by 
sending \a to the console TTY (an ASR33 in my case). Now there's an 
electronic synthesised ting or beep from an terminal emulator IF it's 
got a sound card and so on, and an IBM-PC had a beep routine in the BIOS.


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.


I could easily knock up a bit of hardware to go on a serial port (or 
similar) that could be triggered to make a noise, but these things 
have already got the hardware built in and I'm looking to use what 
I've already got.


Thanks, Frank.

P.S. cdcontrol -f /dev/mycdrom eject is the best I've come up with 
so far for getting attention.


___
freebsd-questions@freebsd.org mailto:freebsd-questions@freebsd.org 
mailing list

http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to 
freebsd-questions-unsubscr...@freebsd.org


echo CTRL-V CTRL-G should do the trick

Alas, not. The console driver won't ring the BIOS bell on anything I've 
tried. It might on a desktop with a built-in sound card and speakers, 
but it won't do anything with the beep speaker. It's actually the same 
solution I mentioned in the first line (\a translates to 007 which is 
ctrl-G).


Then there's the issue of writing it to the console rather than a 
virtual terminal, but I have a few hacks that'll achieve that part.


IIRC there was once a FreeBSD kernel module to drive the PC speaker 
(through /dev/pcspeaker or similar), but it seems to have gone or I'm 
confusing it with another BSD (or Linux).


No I'm not. /usr/src/sys/dev/speaker/spkr.c(!) I may be close to a 
solution...


Regards, Frank.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: How do I ring a bell?

2013-10-07 Thread Steve O'Hara-Smith
On Mon, 07 Oct 2013 12:37:35 +0100
Frank Leonhardt fra...@fjl.co.uk wrote:

 In the good'ol days I could make UNIX ring a bell (literally) by sending 
 \a to the console TTY (an ASR33 in my case). Now there's an electronic 
 synthesised ting or beep from an terminal emulator IF it's got a sound 
 card and so on, and an IBM-PC had a beep routine in the BIOS.

Try this:

echo ^G  /dev/console

You'll have to type ^V^G to get a real ^G in the command line
(^ means control of course).

-- 
Steve O'Hara-Smith st...@sohara.org
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: How do I ring a bell?

2013-10-07 Thread Leslie Jensen



Frank Leonhardt skrev 2013-10-07 13:37:

In the good'ol days I could make UNIX ring a bell (literally) by sending
\a to the console TTY (an ASR33 in my case). Now there's an electronic
synthesised ting or beep from an terminal emulator IF it's got a sound
card and so on, and an IBM-PC had a beep routine in the BIOS.

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.

I could easily knock up a bit of hardware to go on a serial port (or
similar) that could be triggered to make a noise, but these things have
already got the hardware built in and I'm looking to use what I've
already got.

Thanks, Frank.

P.S. cdcontrol -f /dev/mycdrom eject is the best I've come up with so
far for getting attention.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to
freebsd-questions-unsubscr...@freebsd.org




You also have the audio/yell port.




___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: How do I ring a bell?

2013-10-07 Thread RW
On Mon, 07 Oct 2013 13:46:53 +0100
Frank Leonhardt wrote:


 Alas, not. The console driver won't ring the BIOS bell on anything
 I've tried. It might on a desktop with a built-in sound card and
 speakers, but it won't do anything with the beep speaker.

Are you sure you have one? The last two cases I bought didn't.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: How do I ring a bell?

2013-10-07 Thread Steve O'Hara-Smith
On Mon, 07 Oct 2013 13:46:53 +0100
Frank Leonhardt fra...@fjl.co.uk wrote:

 Then there's the issue of writing it to the console rather than a 
 virtual terminal, but I have a few hacks that'll achieve that part.

/dev/console is your friend.

-- 
Steve O'Hara-Smith st...@sohara.org
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: How do I ring a bell?

2013-10-07 Thread Frank Leonhardt

On 07/10/2013 14:31, RW wrote:

On Mon, 07 Oct 2013 13:46:53 +0100
Frank Leonhardt wrote:



Alas, not. The console driver won't ring the BIOS bell on anything
I've tried. It might on a desktop with a built-in sound card and
speakers, but it won't do anything with the beep speaker.

Are you sure you have one? The last two cases I bought didn't.



They beep when you turn them on and they're ready to boot :-)

/dev/speaker appears to be the answer.

Thanks, Frank.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: How do I ring a bell?

2013-10-07 Thread Warren Block

On Mon, 7 Oct 2013, Frank Leonhardt wrote:

On 07/10/2013 13:06, Peter Boosten wrote:


echo CTRL-V CTRL-G should do the trick


Or, more easily, printf \a.

Alas, not. The console driver won't ring the BIOS bell on anything I've 
tried. It might on a desktop with a built-in sound card and speakers, but it 
won't do anything with the beep speaker. It's actually the same solution I 
mentioned in the first line (\a translates to 007 which is ctrl-G).


Make sure hw.syscons.bell is set to 1.  It can be changed at run time, 
like in /etc/sysctl.conf.  Some systems have it disabled (set to 0) 
because the bell is amazingly loud and piercing.  (Looking at you, 
Dell.)

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: How do I ring a bell?

2013-10-07 Thread Frank Leonhardt

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 :-)


 A more sophisticated interface is provided as soon as your
 kernel has

 device speaker

 compiled in (or speaker.ko has been loaded). Now you can
 play wonderful music through the speaker. :-)

 See man 4 speaker for details.

Thanks! This is what I was looking for.

 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...



 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.


 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. I suppose if you did 
it energetically enough it might catch fire and set off the smoke alarm 
(audible). 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.


(Incidentally - email over-lap because earlier reply posted to me and 
list rather than just list)


Regards, Frank.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: How do I ring a bell?

2013-10-07 Thread Polytropon
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, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org