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

Jaroslav Kysela perex at perex.cz
Tue Nov 3 15:16:08 CET 2009


On Tue, 3 Nov 2009, Takashi Iwai wrote:

> At Tue, 3 Nov 2009 12:43:17 +0100 (CET),
> Jaroslav Kysela wrote:
>>
>> 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.
>
> Oh no, that'd be very strange behavior as an mixer element.

I recoded patch to delay the detach only to get consistent and abuse 
prone behaviour:

http://git.alsa-project.org/?p=alsa-kernel.git;a=commit;h=ba9c08c61338f298df34445715287beeca94b024
http://git.alsa-project.org/?p=alsa-kernel.git;a=commit;h=0633c8e977b7708ea122392d87cc15ca448fc5d5

The HDA beep output is muted immediately, of course.

 					Jaroslav

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



More information about the Alsa-devel mailing list