From f5a0428e9a087b1d5c94170d723542f75161226e Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Oct 05 2021 18:33:23 +0000 Subject: import alsa-utils-1.2.5-3.el8 --- diff --git a/.alsa-utils.metadata b/.alsa-utils.metadata index 40c44b3..fb16a43 100644 --- a/.alsa-utils.metadata +++ b/.alsa-utils.metadata @@ -1 +1 @@ -84b2c5e8f0c345844e03e8e4ae73b761c3ae8829 SOURCES/alsa-utils-1.2.4.tar.bz2 +51ed4a6a5d151f4c3b580464460c3788ee1e90fb SOURCES/alsa-utils-1.2.5.tar.bz2 diff --git a/.gitignore b/.gitignore index 4136652..cba7815 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/alsa-utils-1.2.4.tar.bz2 +SOURCES/alsa-utils-1.2.5.tar.bz2 diff --git a/SOURCES/alsa-git.patch b/SOURCES/alsa-git.patch index b6ad492..c43a81d 100644 --- a/SOURCES/alsa-git.patch +++ b/SOURCES/alsa-git.patch @@ -1,441 +1,936 @@ -From 737b64e1940b29c575be3942cd9f87aa390d93b2 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=E7=A9=8D=E4=B8=B9=E5=B0=BC=20Dan=20Jacobson?= - -Date: Sun, 18 Oct 2020 18:33:54 +0800 -Subject: [PATCH 02/14] alsamixer: Fix the mixer views description in man page +From 78212445de4c8e07873cbc7dff2abcacd031f151 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 1 Jun 2021 17:47:42 +0200 +Subject: [PATCH 01/16] alsactl: fix the nested iteration -Fix grammar mess. +There may be nested iterations for hw: card names. +Handle this card name in snd_card_iterator_sinit(). -From: Dan Jacobson +BugLink: https://github.com/alsa-project/alsa-lib/issues/142 +Fixes: eefc2c6 ("alsactl: use card iterator functions for all card loops") Signed-off-by: Jaroslav Kysela --- - alsamixer/alsamixer.1 | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + alsactl/utils.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/alsactl/utils.c b/alsactl/utils.c +index c79fd95..881b505 100644 +--- a/alsactl/utils.c ++++ b/alsactl/utils.c +@@ -247,6 +247,8 @@ int snd_card_iterator_sinit(struct snd_card_iterator *iter, const char *cardname + int cardno = -1; + + if (cardname) { ++ if (strncmp(cardname, "hw:", 3) == 0) ++ cardname += 3; + cardno = snd_card_get_index(cardname); + if (cardno < 0) { + error("Cannot find soundcard '%s'...", cardname); +-- +2.30.2 + -diff --git a/alsamixer/alsamixer.1 b/alsamixer/alsamixer.1 -index 8d34680..2d711cf 100644 ---- a/alsamixer/alsamixer.1 -+++ b/alsamixer/alsamixer.1 -@@ -34,7 +34,7 @@ Toggle the using of colors. +From 3d7a6facd9e1f962eef6c4ba3aa4cdc22477a6ac Mon Sep 17 00:00:00 2001 +From: Chao Song +Date: Mon, 31 May 2021 10:29:57 +0800 +Subject: [PATCH 02/16] topology: fix potential null pointer from strchr + +This patch adds check to the return pointer from strchr, +because it may be null and cause segment fault, if component +is not properly constructed. + +Fixes: https://github.com/alsa-project/alsa-utils/pull/91 +Signed-off-by: Chao Song +Signed-off-by: Jaroslav Kysela +--- + topology/pre-process-dapm.c | 5 +++++ + topology/pre-process-object.c | 5 +++++ + 2 files changed, 10 insertions(+) + +diff --git a/topology/pre-process-dapm.c b/topology/pre-process-dapm.c +index 450ca71..dbaf2f1 100644 +--- a/topology/pre-process-dapm.c ++++ b/topology/pre-process-dapm.c +@@ -146,6 +146,11 @@ static int tplg_pp_get_widget_name(struct tplg_pre_processor *tplg_pp, - .SH MIXER VIEWS + /* get class name */ + args = strchr(string, '.'); ++ if (!args) { ++ SNDERR("Error getting class name for %s\n", string); ++ return -EINVAL; ++ } ++ + class_name = calloc(1, strlen(string) - strlen(args) + 1); + if (!class_name) + return -ENOMEM; +diff --git a/topology/pre-process-object.c b/topology/pre-process-object.c +index 09aa375..ac8caec 100644 +--- a/topology/pre-process-object.c ++++ b/topology/pre-process-object.c +@@ -492,6 +492,11 @@ static int tplg_pp_add_object_tuple_section(struct tplg_pre_processor *tplg_pp, + } --The top-left corner of \fBalsamixer\fP is the are to show some basic -+The top-left corner of \fBalsamixer\fP shows some basic - information: the card name, the mixer chip name, the current view - mode and the currently selected mixer item. - When the mixer item is switched off, \fI[Off]\fP is displayed in its + type = strchr(token_ref, '.'); ++ if(!type) { ++ SNDERR("Error getting type for %s\n", token_ref); ++ return -EINVAL; ++ } ++ + token = calloc(1, strlen(token_ref) - strlen(type) + 1); + if (!token) + return -ENOMEM; -- -2.29.2 +2.30.2 + -From 986a1bd3d2eebd41a2925969826fca870b2cd330 Mon Sep 17 00:00:00 2001 +From d6d566a9eebb63dd9d1351b07d385d39cdc33beb Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela -Date: Fri, 23 Oct 2020 12:05:56 +0200 -Subject: [PATCH 06/14] aplay: cosmetic code fix in xrun() +Date: Fri, 4 Jun 2021 09:53:56 +0200 +Subject: [PATCH 03/16] alsactl: return error value in dump_config_tree() Signed-off-by: Jaroslav Kysela --- - aplay/aplay.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) + alsactl/alsactl.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/aplay/aplay.c b/aplay/aplay.c -index a27220d..ae60988 100644 ---- a/aplay/aplay.c -+++ b/aplay/aplay.c -@@ -1676,7 +1676,8 @@ static void xrun(void) - prg_exit(EXIT_FAILURE); - } - return; /* ok, data should be accepted again */ -- } if (snd_pcm_status_get_state(status) == SND_PCM_STATE_DRAINING) { -+ } -+ if (snd_pcm_status_get_state(status) == SND_PCM_STATE_DRAINING) { - if (verbose) { - fprintf(stderr, _("Status(DRAINING):\n")); - snd_pcm_status_dump(status, log); +diff --git a/alsactl/alsactl.c b/alsactl/alsactl.c +index a011284..05738fb 100644 +--- a/alsactl/alsactl.c ++++ b/alsactl/alsactl.c +@@ -170,7 +170,7 @@ static int dump_config_tree(snd_config_t *top) + return err; + err = snd_config_save(top, out); + snd_output_close(out); +- return 0; ++ return err; + } + + static int dump_state(const char *file) -- -2.29.2 +2.30.2 -From c1b92db5ef01311e5fc983f3134caa00826d0c2d Mon Sep 17 00:00:00 2001 +From 511dd7a597735048f3883ef7883adf853ac2de4a Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela -Date: Sun, 8 Nov 2020 19:11:12 +0100 -Subject: [PATCH 07/14] aplay: fix the CPU busy loop in the pause handler - -Use the standard poll mechanism to ensure that there's -something in the input to avoid busy loop on the file -descriptor with the non-block mode set. +Date: Fri, 4 Jun 2021 09:56:20 +0200 +Subject: [PATCH 04/16] alsactl: init() - return error value from + snd_card_iterator_sinit() call Signed-off-by: Jaroslav Kysela --- - aplay/aplay.c | 17 +++++++++++++++-- - 1 file changed, 15 insertions(+), 2 deletions(-) + alsactl/init_parse.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/alsactl/init_parse.c b/alsactl/init_parse.c +index 9d0f473..e439de7 100644 +--- a/alsactl/init_parse.c ++++ b/alsactl/init_parse.c +@@ -1751,6 +1751,8 @@ int init(const char *cfgdir, const char *filename, int flags, const char *cardna + + sysfs_init(); + err = snd_card_iterator_sinit(&iter, cardname); ++ if (err < 0) ++ goto out; + while (snd_card_iterator_next(&iter)) { + err = snd_card_clean_cfgdir(cfgdir, iter.card); + if (err < 0) { +-- +2.30.2 -diff --git a/aplay/aplay.c b/aplay/aplay.c -index ae60988..d385da2 100644 ---- a/aplay/aplay.c -+++ b/aplay/aplay.c -@@ -1553,6 +1553,19 @@ static void done_stdin(void) - tcsetattr(fileno(stdin), TCSANOW, &term); - } + +From 2bc595e7bd9a9b8f8605104cfdb8f40a07c2655b Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 4 Jun 2021 09:58:46 +0200 +Subject: [PATCH 05/16] alsactl: check for error values from + snd_config_get...() + +Signed-off-by: Jaroslav Kysela +--- + alsactl/state.c | 41 ++++++++++++++++++++++++++++------------- + 1 file changed, 28 insertions(+), 13 deletions(-) + +diff --git a/alsactl/state.c b/alsactl/state.c +index 44fda3f..b3a3f4d 100644 +--- a/alsactl/state.c ++++ b/alsactl/state.c +@@ -655,13 +655,16 @@ static long config_iface(snd_config_t *n) + const char *str; + switch (snd_config_get_type(n)) { + case SND_CONFIG_TYPE_INTEGER: +- snd_config_get_integer(n, &i); ++ if (snd_config_get_integer(n, &i) < 0) ++ return -1; + return i; + case SND_CONFIG_TYPE_INTEGER64: +- snd_config_get_integer64(n, &li); ++ if (snd_config_get_integer64(n, &li) < 0) ++ return -1; + return li; + case SND_CONFIG_TYPE_STRING: +- snd_config_get_string(n, &str); ++ if (snd_config_get_string(n, &str) < 0) ++ return -1; + break; + default: + return -1; +@@ -681,17 +684,20 @@ static int config_bool(snd_config_t *n, int doit) -+static char wait_for_input(void) -+{ -+ struct pollfd pfd; -+ unsigned char b; -+ -+ do { -+ pfd.fd = fileno(stdin); -+ pfd.events = POLLIN; -+ poll(&pfd, 1, -1); -+ } while (read(fileno(stdin), &b, 1) != 1); -+ return b; -+} -+ - static void do_pause(void) - { - int err; -@@ -1571,7 +1584,7 @@ static void do_pause(void) - return; - } - while (1) { -- while (read(fileno(stdin), &b, 1) != 1); -+ b = wait_for_input(); - if (b == ' ' || b == '\r') { - while (read(fileno(stdin), &b, 1) == 1); - if (snd_pcm_state(handle) == SND_PCM_STATE_SUSPENDED) -@@ -1596,7 +1609,7 @@ static void check_stdin(void) - while (read(fileno(stdin), &b, 1) == 1); - fprintf(stderr, _("\r=== PAUSE === ")); - fflush(stderr); -- do_pause(); -+ do_pause(); - fprintf(stderr, " \r"); - fflush(stderr); + switch (snd_config_get_type(n)) { + case SND_CONFIG_TYPE_INTEGER: +- snd_config_get_integer(n, &val); ++ if (snd_config_get_integer(n, &val) < 0) ++ return -1; + if (val < 0 || val > 1) + return -1; + return val; + case SND_CONFIG_TYPE_INTEGER64: +- snd_config_get_integer64(n, &lval); ++ if (snd_config_get_integer64(n, &lval) < 0) ++ return -1; + if (lval < 0 || lval > 1) + return -1; + return (int) lval; + case SND_CONFIG_TYPE_STRING: +- snd_config_get_string(n, &str); ++ if (snd_config_get_string(n, &str) < 0) ++ return -1; + break; + case SND_CONFIG_TYPE_COMPOUND: + if (!force_restore || !doit) +@@ -718,13 +724,16 @@ static int config_enumerated(snd_config_t *n, snd_ctl_t *handle, + + switch (snd_config_get_type(n)) { + case SND_CONFIG_TYPE_INTEGER: +- snd_config_get_integer(n, &val); ++ if (snd_config_get_integer(n, &val) < 0) ++ return -1; + return val; + case SND_CONFIG_TYPE_INTEGER64: +- snd_config_get_integer64(n, &lval); ++ if (snd_config_get_integer64(n, &lval) < 0) ++ return -1; + return (int) lval; + case SND_CONFIG_TYPE_STRING: +- snd_config_get_string(n, &str); ++ if (snd_config_get_string(n, &str) < 0) ++ return -1; + break; + case SND_CONFIG_TYPE_COMPOUND: + if (!force_restore || !doit) +@@ -1247,6 +1256,8 @@ static int set_control(snd_ctl_t *handle, snd_config_t *control, + } + if (strcmp(fld, "iface") == 0) { + iface = (snd_ctl_elem_iface_t)config_iface(n); ++ if (iface < 0) ++ return -EINVAL; + continue; + } + if (strcmp(fld, "device") == 0) { +@@ -1254,7 +1265,8 @@ static int set_control(snd_ctl_t *handle, snd_config_t *control, + cerror(doit, "control.%d.%s is invalid", numid, fld); + return -EINVAL; + } +- snd_config_get_integer(n, &device); ++ if (snd_config_get_integer(n, &device) < 0) ++ return -EINVAL; + continue; + } + if (strcmp(fld, "subdevice") == 0) { +@@ -1262,7 +1274,8 @@ static int set_control(snd_ctl_t *handle, snd_config_t *control, + cerror(doit, "control.%d.%s is invalid", numid, fld); + return -EINVAL; + } +- snd_config_get_integer(n, &subdevice); ++ if (snd_config_get_integer(n, &subdevice) < 0) ++ return -EINVAL; + continue; + } + if (strcmp(fld, "name") == 0) { +@@ -1270,7 +1283,8 @@ static int set_control(snd_ctl_t *handle, snd_config_t *control, + cerror(doit, "control.%d.%s is invalid", numid, fld); + return -EINVAL; } +- snd_config_get_string(n, &name); ++ if (snd_config_get_string(n, &name) < 0) ++ return -EINVAL; + continue; + } + if (strcmp(fld, "index") == 0) { +@@ -1278,7 +1292,8 @@ static int set_control(snd_ctl_t *handle, snd_config_t *control, + cerror(doit, "control.%d.%s is invalid", numid, fld); + return -EINVAL; + } +- snd_config_get_integer(n, &index); ++ if (snd_config_get_integer(n, &index) < 0) ++ return -EINVAL; + continue; + } + if (strcmp(fld, "value") == 0) { -- -2.29.2 +2.30.2 -From 5812f37d877c12bc594b9ffddc493d305991963a Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Wed, 9 Dec 2020 18:35:49 +0100 -Subject: [PATCH 08/14] alsa-info: Add lsusb and stream outputs - -We need more detailed information for USB-audio devices, at least the -lsusb -v output and the contents of stream* proc files. -Let's add them to alsa-info.sh output. +From 646d6ff094a82153db49af176cba3aacbde46cf6 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 4 Jun 2021 10:04:50 +0200 +Subject: [PATCH 06/16] =?UTF-8?q?alsactl:=20state=20-=20fix=20=E2=80=98ite?= + =?UTF-8?q?m=E2=80=99=20may=20be=20used=20uninitialized=20gcc=20warning?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit -Signed-off-by: Takashi Iwai +Signed-off-by: Jaroslav Kysela --- - alsa-info/alsa-info.sh | 33 +++++++++++++++++++++++++++++++++ - 1 file changed, 33 insertions(+) - -diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh -index f179bfa..3871b97 100755 ---- a/alsa-info/alsa-info.sh -+++ b/alsa-info/alsa-info.sh -@@ -476,6 +476,18 @@ cat /proc/asound/card*/codec\#* > $TEMPDIR/alsa-hda-intel.tmp 2> /dev/null - cat /proc/asound/card*/codec97\#0/ac97\#0-0 > $TEMPDIR/alsa-ac97.tmp 2> /dev/null - cat /proc/asound/card*/codec97\#0/ac97\#0-0+regs > $TEMPDIR/alsa-ac97-regs.tmp 2> /dev/null - -+#Check for USB descriptors -+if [ -x /usr/bin/lsusb ]; then -+ for f in /proc/asound/card[0-9]*/usbbus; do -+ test -f "$f" || continue -+ id=$(sed 's@/@:@' $f) -+ lsusb -v -s $id >> $TEMPDIR/lsusb.tmp 2> /dev/null -+ done -+fi -+ -+#Check for USB stream setup -+cat /proc/asound/card*/stream[0-9]* > $TEMPDIR/alsa-usbstream.tmp 2> /dev/null -+ - #Check for USB mixer setup - cat /proc/asound/card*/usbmixer > $TEMPDIR/alsa-usbmixer.tmp 2> /dev/null - -@@ -649,6 +661,27 @@ if [ -s "$TEMPDIR/alsa-ac97.tmp" ]; then - echo "" >> $FILE - fi - -+if [ -s "$TEMPDIR/lsusb.tmp" ]; then -+ echo "!!USB Descriptors" >> $FILE -+ echo "!!---------------" >> $FILE -+ echo "--startcollapse--" >> $FILE -+ cat $TEMPDIR/lsusb.tmp >> $FILE -+ echo "--endcollapse--" >> $FILE -+ echo "" >> $FILE -+ echo "" >> $FILE -+fi -+ -+if [ -s "$TEMPDIR/lsusb.tmp" ]; then -+ echo "!!USB Stream information" >> $FILE -+ echo "!!----------------------" >> $FILE -+ echo "--startcollapse--" >> $FILE -+ echo "" >> $FILE -+ cat $TEMPDIR/alsa-usbstream.tmp >> $FILE -+ echo "--endcollapse--" >> $FILE -+ echo "" >> $FILE -+ echo "" >> $FILE -+fi -+ - if [ -s "$TEMPDIR/alsa-usbmixer.tmp" ]; then - echo "!!USB Mixer information" >> $FILE - echo "!!---------------------" >> $FILE --- -2.29.2 + alsactl/state.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) +diff --git a/alsactl/state.c b/alsactl/state.c +index b3a3f4d..9c75688 100644 +--- a/alsactl/state.c ++++ b/alsactl/state.c +@@ -229,7 +229,7 @@ static int get_control(snd_ctl_t *handle, snd_ctl_elem_id_t *id, snd_config_t *t + { + snd_ctl_elem_value_t *ctl; + snd_ctl_elem_info_t *info; +- snd_config_t *control, *comment, *item, *value; ++ snd_config_t *control, *comment, *item = NULL, *value; + const char *s; + char buf[256]; + unsigned int idx; +-- +2.30.2 -From 878e1a7c0f03233530e7675ae015aced069c971d Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Fri, 11 Dec 2020 23:41:59 +0100 -Subject: [PATCH 10/14] alsactl: Fix double decrease of lock timeout -The state_lock() has a loop to wait for the lock file creation, and -the timeout value gets decremented twice mistakenly, which leads to a -half timeout (5 seconds) than expected 10 seconds. Fix it. +From cd2f779b8d6439479b9802e9fd2c8af86f8702fb Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 4 Jun 2021 10:08:18 +0200 +Subject: [PATCH 07/16] alsactl: fix lock_fd unlock in load_configuration() - + error path -Signed-off-by: Takashi Iwai +Signed-off-by: Jaroslav Kysela --- - alsactl/lock.c | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/alsactl/lock.c b/alsactl/lock.c -index 4a48539..05f6e4d 100644 ---- a/alsactl/lock.c -+++ b/alsactl/lock.c -@@ -63,7 +63,6 @@ static int state_lock_(const char *file, int lock, int timeout, int _fd) - if (fd < 0) { - if (errno == EBUSY || errno == EAGAIN) { - sleep(1); -- timeout--; - } else { - err = -errno; - goto out; + alsactl/utils.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/alsactl/utils.c b/alsactl/utils.c +index 881b505..fd4a108 100644 +--- a/alsactl/utils.c ++++ b/alsactl/utils.c +@@ -220,15 +220,17 @@ int load_configuration(const char *file, snd_config_t **top, int *open_failed) + } + err = snd_config_load(config, in); + snd_input_close(in); +- if (lock_fd >= 0) +- state_unlock(lock_fd, file); + if (err < 0) { + error("snd_config_load error: %s", snd_strerror(err)); + out: ++ if (lock_fd >= 0) ++ state_unlock(lock_fd, file); + snd_config_delete(config); + snd_config_update_free_global(); + return err; + } else { ++ if (lock_fd >= 0) ++ state_unlock(lock_fd, file); + *top = config; + return 0; + } -- -2.29.2 +2.30.2 -From c53f7cd03881092d5a61505d23ab8f920b7faf12 Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Fri, 11 Dec 2020 23:46:23 +0100 -Subject: [PATCH 11/14] alsactl: Fix race at creating a lock file +From 74ad91245f8257e242cf5b5b6b809f94321f197a Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 4 Jun 2021 10:12:06 +0200 +Subject: [PATCH 08/16] axfer: fix wrong calloc() item size in + allocate_containers() -A race at creating a lock file in state_lock() was discovered -recently: namely, between the first open(O_RDWR) and the second -open(O_RDWR|O_CREAT|O_EXCL) calls, another alsactl invocation may -already create a lock file, then the second open() will return EEXIST, -which isn't handled properly and treated as a fatal error. +Signed-off-by: Jaroslav Kysela +--- + axfer/subcmd-transfer.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) -In this patch, we check EEXIST case and try again open() with O_RDWR. -This must succeed usually, and if it fails, handle finally as the -fatal error. +diff --git a/axfer/subcmd-transfer.c b/axfer/subcmd-transfer.c +index 27d2cc5..839215a 100644 +--- a/axfer/subcmd-transfer.c ++++ b/axfer/subcmd-transfer.c +@@ -155,7 +155,7 @@ static int allocate_containers(struct context *ctx, unsigned int count) + return -ENOMEM; + ctx->cntr_count = count; + +- ctx->cntr_fds = calloc(count, sizeof(*ctx->cntrs)); ++ ctx->cntr_fds = calloc(count, sizeof(*ctx->cntr_fds)); + if (ctx->cntr_fds == NULL) + return -ENOMEM; + +-- +2.30.2 -BugLink: https://bugzilla.opensuse.org/show_bug.cgi?id=1179904 -Signed-off-by: Takashi Iwai + +From c58f981e1530557835461b17b92eac6c475e5f68 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 4 Jun 2021 10:19:22 +0200 +Subject: [PATCH 09/16] topology: fix few coverity detected defects + +Signed-off-by: Jaroslav Kysela --- - alsactl/lock.c | 11 ++++++++--- - 1 file changed, 8 insertions(+), 3 deletions(-) - -diff --git a/alsactl/lock.c b/alsactl/lock.c -index 05f6e4d..5b47462 100644 ---- a/alsactl/lock.c -+++ b/alsactl/lock.c -@@ -63,10 +63,15 @@ static int state_lock_(const char *file, int lock, int timeout, int _fd) - if (fd < 0) { - if (errno == EBUSY || errno == EAGAIN) { - sleep(1); -- } else { -- err = -errno; -- goto out; -+ continue; - } -+ if (errno == EEXIST) { -+ fd = open(nfile, O_RDWR); -+ if (fd >= 0) -+ break; -+ } -+ err = -errno; -+ goto out; - } + topology/pre-process-dapm.c | 3 ++- + topology/pre-process-object.c | 15 ++++++++++----- + topology/pre-processor.c | 2 +- + 3 files changed, 13 insertions(+), 7 deletions(-) + +diff --git a/topology/pre-process-dapm.c b/topology/pre-process-dapm.c +index dbaf2f1..dc510e1 100644 +--- a/topology/pre-process-dapm.c ++++ b/topology/pre-process-dapm.c +@@ -203,7 +203,8 @@ static int tplg_pp_get_widget_name(struct tplg_pre_processor *tplg_pp, + + if (!args) { + SNDERR("insufficient arugments for widget %s\n", string); +- return -EINVAL; ++ ret = -EINVAL; ++ goto err; + } + + remaining = strchr(args + 1, '.'); +diff --git a/topology/pre-process-object.c b/topology/pre-process-object.c +index ac8caec..7565091 100644 +--- a/topology/pre-process-object.c ++++ b/topology/pre-process-object.c +@@ -463,7 +463,8 @@ static snd_config_t *tplg_object_lookup_in_config(struct tplg_pre_processor *tpl + if (!config_id) + return NULL; + +- snd_config_search(class, config_id, &obj_cfg); ++ if (snd_config_search(class, config_id, &obj_cfg) < 0) ++ return NULL; + free(config_id); + return obj_cfg; + } +@@ -704,11 +705,12 @@ static int tplg_add_object_data(struct tplg_pre_processor *tplg_pp, snd_config_t + + ret = tplg_pp_add_object_tuple_section(tplg_pp, class_cfg, n, data_cfg_name, + token); +- free(data_cfg_name); + if (ret < 0) { + SNDERR("Failed to add data section %s\n", data_cfg_name); ++ free(data_cfg_name); + return ret; } ++ free(data_cfg_name); } + + return 0; +@@ -1215,8 +1217,10 @@ static int tplg_construct_object_name(struct tplg_pre_processor *tplg_pp, snd_co + return 0; + + /* set class name as the name prefix for the object */ +- snd_config_get_id(obj, &obj_id); +- snd_config_get_id(class_cfg, &class_id); ++ if (snd_config_get_id(obj, &obj_id) < 0) ++ return -EINVAL; ++ if (snd_config_get_id(class_cfg, &class_id) < 0) ++ return -EINVAL; + new_name = strdup(class_id); + if (!new_name) + return -ENOMEM; +@@ -1280,7 +1284,8 @@ static int tplg_construct_object_name(struct tplg_pre_processor *tplg_pp, snd_co + default: + SNDERR("Argument '%s' in object '%s.%s' is not an integer or a string\n", + s, class_id, obj_id); +- return -EINVAL; ++ ret = -EINVAL; ++ goto err; + } + + /* alloc and concat arg value to the name */ +diff --git a/topology/pre-processor.c b/topology/pre-processor.c +index 0458c3c..442dcc4 100644 +--- a/topology/pre-processor.c ++++ b/topology/pre-processor.c +@@ -183,7 +183,7 @@ int init_pre_precessor(struct tplg_pre_processor **tplg_pp, snd_output_type_t ty + + _tplg_pp = calloc(1, sizeof(struct tplg_pre_processor)); + if (!_tplg_pp) +- ret = -ENOMEM; ++ return -ENOMEM; + + *tplg_pp = _tplg_pp; + -- -2.29.2 +2.30.2 -From 12487b40b6e7230a003eb6e4333ee820d8578592 Mon Sep 17 00:00:00 2001 -From: Takashi Iwai -Date: Fri, 11 Dec 2020 23:55:34 +0100 -Subject: [PATCH 12/14] alsactl: Remove asound.state file check from - alsa-restore.service again +From f138117a457944ca73776bd752693d64ec207e55 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 7 Jun 2021 17:21:56 +0200 +Subject: [PATCH 10/16] alsactl: load_state() - initialize config variable for + the open_failed case + +Fixes: https://github.com/alsa-project/alsa-utils/issues/93 +Signed-off-by: Jaroslav Kysela +--- + alsactl/state.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/alsactl/state.c b/alsactl/state.c +index 9c75688..439e1f8 100644 +--- a/alsactl/state.c ++++ b/alsactl/state.c +@@ -1642,6 +1642,7 @@ int load_state(const char *cfgdir, const char *file, + snd_config_t *config; + const char *cardname1; + ++ config = NULL; + err = load_configuration(file, &config, &open_failed); + if (err < 0 && !open_failed) + return err; +-- +2.30.2 + + +From 6018c2014ac24877b2aa58c2c57f2fd901e6c7b1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?S=C3=B6ren=20Tempel?= +Date: Sun, 6 Jun 2021 03:14:19 +0200 +Subject: [PATCH 11/16] alsactl: load_state: Only delete config if one was + loaded +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +If load_configuration fails with open_failed == true, load_state will +jump to the out label without config being initialized and pass this +uninitialized config value to snd_config_delete. This commit fixes this +issue by initializing config with NULL and checking if it is non-null +before invoking snd_config_delete. + +Fixes: https://github.com/alsa-project/alsa-utils/pull/94 +Fixes: f138117 ("alsactl: load_state() - initialize config variable for the open_failed case") +BugLink: https://github.com/alsa-project/alsa-utils/issues/93 +Signed-off-by: Sören Tempel +Signed-off-by: Jaroslav Kysela +--- + alsactl/state.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/alsactl/state.c b/alsactl/state.c +index 439e1f8..adbd13f 100644 +--- a/alsactl/state.c ++++ b/alsactl/state.c +@@ -1692,7 +1692,8 @@ int load_state(const char *cfgdir, const char *file, + } + err = finalerr ? finalerr : snd_card_iterator_error(&iter); + out: +- snd_config_delete(config); ++ if (config) ++ snd_config_delete(config); + snd_config_update_free_global(); + return err; + } +-- +2.30.2 + + +From 6a0d13ddb2b2afb450f3404d3cbaa56253bdcab2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Andreas=20M=C3=BCller?= +Date: Thu, 3 Jun 2021 16:07:10 +0200 +Subject: [PATCH 12/16] utils.c: Include limits.h explicitly to fix build on + musl +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Fixes: +| ../../alsa-utils-1.2.5/alsactl/utils.c: In function 'snd_card_clean_cfgdir': +| ../../alsa-utils-1.2.5/alsactl/utils.c:309:19: error: 'PATH_MAX' undeclared (first use in this function) +| 309 | char path[PATH_MAX]; +| | ^~~~~~~~ +| ../../alsa-utils-1.2.5/alsactl/utils.c:309:19: note: each undeclared identifier is reported only once for each function it appears in + +Fixes: https://github.com/alsa-project/alsa-utils/pull/92 +Signed-off-by: Andreas Müller +Signed-off-by: Jaroslav Kysela +--- + alsactl/utils.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/alsactl/utils.c b/alsactl/utils.c +index fd4a108..a507972 100644 +--- a/alsactl/utils.c ++++ b/alsactl/utils.c +@@ -30,6 +30,7 @@ + #include + #include + #include ++#include + #include "alsactl.h" + + int file_map(const char *filename, char **buf, size_t *bufsize) +-- +2.30.2 -We added the check of asound.state file presence some time ago to -assure that alsactl gets called only if the state file is already -present. Since then, the situation has changed significantly: -e.g. now alsactl does initialize if the state file isn't present, and -the same alsa-restore.service is used to save the state. This means -that we should start this service no matter the state file exists at -the boot time or not. So, revert the old change again. -Signed-off-by: Takashi Iwai +From 0e21f4d8643db547dcca1375a4265fce1edc4d51 Mon Sep 17 00:00:00 2001 +From: Andrea Piras +Date: Fri, 29 Nov 2019 03:13:21 +0100 +Subject: [PATCH 13/16] added an option to aseqnet to optionally set the midi + process name + +This option allows to run multiple instances of aseqnet without having +to double check the assigned port number, since each one can get spawned +with a unique name. + +Fixes: https://github.com/alsa-project/alsa-utils/pull/95 +Signed-off-by: Andrea Piras +Signed-off-by: Jaroslav Kysela --- - alsactl/alsa-restore.service.in | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/alsactl/alsa-restore.service.in b/alsactl/alsa-restore.service.in -index a84c2e8..80fd5fd 100644 ---- a/alsactl/alsa-restore.service.in -+++ b/alsactl/alsa-restore.service.in -@@ -7,7 +7,6 @@ - Description=Save/Restore Sound Card State - ConditionPathExists=!@daemonswitch@ - ConditionPathExistsGlob=/dev/snd/control* --ConditionPathExists=@asoundrcfile@ - - [Service] - Type=oneshot + seq/aseqnet/README.aseqnet | 2 ++ + seq/aseqnet/aseqnet.1 | 3 +++ + seq/aseqnet/aseqnet.c | 26 ++++++++++++++++++-------- + 3 files changed, 23 insertions(+), 8 deletions(-) + +diff --git a/seq/aseqnet/README.aseqnet b/seq/aseqnet/README.aseqnet +index bd0b68e..6a627f4 100644 +--- a/seq/aseqnet/README.aseqnet ++++ b/seq/aseqnet/README.aseqnet +@@ -50,4 +50,6 @@ The available options are: + -s addr : explicit read-subscription to the given address + (client:addr). + -d addr : explicit write-subscription to the given address. ++ -n name : specify the midi name of the process. ++ Default value is either 'Net Client' or 'Net Server'. + -v : verbose mode. +diff --git a/seq/aseqnet/aseqnet.1 b/seq/aseqnet/aseqnet.1 +index 2cb6eb7..6ed3911 100644 +--- a/seq/aseqnet/aseqnet.1 ++++ b/seq/aseqnet/aseqnet.1 +@@ -70,6 +70,9 @@ Subscribe to the given address for read automatically. + .B \-d addr + Subscribe to the given address for write automatically. + .TP ++.B \-n name ++Specify the midi name of the process. ++.TP + .B \-v + Verbose mode. + +diff --git a/seq/aseqnet/aseqnet.c b/seq/aseqnet/aseqnet.c +index ebdea0b..e756e82 100644 +--- a/seq/aseqnet/aseqnet.c ++++ b/seq/aseqnet/aseqnet.c +@@ -37,7 +37,7 @@ static void usage(void); + static void init_buf(void); + static void init_pollfds(void); + static void close_files(void); +-static void init_seq(char *source, char *dest); ++static void init_seq(char *source, char *dest, char *name); + static int get_port(char *service); + static void sigterm_exit(int sig); + static void init_server(int port); +@@ -87,6 +87,7 @@ static const struct option long_option[] = { + {"port", 1, NULL, 'p'}, + {"source", 1, NULL, 's'}, + {"dest", 1, NULL, 'd'}, ++ {"name", 1, NULL, 'n'}, + {"help", 0, NULL, 'h'}, + {"verbose", 0, NULL, 'v'}, + {"info", 0, NULL, 'i'}, +@@ -98,13 +99,14 @@ int main(int argc, char **argv) + int c; + int port = DEFAULT_PORT; + char *source = NULL, *dest = NULL; ++ char *name = NULL; + + #ifdef ENABLE_NLS + setlocale(LC_ALL, ""); + textdomain(PACKAGE); + #endif + +- while ((c = getopt_long(argc, argv, "p:s:d:vi", long_option, NULL)) != -1) { ++ while ((c = getopt_long(argc, argv, "p:s:d:n:,vi", long_option, NULL)) != -1) { + switch (c) { + case 'p': + if (isdigit(*optarg)) +@@ -118,6 +120,9 @@ int main(int argc, char **argv) + case 'd': + dest = optarg; + break; ++ case 'n': ++ name = optarg; ++ break; + case 'v': + verbose++; + break; +@@ -134,7 +139,7 @@ int main(int argc, char **argv) + signal(SIGTERM, sigterm_exit); + + init_buf(); +- init_seq(source, dest); ++ init_seq(source, dest, name); + + if (optind >= argc) { + server_mode = 1; +@@ -170,6 +175,7 @@ static void usage(void) + printf(_(" -p,--port # : specify TCP port (digit or service name)\n")); + printf(_(" -s,--source addr : read from given addr (client:port)\n")); + printf(_(" -d,--dest addr : write to given addr (client:port)\n")); ++ printf(_(" -n,--name value : use a specific midi process name\n")); + printf(_(" -v, --verbose : print verbose messages\n")); + printf(_(" -i, --info : print certain received events\n")); + } +@@ -223,7 +229,7 @@ static void close_files(void) + /* + * initialize sequencer + */ +-static void init_seq(char *source, char *dest) ++static void init_seq(char *source, char *dest, char* name) + { + snd_seq_addr_t addr; + int err, counti, counto; +@@ -252,10 +258,14 @@ static void init_seq(char *source, char *dest) + snd_seq_nonblock(handle, 1); + + /* set client info */ +- if (server_mode) +- snd_seq_set_client_name(handle, "Net Server"); +- else +- snd_seq_set_client_name(handle, "Net Client"); ++ if (name) ++ snd_seq_set_client_name(handle, name); ++ else { ++ if (server_mode) ++ snd_seq_set_client_name(handle, "Net Server"); ++ else ++ snd_seq_set_client_name(handle, "Net Client"); ++ } + + /* create a port */ + seq_port = snd_seq_create_simple_port(handle, "Network", -- -2.29.2 +2.30.2 -From 76bc37aeb77d51f995e223582d25335cd98b2eea Mon Sep 17 00:00:00 2001 +From f35b66d8f1c5e3c551981723ed242e48c62ad97f Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela -Date: Sun, 3 Jan 2021 17:19:03 +0100 -Subject: [PATCH 13/14] aplay: add test code for snd_pcm_status() to - --test-position +Date: Mon, 14 Jun 2021 12:02:35 +0200 +Subject: [PATCH 14/16] Revert "aplay: try to use 16-bit format to increase + capture quality" -We need to test also snd_pcm_status() values. +This reverts commit 0c5948e98a6a8535c89b7bcab13017d7732181c6. +Link: https://github.com/alsa-project/alsa-utils/issues/96 Signed-off-by: Jaroslav Kysela --- - aplay/aplay.c | 48 ++++++++++++++++++++++++++++++++++++++---------- - 1 file changed, 38 insertions(+), 10 deletions(-) + aplay/aplay.c | 43 +++++++++---------------------------------- + 1 file changed, 9 insertions(+), 34 deletions(-) diff --git a/aplay/aplay.c b/aplay/aplay.c -index d385da2..5a6d5c3 100644 +index 0b7884e..d89b7df 100644 --- a/aplay/aplay.c +++ b/aplay/aplay.c -@@ -1953,22 +1953,38 @@ static void do_test_position(void) - static snd_pcm_sframes_t minavail, mindelay; - static snd_pcm_sframes_t badavail = 0, baddelay = 0; - snd_pcm_sframes_t outofrange; -- snd_pcm_sframes_t avail, delay; -+ snd_pcm_sframes_t avail, delay, savail, sdelay; -+ snd_pcm_status_t *status; - int err; - -+ snd_pcm_status_alloca(&status); - err = snd_pcm_avail_delay(handle, &avail, &delay); - if (err < 0) - return; -+ err = snd_pcm_status(handle, status); -+ if (err < 0) -+ return; -+ savail = snd_pcm_status_get_avail(status); -+ sdelay = snd_pcm_status_get_delay(status); - outofrange = (test_coef * (snd_pcm_sframes_t)buffer_frames) / 2; - if (avail > outofrange || avail < -outofrange || - delay > outofrange || delay < -outofrange) { -- badavail = avail; baddelay = delay; -- availsum = delaysum = samples = 0; -- maxavail = maxdelay = 0; -- minavail = mindelay = buffer_frames * 16; -- fprintf(stderr, _("Suspicious buffer position (%li total): " -- "avail = %li, delay = %li, buffer = %li\n"), -- ++counter, (long)avail, (long)delay, (long)buffer_frames); -+ badavail = avail; baddelay = delay; -+ availsum = delaysum = samples = 0; -+ maxavail = maxdelay = 0; -+ minavail = mindelay = buffer_frames * 16; -+ fprintf(stderr, _("Suspicious buffer position (%li total): " -+ "avail = %li, delay = %li, buffer = %li\n"), -+ ++counter, (long)avail, (long)delay, (long)buffer_frames); -+ } else if (savail > outofrange || savail < -outofrange || -+ sdelay > outofrange || sdelay < -outofrange) { -+ badavail = savail; baddelay = sdelay; -+ availsum = delaysum = samples = 0; -+ maxavail = maxdelay = 0; -+ minavail = mindelay = buffer_frames * 16; -+ fprintf(stderr, _("Suspicious status buffer position (%li total): " -+ "avail = %li, delay = %li, buffer = %li\n"), -+ ++counter, (long)savail, (long)sdelay, (long)buffer_frames); - } else if (verbose) { - time(&now); - if (tmr == (time_t) -1) { -@@ -1979,19 +1995,27 @@ static void do_test_position(void) - } - if (avail > maxavail) - maxavail = avail; -+ if (savail > maxavail) -+ maxavail = savail; - if (delay > maxdelay) - maxdelay = delay; -+ if (sdelay > maxdelay) -+ maxdelay = sdelay; - if (avail < minavail) - minavail = avail; -+ if (savail < minavail) -+ minavail = savail; - if (delay < mindelay) - mindelay = delay; -+ if (sdelay < mindelay) -+ mindelay = sdelay; - availsum += avail; - delaysum += delay; - samples++; -- if (avail != 0 && now != tmr) { -+ if ((maxavail != 0 || maxdelay != 0) && now != tmr) { - fprintf(stderr, "BUFPOS: avg%li/%li " - "min%li/%li max%li/%li (%li) (%li:%li/%li)\n", -- (long)(availsum / samples), -+ (long)(availsum / samples), - (long)(delaysum / samples), - (long)minavail, (long)mindelay, - (long)maxavail, (long)maxdelay, -@@ -2000,6 +2024,10 @@ static void do_test_position(void) - tmr = now; +@@ -32,7 +32,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -95,7 +94,6 @@ enum { + VUMETER_STEREO + }; + +-static snd_pcm_format_t default_format = DEFAULT_FORMAT; + static char *command; + static snd_pcm_t *handle; + static struct { +@@ -470,24 +468,6 @@ static long parse_long(const char *str, int *err) + return val; + } + +-static void try_to_adjust_default_format_16bit(void) +-{ +- snd_pcm_hw_params_t *params; +- int err; +- +- snd_pcm_hw_params_alloca(¶ms); +- err = snd_pcm_hw_params_any(handle, params); +- if (err < 0) { +- error(_("Broken configuration for this PCM: no configurations available")); +- prg_exit(EXIT_FAILURE); +- } +- +- if (file_type != FORMAT_AU && snd_pcm_hw_params_test_format(handle, params, SND_PCM_FORMAT_S16_LE) == 0) +- rhwparams.format = default_format = SND_PCM_FORMAT_S16_LE; +- else if (file_type == FORMAT_AU && snd_pcm_hw_params_test_format(handle, params, SND_PCM_FORMAT_S16_BE) == 0) +- rhwparams.format = default_format = SND_PCM_FORMAT_S16_BE; +-} +- + int main(int argc, char *argv[]) + { + int duration_or_sample = 0; +@@ -548,7 +528,6 @@ int main(int argc, char *argv[]) + int do_device_list = 0, do_pcm_list = 0; + snd_pcm_info_t *info; + FILE *direction; +- bool user_set_fmt = false; + + #ifdef ENABLE_NLS + setlocale(LC_ALL, ""); +@@ -583,7 +562,7 @@ int main(int argc, char *argv[]) + } + + chunk_size = -1; +- rhwparams.format = default_format; ++ rhwparams.format = DEFAULT_FORMAT; + rhwparams.rate = DEFAULT_SPEED; + rhwparams.channels = 1; + +@@ -633,7 +612,6 @@ int main(int argc, char *argv[]) + } + break; + case 'f': +- user_set_fmt = true; + if (strcasecmp(optarg, "cd") == 0 || strcasecmp(optarg, "cdr") == 0) { + if (strcasecmp(optarg, "cdr") == 0) + rhwparams.format = SND_PCM_FORMAT_S16_BE; +@@ -866,9 +844,6 @@ int main(int argc, char *argv[]) } } -+ if (verbose == 1) { -+ fprintf(stderr, _("Status(R/W) (standalone avail=%li delay=%li):\n"), (long)avail, (long)delay); -+ snd_pcm_status_dump(status, log); -+ } - } - /* +- if (!user_set_fmt) +- try_to_adjust_default_format_16bit(); +- + chunk_size = 1024; + hwparams = rhwparams; + +@@ -1089,7 +1064,7 @@ static ssize_t test_wavefile(int fd, u_char *_buffer, size_t size) + hwparams.channels = channels; + switch (TO_CPU_SHORT(f->bit_p_spl, big_endian)) { + case 8: +- if (hwparams.format != default_format && ++ if (hwparams.format != DEFAULT_FORMAT && + hwparams.format != SND_PCM_FORMAT_U8) + fprintf(stderr, _("Warning: format is changed to U8\n")); + hwparams.format = SND_PCM_FORMAT_U8; +@@ -1099,7 +1074,7 @@ static ssize_t test_wavefile(int fd, u_char *_buffer, size_t size) + native_format = SND_PCM_FORMAT_S16_BE; + else + native_format = SND_PCM_FORMAT_S16_LE; +- if (hwparams.format != default_format && ++ if (hwparams.format != DEFAULT_FORMAT && + hwparams.format != native_format) + fprintf(stderr, _("Warning: format is changed to %s\n"), + snd_pcm_format_name(native_format)); +@@ -1112,7 +1087,7 @@ static ssize_t test_wavefile(int fd, u_char *_buffer, size_t size) + native_format = SND_PCM_FORMAT_S24_3BE; + else + native_format = SND_PCM_FORMAT_S24_3LE; +- if (hwparams.format != default_format && ++ if (hwparams.format != DEFAULT_FORMAT && + hwparams.format != native_format) + fprintf(stderr, _("Warning: format is changed to %s\n"), + snd_pcm_format_name(native_format)); +@@ -1123,7 +1098,7 @@ static ssize_t test_wavefile(int fd, u_char *_buffer, size_t size) + native_format = SND_PCM_FORMAT_S24_BE; + else + native_format = SND_PCM_FORMAT_S24_LE; +- if (hwparams.format != default_format && ++ if (hwparams.format != DEFAULT_FORMAT && + hwparams.format != native_format) + fprintf(stderr, _("Warning: format is changed to %s\n"), + snd_pcm_format_name(native_format)); +@@ -1209,19 +1184,19 @@ static int test_au(int fd, void *buffer) + pbrec_count = BE_INT(ap->data_size); + switch (BE_INT(ap->encoding)) { + case AU_FMT_ULAW: +- if (hwparams.format != default_format && ++ if (hwparams.format != DEFAULT_FORMAT && + hwparams.format != SND_PCM_FORMAT_MU_LAW) + fprintf(stderr, _("Warning: format is changed to MU_LAW\n")); + hwparams.format = SND_PCM_FORMAT_MU_LAW; + break; + case AU_FMT_LIN8: +- if (hwparams.format != default_format && ++ if (hwparams.format != DEFAULT_FORMAT && + hwparams.format != SND_PCM_FORMAT_U8) + fprintf(stderr, _("Warning: format is changed to U8\n")); + hwparams.format = SND_PCM_FORMAT_U8; + break; + case AU_FMT_LIN16: +- if (hwparams.format != default_format && ++ if (hwparams.format != DEFAULT_FORMAT && + hwparams.format != SND_PCM_FORMAT_S16_BE) + fprintf(stderr, _("Warning: format is changed to S16_BE\n")); + hwparams.format = SND_PCM_FORMAT_S16_BE; +@@ -2390,7 +2365,7 @@ static void voc_play(int fd, int ofs, char *name) + prg_exit(EXIT_FAILURE); + } + } +- hwparams.format = default_format; ++ hwparams.format = DEFAULT_FORMAT; + hwparams.channels = 1; + hwparams.rate = DEFAULT_SPEED; + set_params(); -- -2.29.2 +2.30.2 -From 3980fe71c9795271639239ad8fa982a59de8ff1f Mon Sep 17 00:00:00 2001 +From fc7500c3c7a7d6bfb975a87e23b7544a84da3186 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela -Date: Mon, 4 Jan 2021 12:13:03 +0100 -Subject: [PATCH 14/14] aplay: add avail > delay checks to --test-position +Date: Mon, 14 Jun 2021 12:22:08 +0200 +Subject: [PATCH 15/16] arecord: Inform users when 8-bit sampling is used on + tty +When we reverted 0c5948e ("aplay: try to use 16-bit format to +increase capture quality"), we should also handle the original +problem somehow. This code shows a warning with a hint to +the right parameter. + +Fixes: https://github.com/alsa-project/alsa-utils/issues/96 Signed-off-by: Jaroslav Kysela --- - aplay/aplay.c | 8 ++++++++ - 1 file changed, 8 insertions(+) + aplay/aplay.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/aplay/aplay.c b/aplay/aplay.c -index 5a6d5c3..b75be6c 100644 +index d89b7df..cc51dcb 100644 --- a/aplay/aplay.c +++ b/aplay/aplay.c -@@ -1985,6 +1985,14 @@ static void do_test_position(void) - fprintf(stderr, _("Suspicious status buffer position (%li total): " - "avail = %li, delay = %li, buffer = %li\n"), - ++counter, (long)savail, (long)sdelay, (long)buffer_frames); -+ } else if (avail > delay) { -+ fprintf(stderr, _("Suspicious buffer position avail > delay (%li total): " -+ "avail = %li, delay = %li\n"), -+ ++counter, (long)avail, (long)delay); -+ } else if (savail > sdelay) { -+ fprintf(stderr, _("Suspicious status buffer position avail > delay (%li total): " -+ "avail = %li, delay = %li\n"), -+ ++counter, (long)savail, (long)sdelay); - } else if (verbose) { - time(&now); - if (tmr == (time_t) -1) { +@@ -525,7 +525,7 @@ int main(int argc, char *argv[]) + }; + char *pcm_name = "default"; + int tmp, err, c; +- int do_device_list = 0, do_pcm_list = 0; ++ int do_device_list = 0, do_pcm_list = 0, force_sample_format = 0; + snd_pcm_info_t *info; + FILE *direction; + +@@ -612,6 +612,7 @@ int main(int argc, char *argv[]) + } + break; + case 'f': ++ force_sample_format = 1; + if (strcasecmp(optarg, "cd") == 0 || strcasecmp(optarg, "cdr") == 0) { + if (strcasecmp(optarg, "cdr") == 0) + rhwparams.format = SND_PCM_FORMAT_S16_BE; +@@ -844,6 +845,14 @@ int main(int argc, char *argv[]) + } + } + ++ if (!force_sample_format && ++ isatty(fileno(stdin)) && ++ stream == SND_PCM_STREAM_CAPTURE && ++ snd_pcm_format_width(rhwparams.format) <= 8) ++ fprintf(stderr, "Warning: Some sources (like microphones) may produce inaudiable results\n" ++ " with 8-bit sampling. Use '-f' argument to increase resolution\n" ++ " e.g. '-f S16_LE'.\n"); ++ + chunk_size = 1024; + hwparams = rhwparams; + -- -2.29.2 +2.30.2 + diff --git a/SPECS/alsa-utils.spec b/SPECS/alsa-utils.spec index 7ce6b02..f6bb520 100644 --- a/SPECS/alsa-utils.spec +++ b/SPECS/alsa-utils.spec @@ -1,11 +1,11 @@ -%define baseversion 1.2.4 +%define baseversion 1.2.5 #define fixversion .2 %global _hardened_build 1 Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2+ Group: Applications/Multimedia URL: http://www.alsa-project.org/ @@ -192,6 +192,9 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Mon Jun 14 2021 Jaroslav Kysela - 1.2.5-3 +- Updated to 1.2.5 + * Mon Jun 8 2020 Jaroslav Kysela - 1.2.4-2 - Updated to 1.2.4 - Apply fixes from recent upstream