Subject: Re: Beep on halt (with sysctl)
To: Christos Zoulas <christos@zoulas.com>
From: Julio Merino <jmmv@menta.net>
List: tech-kern
Date: 10/20/2002 13:22:21
This is a multi-part message in MIME format.

--Multipart_Sun__20_Oct_2002_13:22:21_+0200_081d5a00
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

On Sat, 19 Oct 2002 22:48:28 GMT
christos@zoulas.com (Christos Zoulas) wrote:

> In article <20021020000145.73290228.jmmv@menta.net>,
> Julio Merino <jmmv@menta.net> wrote:
> 
> It does not need modifying the sysctl program, and although it is more
> work, it is the way to go.

Here is another patch, it is starting to look better, imho ;) I've defined
these variables:

    kern.beep.pitch  (int - the frequency of the tone, default 1500)
    kern.beep.period (int - the period of the tone, default 250)
    kern.beep.onhalt (int - how many tones, default 0)

This new node (beep) implies the modification of sysctl with a small patch
(attached to). What I've done is generalize the idea, so that new
"beep events" can be added easily, for example kern.beep.onreboot should
be trivial to implement (or kern.beep.onddb, etc etc).

Aside from sysctl's, I've added a kernel option, called BEEP_EVENTS, which
enables/disables completely this feature (saving around 0.5kb hehe).

What do you think now?

Thanks!

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

--Multipart_Sun__20_Oct_2002_13:22:21_+0200_081d5a00
Content-Type: application/octet-stream;
 name="patch-kern.diff"
Content-Disposition: attachment;
 filename="patch-kern.diff"
Content-Transfer-Encoding: base64

SW5kZXg6IHN5cy9zeXNjdGwuaAo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ClJDUyBmaWxlOiAvY3Zzcm9vdC9zeXNzcmMv
c3lzL3N5cy9zeXNjdGwuaCx2CnJldHJpZXZpbmcgcmV2aXNpb24gMS43OApkaWZmIC11IC11IC1y
MS43OCBzeXNjdGwuaAotLS0gc3lzY3RsLmgJMjAwMi8wOC8yNiAxMzowOTozOQkxLjc4CisrKyBz
eXNjdGwuaAkyMDAyLzEwLzI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Z2V0IHRo
ZSByaWdodCBzZWdtZW50IGRlZiAqLwogI2luY2x1ZGUgIm9wdF9tdHJyLmgiCisjaW5jbHVkZSAi
b3B0X2JlZXAuaCIKIAogI2luY2x1ZGUgPHN5cy9wYXJhbS5oPgogI2luY2x1ZGUgPHN5cy9zeXN0
bS5oPgpAQCAtMjI5Myw2ICsyMjk0LDE4IEBACiAJCXByaW50ZigiXG4iKTsKIAkJcHJpbnRmKCJU
aGUgb3BlcmF0aW5nIHN5c3RlbSBoYXMgaGFsdGVkLlxuIik7CiAJCXByaW50ZigiUGxlYXNlIHBy
ZXNzIGFueSBrZXkgdG8gcmVib290LlxuXG4iKTsKKyNpZmRlZiBCRUVQX0VWRU5UUworCQl7CisJ
CQlpbnQgYzsKKworCQkJZm9yIChjID0gYmVlcF9vbmhhbHQ7IGMgPiAwOyBjLS0pIHsKKwkJCQlz
eXNiZWVwKGJlZXBfcGl0Y2gsIGJlZXBfcGVyaW9kICogaHogLyAxMDAwKTsKKwkJCQlkZWxheShi
ZWVwX3BlcmlvZCAqIDEwMDApOworCQkJCXN5c2JlZXAoMCwgYmVlcF9wZXJpb2QgKiBoeiAvIDEw
MDApOworCQkJCWRlbGF5KGJlZXBfcGVyaW9kICogMTAwMCk7CisJCQl9CisJCX0KKyNlbmRpZgog
CQljbnBvbGxjKDEpOwkvKiBmb3IgcHJvcGVyIGtleWJvYXJkIGNvbW1hbmQgaGFuZGxpbmcgKi8K
IAkJY25nZXRjKCk7CiAJCWNucG9sbGMoMCk7Cg==

--Multipart_Sun__20_Oct_2002_13:22:21_+0200_081d5a00
Content-Type: application/octet-stream;
 name="patch-sysctl.diff"
Content-Disposition: attachment;
 filename="patch-sysctl.diff"
Content-Transfer-Encoding: base64

SW5kZXg6IHN5c2N0bC5jCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT0KUkNTIGZpbGU6IC9jdnNyb290L2Jhc2VzcmMvc2Jp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