[alsa-devel] [PATCH 2/2] ALSA: hda - Add keycode map for alc input device

Takashi Iwai tiwai at suse.de
Fri Dec 25 08:51:53 CET 2015


On Thu, 24 Dec 2015 04:46:38 +0100,
Hui Wang wrote:
> 
> Then users can remap the keycode from userspace. If without the remap,
> the input device will pass KEY_MICMUTE to userspace, but in X11 layer,
> it uses KEY_F20 rather than KEY_MICMUTE for XF86AudioMicMute. After
> adding the keycode map, users can remap the keycode to any value users
> want.
> 
> And there are two places to register the input device, to make the
> code simple and clean, we move the two same code sections into a
> function.

Having this change at first would be better.  Then you can avoid a
build-and-scratch sequence but just use the new helper from the
beginning.

Also...

> Cc: <stable at vger.kernel.org>
> Signed-off-by: Hui Wang <hui.wang at canonical.com>
> ---
>  sound/pci/hda/patch_realtek.c | 68 +++++++++++++++++++++++++------------------
>  1 file changed, 40 insertions(+), 28 deletions(-)
> 
> diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
> index 8adff4f..97f22ad 100644
> --- a/sound/pci/hda/patch_realtek.c
> +++ b/sound/pci/hda/patch_realtek.c
> @@ -67,6 +67,14 @@ enum {
>  	ALC_HEADSET_TYPE_OMTP,
>  };
>  
> +enum {
> +	ALC_KEY_MICMUTE_INDEX,
> +};
> +
> +static u8 alc_mute_keycode_map[] = {
> +	KEY_MICMUTE,	/* index=0, microphone mute key code */
> +};

You're sharing this array, and remapping will overwrite this.
For example, if the codec is once unbound and bound again, the
modified keymap will be passed to the new instance.  Use an array in
alc_spec instead.


Takashi


More information about the Alsa-devel mailing list