control: decode HDMI device name from ELD

The HDMI drivers set an uniform PCM names. Use ELD (EDID) to obtain
the HDMI device name and send this string to applications for a better
user experience.

Example (aplay -l):

  card 1: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2]
    Subdevices: 1/1

  vs improved:

  card 1: PCH [HDA Intel PCH], device 8: HDMI 2 [Philips 272P4]
    Subdevices: 1/1

Fixes: https://github.com/alsa-project/alsa-lib/issues/209
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2022-05-05 14:28:41 +02:00
parent 9c0c757b85
commit 859448f010
5 changed files with 111 additions and 1 deletions

View file

@ -287,6 +287,9 @@ static int snd_ctl_hw_pcm_info(snd_ctl_t *handle, snd_pcm_info_t * info)
snd_ctl_hw_t *hw = handle->private_data;
if (ioctl(hw->fd, SNDRV_CTL_IOCTL_PCM_INFO, info) < 0)
return -errno;
/* may be configurable (optional) */
if (__snd_pcm_info_eld_fixup_check(info))
return __snd_pcm_info_eld_fixup(info);
return 0;
}