[alsa-devel] PC Beep or PC Speaker or just Beep? and HDA Beep code...

Jaroslav Kysela perex at perex.cz
Tue Nov 3 12:43:17 CET 2009


On Tue, 3 Nov 2009, Takashi Iwai wrote:

> At Tue, 3 Nov 2009 12:01:57 +0100 (CET),
> Jaroslav Kysela wrote:
>>
>> On Fri, 30 Oct 2009, Takashi Iwai wrote:
>>
>>> At Thu, 22 Oct 2009 17:50:10 +0200 (CEST),
>>> Jaroslav Kysela wrote:
>>>>
>>>> Hi,
>>>>
>>>>  	I'm changing the behaviour of Beep / PC Beep controls for HDA
>>>> drivers (comments?):
>>>>
>>>> http://git.alsa-project.org/?p=alsa-kernel.git;a=commitdiff;h=d605dbeed1b102136513e09e95217e8dc19c800d
>>>
>>> Well, IMHO, the fundamental problem is that there is no logic to
>>> select the beep device in the input layer.  A few line of code to
>>> drivers/char/keyboard.c would do that.
>>
>> Yes, it would be good to have possibility to configure which input device
>> will receive beep events.
>
> I had even a patch somewhere... I need to dig down my archive.
>
>>> Regarding your change: I'm afraid that too frequent attach/detach
>>> calls aren't good.
>>
>> What's too frequent? The attach/detach is called only when Beep mute
>> control is toggled. I don't think that user will toggle this control as
>> more as once in a normal system setup. The default value is "muted"
>> (no registration) anyway.
>
> Heh, you can't expect how odd things users would do.
> I can foresee this too frequent toggling can happen simply, e.g. key
> auto-repeating on a mute button.
>
>> I would really like to have the HDA Beep registration to input layer
>> configurable at runtime. The control layer seems good for this job.
>> I can eventually add one more control with name like "Beep Register
>> Switch", but the "Beep Playback Switch" does this job well.
>
> Well, the biggest problem in your patch is that its re-register the
> input device.  When you watch the kernel message, you'll find that the
> new input device is added at each time you toggle the beep switch,
>  input: HDA Digital PCBeep as /devices/pci0000:00/0000:00:1b.0/input/input6
>  input: HDA Digital PCBeep as /devices/pci0000:00/0000:00:1b.0/input/input7
>  ...
> With frequent toggles, you can reach to a very high number very
> easily.

I don't see a problem. If you find the behaviour too risky, we can limit 
the register/unregister calls in time. Like one register call in one 
second.

>>>  Also, note that there are hardwares that still
>>> beep even when the beep volume is set to zero.  So, you may get a
>>> situation that you can't disable beep tone.
>>
>> ??? If you don't set HDA codec frequency registers, then the HDA
>> digital beep cannot be generated.
>
> It's a scenario like below:
>  - "Beep Playback Switch" off -> pcspr is activated; no way to
>    control the beep volume -> beep always heard

Users can still disable beeps using standard I/O layer (as described in 
patch comment):

The user can easy disable all beeps using 'setterm -blength 0' or 'xset b 
off' command.

>  - "Beep Playback Switch" on -> HD-audio beep active; but it's still
>    audible even when "Beep Playback Volume" is zero -> beep always
>    heard
>
> So, in this case, you can't kill beep tones.

You can.

 					Jaroslav

-----
Jaroslav Kysela <perex at perex.cz>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.



More information about the Alsa-devel mailing list