Subject: Re: Beep on halt (definitive?)
To: matthew green <mrg@eterna.com.au>
From: Julio Merino <jmmv@menta.net>
List: tech-kern
Date: 10/20/2002 18:52:06
This is a multi-part message in MIME format.

--Multipart_Sun__20_Oct_2002_18:52:06_+0200_081d5800
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

On Sun, 20 Oct 2002 21:23:52 +1000
matthew green <mrg@eterna.com.au> wrote:

> kern. seems the wrong place to me.  this is a machine dependant feature.

Well. I hope this to be a "definitive" patch, except for some minor details I'll
comment later.

Now, it defines these variables (in i386):

machdep.beep.onhalt (number of times to beep when halting)
machdep.beep.onhalt_pitch (the frequency)
machdep.beep.onhalt_period (the duration)

These are also tunable in the kernel:

# Beep events (requires sysbeep).
#options       BEEP_EVENTS             # Enable beep events
# The following options are sysctl tunable.
#options       BEEP_ONHALT=0           # Times to beep on halt (0 disabled)
#options       BEEP_ONHALT_PITCH=1500  # Default frequency (in Hz)
#options       BEEP_ONHALT_PERIOD=250  # Default duration (in msecs)

As you can see, BEEP_EVENTS disables/enables this feature completely to
avoid any kernel overload.

I've also defined a new macro, BEEP_DOEVENT, that simplifies the call of
using these variables. If somebody wanted to add a new event, he could
simply need to modify sysctl entries and add a BEEP_DOEVENT(onreboot) call
in the correct place, instead of repeating the same code.

Patches attached (now gzipped).

Well, here are the "problems". Some people in IRC have suggested to avoid
the use of the underscore in sysctl's variables and use a new node in
machdep.beep.onhalt, so it could become: machdep.beep.onhalt.count,
machdep.beep.onhalt.pitch and machdep.beep.onhalt.period. This seems ok,
but this means adding more code to sysctl, more define's and ifdef's...
I do not think this is worth for this simple patch... It adds more
complexity to a thing that should be simple. What do you think?
(It is better to discuss this here than in IRC ;)

Thank you!

-- 
Julio Merino (http://jmmv.dyndns.org/) <jmmv@menta.net>

--Multipart_Sun__20_Oct_2002_18:52:06_+0200_081d5800
Content-Type: application/octet-stream;
 name="patches.tgz"
Content-Disposition: attachment;
 filename="patches.tgz"
Content-Transfer-Encoding: base64

H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