From e535318465cd474fde2fb6153b640fc2d626ef75 Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Fri, 23 Feb 2024 12:20:01 -0500 Subject: [PATCH] alsa: add ALSA_DEVICE_ID variable Note: asound.conf needs to be generated in alsa-state recipe. If not, the following warniong will occur when creating the final image: check_data_file_clashes: Package alsa-utils wants to install file ...image-hvmpd-dev/1.0-r0/rootfs/etc/asound.conf But that file is already provided by package * alsa-state --- conf/distro/hvmpd.conf | 2 ++ recipes-bsp/alsa-state/alsa-state.bbappend | 7 ++++--- recipes-multimedia/musicpd/mpd_%.bbappend | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/conf/distro/hvmpd.conf b/conf/distro/hvmpd.conf index f352305..d9dcc41 100644 --- a/conf/distro/hvmpd.conf +++ b/conf/distro/hvmpd.conf @@ -42,3 +42,5 @@ IMAGE_LINGUAS = "en-us en-ca" # the rootfs image, and not the WIC image, which would lead to differences # between the two images. WIC_CREATE_EXTRA_ARGS:append = " --no-fstab-update" + +ALSA_DEVICE_ID ?= "0" diff --git a/recipes-bsp/alsa-state/alsa-state.bbappend b/recipes-bsp/alsa-state/alsa-state.bbappend index fd004e2..b1b8aa8 100644 --- a/recipes-bsp/alsa-state/alsa-state.bbappend +++ b/recipes-bsp/alsa-state/alsa-state.bbappend @@ -4,7 +4,8 @@ SRC_URI:append = " \ file://asound.state \ " -do_install:append:raspberrypi() { - echo "defaults.pcm.card 1" >> ${D}${sysconfdir}/asound.conf - echo "defaults.ctl.card 1" >> ${D}${sysconfdir}/asound.conf +do_install:append() { + install -d ${D}${sysconfdir} + echo "defaults.pcm.card ${ALSA_DEVICE_ID}" >> ${D}${sysconfdir}/asound.conf + echo "defaults.ctl.card ${ALSA_DEVICE_ID}" >> ${D}${sysconfdir}/asound.conf } diff --git a/recipes-multimedia/musicpd/mpd_%.bbappend b/recipes-multimedia/musicpd/mpd_%.bbappend index dc4f844..0bb6f27 100644 --- a/recipes-multimedia/musicpd/mpd_%.bbappend +++ b/recipes-multimedia/musicpd/mpd_%.bbappend @@ -13,6 +13,7 @@ do_install:append() { echo "audio_output {" >> ${D}/${sysconfdir}/mpd.conf echo " type \"alsa\"" >> ${D}/${sysconfdir}/mpd.conf echo " name \"My ALSA Device\"" >> ${D}/${sysconfdir}/mpd.conf + echo " device \"hw:${ALSA_DEVICE_ID},0\"" >> ${D}/${sysconfdir}/mpd.conf echo "}" >> ${D}/${sysconfdir}/mpd.conf install -m 644 -o mpd -g audio ${WORKDIR}/*.m3u ${D}/${localstatedir}/lib/mpd/playlists/ -- 2.20.1