diff --git a/package/alsa-utils/0001-alsactl-info.c-fix-conditionals-on-__ALSA_PCM_H-and-.patch b/package/alsa-utils/0001-alsactl-info.c-fix-conditionals-on-__ALSA_PCM_H-and-.patch new file mode 100644 index 0000000000..97c4729bf9 --- /dev/null +++ b/package/alsa-utils/0001-alsactl-info.c-fix-conditionals-on-__ALSA_PCM_H-and-.patch @@ -0,0 +1,108 @@ +From 4bfd1f15114550e1be7e43ae37a61906e1bff809 Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Sun, 17 Jul 2022 18:59:48 +0200 +Subject: [PATCH] alsactl/info.c: fix conditionals on __ALSA_PCM_H and + __ALSA_RAWMIDI_H + +Commit bbc74a61ac7c35e506c3d7f76ecf943cb55736a6 ("alsactl: implement +'info' command") implemented an alsactl info command. In this +implementation, there was an attempt to properly address optional +features from alsa-lib by using conditions on __ALSA_PCM_H, +__ALSA_RAWMIDI_H. + +Unfortunately, this attempt does not work entirely: only the code +inside pcm_device_list(), rawmidi_device_list() was conditionally +compiled, but their very prototype also use type definitions provided +in pcm.h and rawmidi.h. So really, it's the entire function that needs +to be conditionally implemented. + +Also, snd_rawmidi_stream_name() was not handled properly, for the same +reason. + +This commit implements pcm_device_list() only if __ALSA_PCM_H is +defined, and implements snd_rawmidi_stream_name() and +rawmidi_device_list() only if __ALSA_RAWMIDI_H is defined. + +general_card_info() is modified to not call the PCM or raw MIDI +functions when support is not available. + +Signed-off-by: Thomas Petazzoni +Upstream: https://mailman.alsa-project.org/pipermail/alsa-devel/2022-July/203846.html +--- + alsactl/info.c | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/alsactl/info.c b/alsactl/info.c +index 253539d..9bd72af 100644 +--- a/alsactl/info.c ++++ b/alsactl/info.c +@@ -22,9 +22,9 @@ + #include "aconfig.h" + #include "alsactl.h" + ++#ifdef __ALSA_PCM_H + static int pcm_device_list(snd_ctl_t *ctl, snd_pcm_stream_t stream, bool *first) + { +-#ifdef __ALSA_PCM_H + int err, dev, idx; + unsigned int count; + snd_pcm_info_t *pcminfo; +@@ -76,10 +76,12 @@ static int pcm_device_list(snd_ctl_t *ctl, snd_pcm_stream_t stream, bool *first) + idx, snd_pcm_info_get_subdevice_name(pcminfo)); + } + } +-#endif ++ + return 0; + } ++#endif + ++#ifdef __ALSA_RAWMIDI_H + static const char *snd_rawmidi_stream_name(snd_rawmidi_stream_t stream) + { + if (stream == SND_RAWMIDI_STREAM_INPUT) +@@ -91,7 +93,6 @@ static const char *snd_rawmidi_stream_name(snd_rawmidi_stream_t stream) + + static int rawmidi_device_list(snd_ctl_t *ctl, snd_rawmidi_stream_t stream, bool *first) + { +-#ifdef __ALSA_RAWMIDI_H + int err, dev, idx; + unsigned int count; + snd_rawmidi_info_t *info; +@@ -143,9 +144,10 @@ static int rawmidi_device_list(snd_ctl_t *ctl, snd_rawmidi_stream_t stream, bool + idx, snd_rawmidi_info_get_subdevice_name(info)); + } + } +-#endif ++ + return 0; + } ++#endif + + static int hwdep_device_list(snd_ctl_t *ctl) + { +@@ -227,17 +229,21 @@ int general_card_info(int cardno) + } + err = card_info(ctl); + ++#ifdef __ALSA_PCM_H + first = true; + if (err >= 0) + err = pcm_device_list(ctl, SND_PCM_STREAM_PLAYBACK, &first); + if (err >= 0) + err = pcm_device_list(ctl, SND_PCM_STREAM_CAPTURE, &first); ++#endif + ++#ifdef __ALSA_RAWMIDI_H + first = true; + if (err >= 0) + err = rawmidi_device_list(ctl, SND_PCM_STREAM_PLAYBACK, &first); + if (err >= 0) + err = rawmidi_device_list(ctl, SND_PCM_STREAM_CAPTURE, &first); ++#endif + + if (err >= 0) + err = hwdep_device_list(ctl); +-- +2.36.1 + diff --git a/package/alsa-utils/0002-aplay-aplay.c-make-UCM-support-optional.patch b/package/alsa-utils/0002-aplay-aplay.c-make-UCM-support-optional.patch new file mode 100644 index 0000000000..0d58ae81a4 --- /dev/null +++ b/package/alsa-utils/0002-aplay-aplay.c-make-UCM-support-optional.patch @@ -0,0 +1,89 @@ +From 1921efacfe1a230021849b83b2877c8f239b44ab Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Sun, 17 Jul 2022 19:09:04 +0200 +Subject: [PATCH] aplay/aplay.c: make UCM support optional + +Commit 90f59671784a7e47b40485095cd66892d4840ed7 ("topology: +pre-processor: Move the call to expand variables") modified aplay by +unconditionally invoking features of the use case manager (UCM) from +alsa-lib. However, alsa-lib can be compiled without UCM support. + +In order to properly support this situation, this commit changes aplay +to only conditionally compile the UCM related code. + +Signed-off-by: Thomas Petazzoni +Upstream: https://mailman.alsa-project.org/pipermail/alsa-devel/2022-July/203847.html +--- + aplay/aplay.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/aplay/aplay.c b/aplay/aplay.c +index b3b3635..59f937d 100644 +--- a/aplay/aplay.c ++++ b/aplay/aplay.c +@@ -41,7 +41,9 @@ + #include + #include + #include ++#ifdef HAVE_ALSA_USE_CASE_H + #include ++#endif + #include + #include + #include +@@ -453,6 +455,7 @@ static ssize_t xwrite(int fd, const void *buf, size_t count) + return offset; + } + ++#ifdef HAVE_ALSA_USE_CASE_H + static int open_ucm(snd_use_case_mgr_t **uc_mgr, char **pcm_name, const char *name) + { + char *s, *p; +@@ -476,6 +479,7 @@ static int open_ucm(snd_use_case_mgr_t **uc_mgr, char **pcm_name, const char *na + } + return err; + } ++#endif + + static long parse_long(const char *str, int *err) + { +@@ -553,7 +557,9 @@ int main(int argc, char *argv[]) + int do_device_list = 0, do_pcm_list = 0, force_sample_format = 0; + snd_pcm_info_t *info; + FILE *direction; ++#ifdef HAVE_ALSA_USE_CASE_H + snd_use_case_mgr_t *uc_mgr = NULL; ++#endif + + #ifdef ENABLE_NLS + setlocale(LC_ALL, ""); +@@ -852,6 +858,7 @@ int main(int argc, char *argv[]) + goto __end; + } + ++#ifdef HAVE_ALSA_USE_CASE_H + if (strncmp(pcm_name, "ucm.", 4) == 0) { + err = open_ucm(&uc_mgr, &pcm_name, pcm_name + 4); + if (err < 0) { +@@ -861,6 +868,7 @@ int main(int argc, char *argv[]) + if (verbose) + fprintf(stderr, _("Found UCM PCM device: %s\n"), pcm_name); + } ++#endif + + err = snd_pcm_open(&handle, pcm_name, stream, open_mode); + if (err < 0) { +@@ -951,8 +959,10 @@ int main(int argc, char *argv[]) + if (verbose==2) + putchar('\n'); + snd_pcm_close(handle); ++#ifdef HAVE_ALSA_USE_CASE_H + if (uc_mgr) + snd_use_case_mgr_close(uc_mgr); ++#endif + handle = NULL; + free(audiobuf); + __end: +-- +2.36.1 +