Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Mar 2003 10:42:01 -0500 (EST)
From:      John Baldwin <jhb@FreeBSD.org>
To:        soralx@cydem.org.ua
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: misc/41772: can't disable keybell [PATCH]
Message-ID:  <XFMail.20030324104201.jhb@FreeBSD.org>
In-Reply-To: <200303222312.35930.soralx@cydem.org.ua>

next in thread | previous in thread | raw e-mail | index | archive | help

On 23-Mar-2003 soralx@cydem.org.ua wrote:
> 
>> Using kbdcontrol -b off on my laptop running current does
>> turn off the sound already.
> 
> I tested `kbdcontrol -b off` on FreeBSD 5.0-RELEASE, and it
> still did not turn off the beeper. I have also checked
> 'syscons.c', v. 1.399 ([0]), and foud only one change
> concerning keybell:
> 'if (cold || shutdown_in_progress || !enable_bell)' -
> ('enable_bell' added, which must be "hw.syscons.bell"
> sysctl var), that enables to turn the keybell off globally,
> but not for separate vtys.
> 
>> Incidentally, using quiet.off doesn't
>> shut it up either which is very confusing since quiet sets
>> SC_QUIET_BELL.
> 
> I tested this again, and it works fine:
> 
> `kbdcontrol -b quiet.normal`
> `(sleep 2;echo -e "\x07";sleep 2)&`
> When, after executing this command, i quickly switch to
> another vty, I hear no bell; when I stay on the same vty,
> I can hear the bell.
> 
>> PCI ID's for the ICH4 controllere were committed prior to 4.7.
> 
> good, found my controller's ID in the latest CVSweb ATA-PCI tree
> 
>> This patch would inadvertently turn off visual bell's if you
>> set the duration or pitch to zero manually.  A better patch
>> might be:
>>
>> Index: syscons.c
>> ===================================================================
>> RCS file: /usr/cvs/src/sys/dev/syscons/syscons.c,v
>> retrieving revision 1.399
>> diff -u -r1.399 syscons.c
>> --- syscons.c   3 Mar 2003 16:24:44 -0000       1.399
>> +++ syscons.c   22 Mar 2003 14:38:58 -0000
>> @@ -3547,7 +3547,7 @@
>>         if (scp != scp->sc->cur_scp)
>>             scp->sc->blink_in_progress += 2;
>>         blink_screen(scp->sc->cur_scp);
>> -    } else {
>> +    } else if (duration != 0 && pitch != 0) {
>>         if (scp != scp->sc->cur_scp)
>>             pitch *= 2;
>>         sysbeep(pitch, duration);
>>
>> Can you verify that this fix works for you?
> 
> yes, it does
> but, I think, this may produce faster code:
>  +    } else if (duration && pitch) {

Nope, optimizing like that is the compiler's job, not the authors.
Making readable code that follows style conventions leads to code
that is easier to maintain. :)

> I also found couple more problems:
> 
> 00.
> `kbdcontrol -b 128.800`
> `(sleep 2;echo -e "\x07";sleep 2)&`
> If I stay on the same vty, I hear 800Hz bell, if I switch
> to another vty, I hear ~400Hz bell.
> 
> `kbdcontrol -b normal`
> `(sleep 2;echo -e "\x07";sleep 2)&`
> If I stay on the same vty, I hear normal bell, if I switch
> to another vty, I hear a bell with pitch twice as _high_.
> 
> 01.
> `kbdcontrol quiet.115.400` - won't set SC_QUIET_BELL flag

I have no idea about these other bugs.

-- 

John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.20030324104201.jhb>