From bdf0a124898bfdfee9e2563456e30e6e0f32a272 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Sun, 9 Feb 2020 21:04:12 +0100 Subject: [PATCH 01/58] ucm and topology fixes Signed-off-by: Jaroslav Kysela --- alsa-git.patch | 3552 +++++++++++++++++++++++++++++++++++++++++++++++ alsa-utils.spec | 7 +- 2 files changed, 3557 insertions(+), 2 deletions(-) diff --git a/alsa-git.patch b/alsa-git.patch index 8b13789..ddfa20e 100644 --- a/alsa-git.patch +++ b/alsa-git.patch @@ -1 +1,3553 @@ +From 5e6df5ae4ba587ba324dd97b7bd8af9f8159f59a Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Tue, 19 Nov 2019 20:28:53 -0800 +Subject: [PATCH 01/31] treewide: sys/poll to poll + +Fixes warning on musl: + +warning redirecting incorrect #include to + +Signed-off-by: Rosen Penev +Signed-off-by: Takashi Iwai +--- + amidi/amidi.c | 2 +- + amixer/amixer.c | 2 +- + aplay/aplay.c | 2 +- + seq/aplaymidi/arecordmidi.c | 2 +- + seq/aseqdump/aseqdump.c | 2 +- + 5 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/amidi/amidi.c b/amidi/amidi.c +index b6e05e1..c6268e4 100644 +--- a/amidi/amidi.c ++++ b/amidi/amidi.c +@@ -31,7 +31,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + #include +diff --git a/amixer/amixer.c b/amixer/amixer.c +index ad9c482..f7f31f0 100644 +--- a/amixer/amixer.c ++++ b/amixer/amixer.c +@@ -28,7 +28,7 @@ + #include + #include + #include +-#include ++#include + #include + #include "amixer.h" + #include "../alsamixer/volume_mapping.h" +diff --git a/aplay/aplay.c b/aplay/aplay.c +index 274bbce..5241068 100644 +--- a/aplay/aplay.c ++++ b/aplay/aplay.c +@@ -44,7 +44,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + #include +diff --git a/seq/aplaymidi/arecordmidi.c b/seq/aplaymidi/arecordmidi.c +index f3db65e..604cd0d 100644 +--- a/seq/aplaymidi/arecordmidi.c ++++ b/seq/aplaymidi/arecordmidi.c +@@ -27,7 +27,7 @@ + #include + #include + #include +-#include ++#include + #include + #include "aconfig.h" + #include "version.h" +diff --git a/seq/aseqdump/aseqdump.c b/seq/aseqdump/aseqdump.c +index 7904540..578e06f 100644 +--- a/seq/aseqdump/aseqdump.c ++++ b/seq/aseqdump/aseqdump.c +@@ -25,7 +25,7 @@ + #include + #include + #include +-#include ++#include + #include + #include "aconfig.h" + #include "version.h" +-- +2.24.1 + + +From 66e9a816093c7d8fbdfbc407062daabe89825b35 Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Tue, 19 Nov 2019 20:28:54 -0800 +Subject: [PATCH 02/31] treewide: Fix wrong formats on 32-bit + +uint64_t evaluates to unsigned long long on 32-bit, not unsigned long. +Use the proper formats. + +Signed-off-by: Rosen Penev +Signed-off-by: Takashi Iwai +--- + axfer/container.c | 7 ++++--- + axfer/subcmd-transfer.c | 4 +++- + 2 files changed, 7 insertions(+), 4 deletions(-) + +diff --git a/axfer/container.c b/axfer/container.c +index 7da97c6..566acd0 100644 +--- a/axfer/container.c ++++ b/axfer/container.c +@@ -13,6 +13,7 @@ + #include + #include + #include ++#include + + static const char *const cntr_type_labels[] = { + [CONTAINER_TYPE_PARSER] = "parser", +@@ -356,10 +357,10 @@ int container_context_pre_process(struct container_context *cntr, + fprintf(stderr, " frames/second: %u\n", + cntr->frames_per_second); + if (cntr->type == CONTAINER_TYPE_PARSER) { +- fprintf(stderr, " frames: %lu\n", ++ fprintf(stderr, " frames: %" PRIu64 "\n", + *frame_count); + } else { +- fprintf(stderr, " max frames: %lu\n", ++ fprintf(stderr, " max frames: %" PRIu64 "\n", + *frame_count); + } + } +@@ -427,7 +428,7 @@ int container_context_post_process(struct container_context *cntr, + assert(frame_count); + + if (cntr->verbose && cntr->handled_byte_count > 0) { +- fprintf(stderr, " Handled bytes: %lu\n", ++ fprintf(stderr, " Handled bytes: %" PRIu64 "\n", + cntr->handled_byte_count); + } + +diff --git a/axfer/subcmd-transfer.c b/axfer/subcmd-transfer.c +index 3ca745a..8746e6f 100644 +--- a/axfer/subcmd-transfer.c ++++ b/axfer/subcmd-transfer.c +@@ -11,6 +11,7 @@ + #include "misc.h" + + #include ++#include + + struct context { + struct xfer_context xfer; +@@ -389,7 +390,8 @@ static int context_process_frames(struct context *ctx, + + if (!ctx->xfer.quiet) { + fprintf(stderr, +- "%s: Expected %lu frames, Actual %lu frames\n", ++ "%s: Expected %" PRIu64 "frames, " ++ "Actual %" PRIu64 "frames\n", + snd_pcm_stream_name(direction), expected_frame_count, + *actual_frame_count); + if (ctx->interrupted) { +-- +2.24.1 + + +From 80fd81f4a8647fe2b62a02db9a497d2a7639d9e3 Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Tue, 19 Nov 2019 20:28:55 -0800 +Subject: [PATCH 03/31] treewide: Fix printf formats + +Found with cppcheck + +Signed-off-by: Rosen Penev +Signed-off-by: Takashi Iwai +--- + alsactl/init_parse.c | 4 ++-- + alsaloop/pcmjob.c | 10 +++++----- + amixer/amixer.c | 6 +++--- + aplay/aplay.c | 2 +- + axfer/subcmd-list.c | 2 +- + axfer/xfer-libffado.c | 2 +- + axfer/xfer-options.c | 2 +- + 7 files changed, 14 insertions(+), 14 deletions(-) + +diff --git a/alsactl/init_parse.c b/alsactl/init_parse.c +index 562e674..c048fd3 100644 +--- a/alsactl/init_parse.c ++++ b/alsactl/init_parse.c +@@ -187,7 +187,7 @@ static int init_space(struct space **space, int card) + return -ENOMEM; + res->ctl_id_changed = ~0; + res->linenum = -1; +- sprintf(device, "hw:%u", card); ++ sprintf(device, "hw:%d", card); + err = snd_hctl_open(&res->ctl_handle, device, 0); + if (err < 0) + goto error; +@@ -734,7 +734,7 @@ dbvalue: + elem = snd_hctl_elem_next(elem); + } + snd_ctl_elem_id_free(id); +- sprintf(res, "%u", index); ++ sprintf(res, "%d", index); + dbg("do_ctl_count found %s controls", res); + return res; + } +diff --git a/alsaloop/pcmjob.c b/alsaloop/pcmjob.c +index 29d1aba..b252486 100644 +--- a/alsaloop/pcmjob.c ++++ b/alsaloop/pcmjob.c +@@ -120,7 +120,7 @@ static int setparams_stream(struct loopback_handle *lhandle, + } + err = snd_pcm_hw_params_set_rate_resample(handle, params, lhandle->resample); + if (err < 0) { +- logit(LOG_CRIT, "Resample setup failed for %s (val %i): %s\n", lhandle->id, lhandle->resample, snd_strerror(err)); ++ logit(LOG_CRIT, "Resample setup failed for %s (val %u): %s\n", lhandle->id, lhandle->resample, snd_strerror(err)); + return err; + } + err = snd_pcm_hw_params_set_access(handle, params, lhandle->access); +@@ -135,13 +135,13 @@ static int setparams_stream(struct loopback_handle *lhandle, + } + err = snd_pcm_hw_params_set_channels(handle, params, lhandle->channels); + if (err < 0) { +- logit(LOG_CRIT, "Channels count (%i) not available for %s: %s\n", lhandle->channels, lhandle->id, snd_strerror(err)); ++ logit(LOG_CRIT, "Channels count (%u) not available for %s: %s\n", lhandle->channels, lhandle->id, snd_strerror(err)); + return err; + } + rrate = lhandle->rate_req; + err = snd_pcm_hw_params_set_rate_near(handle, params, &rrate, 0); + if (err < 0) { +- logit(LOG_CRIT, "Rate %iHz not available for %s: %s\n", lhandle->rate_req, lhandle->id, snd_strerror(err)); ++ logit(LOG_CRIT, "Rate %uHz not available for %s: %s\n", lhandle->rate_req, lhandle->id, snd_strerror(err)); + return err; + } + rrate = 0; +@@ -152,7 +152,7 @@ static int setparams_stream(struct loopback_handle *lhandle, + !lhandle->loopback->src_enable && + #endif + (int)rrate != lhandle->rate) { +- logit(LOG_CRIT, "Rate does not match (requested %iHz, got %iHz, resample %i)\n", lhandle->rate, rrate, lhandle->resample); ++ logit(LOG_CRIT, "Rate does not match (requested %uHz, got %uHz, resample %u)\n", lhandle->rate, rrate, lhandle->resample); + return -EINVAL; + } + lhandle->pitch = (double)lhandle->rate_req / (double)lhandle->rate; +@@ -1613,7 +1613,7 @@ __again: + if (count > loop->play->buffer_size) + count = loop->play->buffer_size; + if (err != count) { +- logit(LOG_CRIT, "%s: initial playback fill error (%i/%i/%i)\n", loop->id, err, (int)count, loop->play->buffer_size); ++ logit(LOG_CRIT, "%s: initial playback fill error (%i/%i/%u)\n", loop->id, err, (int)count, loop->play->buffer_size); + err = -EIO; + goto __error; + } +diff --git a/amixer/amixer.c b/amixer/amixer.c +index f7f31f0..928f7c5 100644 +--- a/amixer/amixer.c ++++ b/amixer/amixer.c +@@ -465,7 +465,7 @@ static void decode_tlv(unsigned int spaces, unsigned int *tlv, unsigned int tlv_ + size = tlv[idx++]; + tlv_size -= 2 * sizeof(unsigned int); + if (size > tlv_size) { +- printf("TLV size error (%i, %i, %i)!\n", type, size, tlv_size); ++ printf("TLV size error (%u, %u, %u)!\n", type, size, tlv_size); + return; + } + switch (type) { +@@ -576,7 +576,7 @@ static void decode_tlv(unsigned int spaces, unsigned int *tlv, unsigned int tlv_ + break; + #endif + default: +- printf("unk-%i-", type); ++ printf("unk-%u-", type); + while (size > 0) { + printf("0x%08x,", tlv[idx++]); + size -= sizeof(unsigned int); +@@ -611,7 +611,7 @@ static int show_control(const char *space, snd_hctl_elem_t *elem, + } + count = snd_ctl_elem_info_get_count(info); + type = snd_ctl_elem_info_get_type(info); +- printf("%s; type=%s,access=%s,values=%i", space, control_type(info), control_access(info), count); ++ printf("%s; type=%s,access=%s,values=%u", space, control_type(info), control_access(info), count); + switch (type) { + case SND_CTL_ELEM_TYPE_INTEGER: + printf(",min=%li,max=%li,step=%li\n", +diff --git a/aplay/aplay.c b/aplay/aplay.c +index 5241068..72fa567 100644 +--- a/aplay/aplay.c ++++ b/aplay/aplay.c +@@ -3346,7 +3346,7 @@ static void playbackv(char **names, unsigned int count) + } + alloced = 1; + } else if (count != channels) { +- error(_("You need to specify %d files"), channels); ++ error(_("You need to specify %u files"), channels); + prg_exit(EXIT_FAILURE); + } + +diff --git a/axfer/subcmd-list.c b/axfer/subcmd-list.c +index e22628c..359f73f 100644 +--- a/axfer/subcmd-list.c ++++ b/axfer/subcmd-list.c +@@ -31,7 +31,7 @@ static int dump_device(snd_ctl_t *handle, const char *id, const char *name, + snd_pcm_info_get_name(info)); + + count = snd_pcm_info_get_subdevices_count(info); +- printf(" Subdevices: %i/%i\n", ++ printf(" Subdevices: %i/%u\n", + snd_pcm_info_get_subdevices_avail(info), count); + + for (i = 0; i < count; ++i) { +diff --git a/axfer/xfer-libffado.c b/axfer/xfer-libffado.c +index a37cce6..6db835d 100644 +--- a/axfer/xfer-libffado.c ++++ b/axfer/xfer-libffado.c +@@ -440,7 +440,7 @@ static int xfer_libffado_pre_process(struct xfer_context *xfer, + } + if (*samples_per_frame != channels) { + fprintf(stderr, +- "The number of samples per frame should be %i.\n", ++ "The number of samples per frame should be %u.\n", + channels); + return -EINVAL; + } +diff --git a/axfer/xfer-options.c b/axfer/xfer-options.c +index 352d126..3740b16 100644 +--- a/axfer/xfer-options.c ++++ b/axfer/xfer-options.c +@@ -238,7 +238,7 @@ static int validate_options(struct xfer_context *xfer) + xfer->frames_per_second *= 1000; + if (xfer->frames_per_second < 2000 || + xfer->frames_per_second > 192000) { +- fprintf(stderr, "bad speed value '%i'\n", val); ++ fprintf(stderr, "bad speed value '%u'\n", val); + return -EINVAL; + } + +-- +2.24.1 + + +From ac82b651676303e0689b1c23ad72aaf7b264ce5f Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Wed, 20 Nov 2019 10:19:20 -0800 +Subject: [PATCH 04/31] aplay: Adjust buffer sizes to fix snprintf warnings + +It also reduces compiled size slightly. + +aplay.c: In function 'capture': +aplay.c:3055:34: error: '-01' directive output may be truncated writing 3 +bytes into a region of size between 1 and 4097 [-Werror=format-truncation= +] + 3055 | snprintf(namebuf, namelen, "%s-01", buf); + | ^~~ +aplay.c:3055:4: note: 'snprintf' output between 4 and 4100 bytes into a +destination of size 4097 + 3055 | snprintf(namebuf, namelen, "%s-01", buf); + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +aplay.c:3053:34: error: '-01.' directive output may be truncated writing 4 +bytes into a region of size between 1 and 4097 [-Werror=format-truncation= +] + 3053 | snprintf(namebuf, namelen, "%s-01.%s", buf, s); + | ^~~~ +aplay.c:3053:4: note: 'snprintf' output 5 or more bytes (assuming 4101) +into a destination of size 4097 + 3053 | snprintf(namebuf, namelen, "%s-01.%s", buf, s); + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +aplay.c:3065:34: error: '%02i' directive output may be truncated writing +between 2 and 10 bytes into a region of size between 0 and 4096 [-Werror= +format-truncation=] + 3065 | snprintf(namebuf, namelen, "%s-%02i", buf, filecount); + | ^~~~ +aplay.c:3065:30: note: directive argument in the range [1, 2147483647] + 3065 | snprintf(namebuf, namelen, "%s-%02i", buf, filecount); + | ^~~~~~~~~ +aplay.c:3065:3: note: 'snprintf' output between 4 and 4108 bytes into a +destination of size 4097 + 3065 | snprintf(namebuf, namelen, "%s-%02i", buf, filecount); + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +aplay.c:3063:34: error: '%02i' directive output may be truncated writing +between 2 and 10 bytes into a region of size between 0 and 4096 [-Werror= +format-truncation=] + 3063 | snprintf(namebuf, namelen, "%s-%02i.%s", buf, filecount, s); + | ^~~~ +aplay.c:3063:30: note: directive argument in the range [1, 2147483647] + 3063 | snprintf(namebuf, namelen, "%s-%02i.%s", buf, filecount, s); + | ^~~~~~~~~~~~ +aplay.c:3063:3: note: 'snprintf' output 5 or more bytes (assuming 4109) +into a destination of size 4097 + 3063 | snprintf(namebuf, namelen, "%s-%02i.%s", buf, filecount, s); + +Signed-off-by: Rosen Penev +Signed-off-by: Takashi Iwai +--- + aplay/aplay.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/aplay/aplay.c b/aplay/aplay.c +index 72fa567..78adee2 100644 +--- a/aplay/aplay.c ++++ b/aplay/aplay.c +@@ -3015,7 +3015,7 @@ static int new_capture_file(char *name, char *namebuf, size_t namelen, + int filecount) + { + char *s; +- char buf[PATH_MAX+1]; ++ char buf[PATH_MAX-10]; + time_t t; + struct tm *tmp; + +@@ -3122,7 +3122,7 @@ static void capture(char *orig_name) + int tostdout=0; /* boolean which describes output stream */ + int filecount=0; /* number of files written */ + char *name = orig_name; /* current filename */ +- char namebuf[PATH_MAX+1]; ++ char namebuf[PATH_MAX+2]; + off64_t count, rest; /* number of bytes to capture */ + struct stat statbuf; + +-- +2.24.1 + + +From c9dc401264ad3c0b621f52e8098e7c1661c50cea Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Wed, 20 Nov 2019 11:13:55 -0800 +Subject: [PATCH 05/31] aplay: Limit VUMeter progress bar to 100 for negative + as well + +While the progress bar cannot be negative, GCC concludes that it can be +and assumes tmp can be written past the end. Fixes this GCC warning: + +aplay.c:1747:18: warning: '%02d' directive writing between 2 and 11 bytes + into a region of size 4 [-Wformat-overflow=] + 1747 | sprintf(tmp, "%02d%%", maxperc[c]); + +Signed-off-by: Rosen Penev +Signed-off-by: Takashi Iwai +--- + aplay/aplay.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/aplay/aplay.c b/aplay/aplay.c +index 78adee2..1a887e4 100644 +--- a/aplay/aplay.c ++++ b/aplay/aplay.c +@@ -54,6 +54,8 @@ + #include "formats.h" + #include "version.h" + ++#define ABS(a) (a) < 0 ? -(a) : (a) ++ + #ifdef SND_CHMAP_API_VERSION + #define CONFIG_SUPPORT_CHMAP 1 + #endif +@@ -1741,7 +1743,7 @@ static void print_vu_meter_stereo(int *perc, int *maxperc) + line[bar_length + 6 + 1 + p] = '+'; + else + line[bar_length - p - 1] = '+'; +- if (maxperc[c] > 99) ++ if (ABS(maxperc[c]) > 99) + sprintf(tmp, "MAX"); + else + sprintf(tmp, "%02d%%", maxperc[c]); +-- +2.24.1 + + +From 3c740d90490abe64c86c667934ba5d990817b873 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 20 Nov 2019 13:20:39 +0100 +Subject: [PATCH 06/31] alsactl: sysfs - add /sys/kernel/uevent_seqnum check to + init + +Signed-off-by: Jaroslav Kysela +--- + alsactl/init_sysfs.c | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + +diff --git a/alsactl/init_sysfs.c b/alsactl/init_sysfs.c +index 5c789b6..57ef615 100644 +--- a/alsactl/init_sysfs.c ++++ b/alsactl/init_sysfs.c +@@ -34,6 +34,8 @@ static int sysfs_init(void) + const char *env; + char sysfs_test[PATH_SIZE]; + ++ INIT_LIST_HEAD(&attr_list); ++ + env = getenv("SYSFS_PATH"); + if (env) { + strlcpy(sysfs_path, env, sizeof(sysfs_path)); +@@ -43,13 +45,16 @@ static int sysfs_init(void) + dbg("sysfs_path='%s'", sysfs_path); + + strlcpy(sysfs_test, sysfs_path, sizeof(sysfs_test)); +- strlcat(sysfs_test, "/kernel/uevent_helper", sizeof(sysfs_test)); ++ strlcat(sysfs_test, "/kernel/uevent_seqnum", sizeof(sysfs_test)); + if (access(sysfs_test, F_OK)) { +- error("sysfs path '%s' is invalid\n", sysfs_path); +- return -errno; ++ strlcpy(sysfs_test, sysfs_path, sizeof(sysfs_test)); ++ strlcat(sysfs_test, "/kernel/uevent_helper", sizeof(sysfs_test)); ++ if (access(sysfs_test, F_OK)) { ++ error("sysfs path '%s' is invalid", sysfs_path); ++ return -errno; ++ } + } + +- INIT_LIST_HEAD(&attr_list); + return 0; + } + +-- +2.24.1 + + +From 745c5df26066de94622dd38c667da31ac6b88510 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 25 Nov 2019 17:58:51 +0100 +Subject: [PATCH 07/31] alsaucm: use the first sound card (use case name + 'hw:CARDNO') as default + +Signed-off-by: Jaroslav Kysela +--- + alsaucm/go.sh | 5 ++++- + alsaucm/usecase.c | 17 +++++++---------- + 2 files changed, 11 insertions(+), 11 deletions(-) + +diff --git a/alsaucm/usecase.c b/alsaucm/usecase.c +index 7677422..8b1c8c7 100644 +--- a/alsaucm/usecase.c ++++ b/alsaucm/usecase.c +@@ -188,22 +188,19 @@ static void my_exit(struct context *context, int exitcode) + + static void do_initial_open(struct context *context) + { +- const char **list; +- int err; ++ int card, err; ++ char name[16]; + + if (!context->no_open && context->card == NULL) { +- err = snd_use_case_card_list(&list); ++ card = -1; ++ err = snd_card_next(&card); + if (err < 0) { +- fprintf(stderr, "%s: unable to obtain card list: %s\n", ++ fprintf(stderr, "%s: no sound card found: %s\n", + context->command, snd_strerror(err)); + my_exit(context, EXIT_FAILURE); + } +- if (err == 0) { +- printf("No card found\n"); +- my_exit(context, EXIT_SUCCESS); +- } +- context->card = strdup(list[0]); +- snd_use_case_free_list(list, err); ++ snprintf(name, sizeof(name), "hw:%d", card); ++ context->card = strdup(name); + } + + /* open library */ +-- +2.24.1 + + +From 860ffda82518dad6018f877f58aed1485d49e3a0 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 27 Nov 2019 08:51:29 +0100 +Subject: [PATCH 08/31] alsaucm: add text dump command + +Signed-off-by: Jaroslav Kysela +--- + alsaucm/Makefile.am | 2 +- + alsaucm/dump.c | 403 ++++++++++++++++++++++++++++++++++++++++++++ + alsaucm/usecase.c | 22 +-- + alsaucm/usecase.h | 35 ++++ + 4 files changed, 447 insertions(+), 15 deletions(-) + create mode 100644 alsaucm/dump.c + create mode 100644 alsaucm/usecase.h + +diff --git a/alsaucm/Makefile.am b/alsaucm/Makefile.am +index 4b447dd..03f99e0 100644 +--- a/alsaucm/Makefile.am ++++ b/alsaucm/Makefile.am +@@ -5,7 +5,7 @@ if USE_RST2MAN + man_MANS = alsaucm.1 + endif + +-alsaucm_SOURCES = usecase.c ++alsaucm_SOURCES = usecase.c dump.c + + AM_CPPFLAGS = \ + -Wall -I$(top_srcdir)/include +diff --git a/alsaucm/dump.c b/alsaucm/dump.c +new file mode 100644 +index 0000000..ae0af2f +--- /dev/null ++++ b/alsaucm/dump.c +@@ -0,0 +1,403 @@ ++/* ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ * ++ * Copyright (C) 2019 Red Hat Inc. ++ * Authors: Jaroslav Kysela ++ */ ++ ++#include ++#include ++#include ++#include ++#include "usecase.h" ++#include "aconfig.h" ++#include "version.h" ++ ++struct renderer { ++ int (*init)(struct renderer *r); ++ void (*done)(struct renderer *r); ++ int (*verb_begin)(struct renderer *r, ++ const char *verb, ++ const char *comment); ++ int (*verb_end)(struct renderer *r); ++ int (*device_begin)(struct renderer *r, ++ const char *device, ++ const char *comment); ++ int (*device_end)(struct renderer *r); ++ int (*modifier_begin)(struct renderer *r, ++ const char *device, ++ const char *comment); ++ int (*modifier_end)(struct renderer *r); ++ int (*supported_begin)(struct renderer *r); ++ int (*supported_value)(struct renderer *r, const char *value, int last); ++ int (*supported_end)(struct renderer *r); ++ int (*conflict_begin)(struct renderer *r); ++ int (*conflict_value)(struct renderer *r, const char *value, int last); ++ int (*conflict_end)(struct renderer *r); ++ int (*value_begin)(struct renderer *r); ++ int (*value_end)(struct renderer *r); ++ int (*value)(struct renderer *r, const char *ident, const char *value); ++ void *opaque; ++}; ++ ++struct text { ++ char a[1]; ++}; ++ ++static char *tesc(const char *s, char *buf, size_t buf_len) ++{ ++ char *dst = buf; ++ char c = '\0'; ++ if (strchr(s, '"') || strchr(s, ' ') || strchr(s, '.')) { ++ *dst++ = c = '"'; ++ buf_len--; ++ } ++ while (*s && buf_len > 2) { ++ if (*s == '\"') { ++ if (buf_len > 3) { ++ *dst++ = '"'; ++ *dst++ = *s++; ++ buf_len -= 2; ++ continue; ++ } else { ++ break; ++ } ++ } ++ *dst++ = *s++; ++ } ++ if (c) ++ *dst++ = c; ++ *dst = '\0'; ++ return buf; ++} ++ ++#define ESC(s, esc) tesc((s), (esc), sizeof(esc)) ++ ++static int text_verb_start(struct renderer *r, const char *verb, const char *comment) ++{ ++ char buf1[128], buf2[128]; ++ printf("Verb.%s {\n", ESC(verb, buf1)); ++ if (comment && comment[0]) ++ printf("\tComment %s\n", ESC(comment, buf2)); ++ return 0; ++} ++ ++static int text_verb_end(struct renderer *r) ++{ ++ printf("}\n"); ++ return 0; ++} ++ ++static int text_2nd_level_begin(struct renderer *r, ++ const char *key, ++ const char *val, ++ const char *comment) ++{ ++ char buf1[128], buf2[128]; ++ printf("\t%s.%s {\n", key, ESC(val, buf1)); ++ if (comment && comment[0]) ++ printf("\t\tComment %s\n", ESC(comment, buf2)); ++ return 0; ++} ++ ++static int text_2nd_level_end(struct renderer *r) ++{ ++ printf("\t}\n"); ++ return 0; ++} ++ ++static int text_2nd_level(struct renderer *r, const char *txt) ++{ ++ printf("\t\t%s", txt); ++ return 0; ++} ++ ++static int text_3rd_level(struct renderer *r, const char *txt) ++{ ++ printf("\t\t\t%s", txt); ++ return 0; ++} ++ ++static int text_dev_start(struct renderer *r, const char *dev, const char *comment) ++{ ++ return text_2nd_level_begin(r, "Device", dev, comment); ++} ++ ++static int text_mod_start(struct renderer *r, const char *dev, const char *comment) ++{ ++ return text_2nd_level_begin(r, "Modifier", dev, comment); ++} ++ ++static int text_supcon_start(struct renderer *r, const char *key) ++{ ++ if (text_2nd_level(r, key)) ++ return 1; ++ printf(" [\n"); ++ return 0; ++} ++ ++static int text_supcon_value(struct renderer *r, const char *value, int last) ++{ ++ char buf[256]; ++ ESC(value, buf); ++ if (!last && strlen(buf) < sizeof(buf) - 2) ++ strcat(buf, ","); ++ if (text_3rd_level(r, buf)) ++ return 1; ++ printf("\n"); ++ return 0; ++} ++ ++static int text_supcon_end(struct renderer *r) ++{ ++ return text_2nd_level(r, "]\n"); ++} ++ ++static int text_sup_start(struct renderer *r) ++{ ++ return text_supcon_start(r, "SupportedDevices"); ++} ++ ++static int text_con_start(struct renderer *r) ++{ ++ return text_supcon_start(r, "ConflictingDevices"); ++} ++ ++static int text_value_begin(struct renderer *r) ++{ ++ return text_2nd_level(r, "Values [\n"); ++} ++ ++static int text_value_end(struct renderer *r) ++{ ++ return text_2nd_level(r, "]\n"); ++} ++ ++static int text_value(struct renderer *r, const char *ident, const char *value) ++{ ++ char buf1[256], buf2[256]; ++ int err; ++ ++ ESC(ident, buf1); ++ err = text_3rd_level(r, buf1); ++ if (err < 0) ++ return err; ++ ESC(value, buf2); ++ printf(" %s\n", buf2); ++ return 0; ++} ++ ++static struct renderer text_renderer = { ++ .verb_begin = text_verb_start, ++ .verb_end = text_verb_end, ++ .device_begin = text_dev_start, ++ .device_end = text_2nd_level_end, ++ .modifier_begin = text_mod_start, ++ .modifier_end = text_2nd_level_end, ++ .supported_begin = text_sup_start, ++ .supported_value = text_supcon_value, ++ .supported_end = text_supcon_end, ++ .conflict_begin = text_con_start, ++ .conflict_value = text_supcon_value, ++ .conflict_end = text_supcon_end, ++ .value_begin = text_value_begin, ++ .value_end = text_value_end, ++ .value = text_value, ++}; ++ ++static int render_devlist(struct context *context, ++ struct renderer *render, ++ const char *verb, ++ const char *device, ++ const char *list, ++ int (*begin)(struct renderer *), ++ int (*value)(struct renderer *, const char *value, int last), ++ int (*end)(struct renderer *)) ++{ ++ snd_use_case_mgr_t *uc_mgr = context->uc_mgr; ++ const char **dev_list; ++ char buf[256]; ++ int err = 0, j, dev_num; ++ ++ snprintf(buf, sizeof(buf), "%s/%s/%s", list, device, verb); ++ dev_num = snd_use_case_get_list(uc_mgr, buf, &dev_list); ++ if (dev_num < 0) { ++ fprintf(stderr, "%s: unable to get %s for verb '%s' for device '%s'\n", ++ context->command, list, verb, device); ++ return dev_num; ++ } ++ if (dev_num > 0) { ++ err = begin(render); ++ if (err < 0) ++ goto __err; ++ for (j = 0; j < dev_num; j++) { ++ err = value(render, dev_list[j], j + 1 == dev_num); ++ if (err < 0) ++ goto __err; ++ } ++ err = end(render); ++ } ++__err: ++ snd_use_case_free_list(dev_list, dev_num); ++ return err; ++} ++ ++static int render_values(struct context *context, ++ struct renderer *render, ++ const char *verb, ++ const char *device) ++{ ++ snd_use_case_mgr_t *uc_mgr = context->uc_mgr; ++ const char **list, *value; ++ char buf[256]; ++ int err = 0, j, num; ++ ++ snprintf(buf, sizeof(buf), "_identifiers/%s/%s", device, verb); ++ num = snd_use_case_get_list(uc_mgr, buf, &list); ++ if (num < 0) { ++ fprintf(stderr, "%s: unable to get _identifiers for verb '%s' for device '%s': %s\n", ++ context->command, verb, device, snd_strerror(num)); ++ return num; ++ } ++ if (num == 0) ++ goto __err; ++ if (render->value_begin) { ++ err = render->value_begin(render); ++ if (err < 0) ++ goto __err; ++ } ++ for (j = 0; j < num; j++) { ++ snprintf(buf, sizeof(buf), "%s/%s/%s", list[j], device, verb); ++ err = snd_use_case_get(uc_mgr, buf, &value); ++ if (err < 0) { ++ fprintf(stderr, "%s: unable to get value '%s' for verb '%s' for device '%s': %s\n", ++ context->command, list[j], verb, device, snd_strerror(err)); ++ goto __err; ++ } ++ err = render->value(render, list[j], value); ++ free((char *)value); ++ if (err < 0) ++ goto __err; ++ } ++ if (render->value_end) ++ err = render->value_end(render); ++__err: ++ snd_use_case_free_list(list, num); ++ return err; ++} ++ ++static int render_device(struct context *context, ++ struct renderer *render, ++ const char *verb, ++ const char *device) ++{ ++ int err; ++ ++ err = render_devlist(context, render, verb, device, ++ "_supporteddevs", ++ render->supported_begin, ++ render->supported_value, ++ render->supported_end); ++ if (err < 0) ++ return err; ++ err = render_devlist(context, render, verb, device, ++ "_conflictingdevs", ++ render->conflict_begin, ++ render->conflict_value, ++ render->conflict_end); ++ if (err < 0) ++ return err; ++ return render_values(context, render, verb, device); ++} ++ ++static void render(struct context *context, struct renderer *render) ++{ ++ snd_use_case_mgr_t *uc_mgr = context->uc_mgr; ++ int i, j, num, dev_num; ++ const char **list, **dev_list, *verb, *comment; ++ char buf[256]; ++ ++ num = snd_use_case_verb_list(uc_mgr, &list); ++ if (num < 0) { ++ fprintf(stderr, "%s: no verbs found\n", context->command); ++ return; ++ } ++ if (render->init && render->init(render)) ++ goto __end; ++ for (i = 0; i < num; i += 2) { ++ /* verb */ ++ verb = list[i + 0]; ++ comment = list[i + 1]; ++ if (render->verb_begin(render, verb, comment)) ++ break; ++ /* devices */ ++ snprintf(buf, sizeof(buf), "_devices/%s", verb); ++ dev_num = snd_use_case_get_list(uc_mgr, buf, &dev_list); ++ if (dev_num < 0) { ++ fprintf(stderr, "%s: unable to get devices for verb '%s'\n", ++ context->command, verb); ++ continue; ++ } ++ for (j = 0; j < dev_num; j += 2) { ++ render->device_begin(render, dev_list[j + 0], dev_list[j + 1]); ++ if (render_device(context, render, verb, dev_list[j + 0])) { ++ snd_use_case_free_list(dev_list, dev_num); ++ goto __end; ++ } ++ render->device_end(render); ++ } ++ snd_use_case_free_list(dev_list, dev_num); ++ /* modifiers */ ++ snprintf(buf, sizeof(buf), "_modifiers/%s", verb); ++ dev_num = snd_use_case_get_list(uc_mgr, buf, &dev_list); ++ if (dev_num < 0) { ++ fprintf(stderr, "%s: unable to get modifiers for verb '%s'\n", ++ context->command, verb); ++ continue; ++ } ++ for (j = 0; j < dev_num; j += 2) { ++ render->modifier_begin(render, dev_list[j + 0], dev_list[j + 1]); ++ render->modifier_end(render); ++ } ++ snd_use_case_free_list(dev_list, dev_num); ++ /* end */ ++ if (render->verb_end(render)) ++ break; ++ } ++ if (render->done) ++ render->done(render); ++__end: ++ snd_use_case_free_list(list, num); ++} ++ ++void dump(struct context *context, const char *format) ++{ ++ struct renderer r; ++ ++ r.opaque = NULL; ++ if (strcasecmp(format, "text") == 0 || ++ strcasecmp(format, "txt") == 0) { ++ struct text t; ++ memset(&t, 0, sizeof(t)); ++ r = text_renderer; ++ r.opaque = &t; ++ } ++ if (r.opaque != NULL) { ++ render(context, &r); ++ return; ++ } ++ fprintf(stderr, "%s: unknown dump format '%s'\n", ++ context->command, format); ++} +diff --git a/alsaucm/usecase.c b/alsaucm/usecase.c +index 8b1c8c7..44fc92b 100644 +--- a/alsaucm/usecase.c ++++ b/alsaucm/usecase.c +@@ -38,24 +38,12 @@ + #include + #include + #include ++#include "usecase.h" + #include "aconfig.h" + #include "version.h" + + #define MAX_BUF 256 + +-struct context { +- snd_use_case_mgr_t *uc_mgr; +- const char *command; +- char *card; +- char **argv; +- int argc; +- int arga; +- char *batch; +- unsigned int interactive:1; +- unsigned int no_open:1; +- unsigned int do_exit:1; +-}; +- + enum uc_cmd { + /* management */ + OM_UNKNOWN = 0, +@@ -63,6 +51,7 @@ enum uc_cmd { + OM_RESET, + OM_RELOAD, + OM_LISTCARDS, ++ OM_DUMP, + OM_LIST2, + OM_LIST1, + +@@ -88,11 +77,13 @@ static struct cmd cmds[] = { + { OM_RESET, 0, 1, "reset" }, + { OM_RELOAD, 0, 1, "reload" }, + { OM_LISTCARDS, 0, 0, "listcards" }, ++ { OM_DUMP, 1, 1, "dump" }, + { OM_LIST1, 1, 1, "list1" }, + { OM_LIST2, 1, 1, "list" }, + { OM_SET, 2, 1, "set" }, + { OM_GET, 1, 1, "get" }, + { OM_GETI, 1, 1, "geti" }, ++ { OM_DUMP, 1, 1, "dump" }, + { OM_HELP, 0, 0, "help" }, + { OM_QUIT, 0, 0, "quit" }, + { OM_HELP, 0, 0, "h" }, +@@ -117,6 +108,7 @@ static void dump_help(struct context *context) + " reset reset sound card to default state\n" + " reload reload configuration\n" + " listcards list available cards\n" ++" dump FORMAT dump all config information (format: text)\n" + " list IDENTIFIER list command, for items with value + comment\n" + " list1 IDENTIFIER list command, for items without comments\n" + " get IDENTIFIER get string value\n" +@@ -185,7 +177,6 @@ static void my_exit(struct context *context, int exitcode) + snd_config_update_free_global(); + exit(exitcode); + } +- + static void do_initial_open(struct context *context) + { + int card, err; +@@ -288,6 +279,9 @@ static int do_one(struct context *context, struct cmd *cmd, char **argv) + } + snd_use_case_free_list(list, err); + break; ++ case OM_DUMP: ++ dump(context, argv[0]); ++ break; + case OM_LIST1: + case OM_LIST2: + switch (cmd->code) { +diff --git a/alsaucm/usecase.h b/alsaucm/usecase.h +new file mode 100644 +index 0000000..a85716a +--- /dev/null ++++ b/alsaucm/usecase.h +@@ -0,0 +1,35 @@ ++/* ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ */ ++ ++#ifndef __USECASE_H ++#define __USECASE_H ++ ++struct context { ++ snd_use_case_mgr_t *uc_mgr; ++ const char *command; ++ char *card; ++ char **argv; ++ int argc; ++ int arga; ++ char *batch; ++ unsigned int interactive:1; ++ unsigned int no_open:1; ++ unsigned int do_exit:1; ++}; ++ ++void dump(struct context *context, const char *format); ++ ++#endif +-- +2.24.1 + + +From 49716fa61e9ddc67476d40f9ea84f07fe0017748 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Sat, 30 Nov 2019 20:30:33 +0100 +Subject: [PATCH 09/31] alsaucm: add json dump command + +Signed-off-by: Jaroslav Kysela +--- + alsaucm/dump.c | 251 +++++++++++++++++++++++++++++++++++++++++++++- + alsaucm/usecase.c | 2 +- + 2 files changed, 249 insertions(+), 4 deletions(-) + +diff --git a/alsaucm/dump.c b/alsaucm/dump.c +index ae0af2f..bc638f1 100644 +--- a/alsaucm/dump.c ++++ b/alsaucm/dump.c +@@ -32,10 +32,14 @@ struct renderer { + const char *verb, + const char *comment); + int (*verb_end)(struct renderer *r); ++ int (*device_block_begin)(struct renderer *r); ++ int (*device_block_end)(struct renderer *r); + int (*device_begin)(struct renderer *r, + const char *device, + const char *comment); + int (*device_end)(struct renderer *r); ++ int (*modifier_block_begin)(struct renderer *r); ++ int (*modifier_block_end)(struct renderer *r); + int (*modifier_begin)(struct renderer *r, + const char *device, + const char *comment); +@@ -52,6 +56,10 @@ struct renderer { + void *opaque; + }; + ++/* ++ * Text renderer ++ */ ++ + struct text { + char a[1]; + }; +@@ -177,12 +185,12 @@ static int text_con_start(struct renderer *r) + + static int text_value_begin(struct renderer *r) + { +- return text_2nd_level(r, "Values [\n"); ++ return text_2nd_level(r, "Values {\n"); + } + + static int text_value_end(struct renderer *r) + { +- return text_2nd_level(r, "]\n"); ++ return text_2nd_level(r, "}\n"); + } + + static int text_value(struct renderer *r, const char *ident, const char *value) +@@ -217,6 +225,220 @@ static struct renderer text_renderer = { + .value = text_value, + }; + ++/* ++ * JSON renderer ++ */ ++ ++struct json { ++ int block[5]; ++}; ++ ++static char *jesc(const char *s, char *buf, size_t buf_len) ++{ ++ char *dst = buf; ++ char c = '"'; ++ *dst++ = c; ++ buf_len--; ++ while (*s && buf_len > 2) { ++ if (*s == '\"') { ++ if (buf_len > 3) { ++ *dst++ = '"'; ++ *dst++ = *s++; ++ buf_len -= 2; ++ continue; ++ } else { ++ break; ++ } ++ } ++ *dst++ = *s++; ++ } ++ *dst++ = c; ++ *dst = '\0'; ++ return buf; ++} ++ ++#define JESC(s, esc) jesc((s), (esc), sizeof(esc)) ++ ++static void json_block(struct renderer *r, int level, int last) ++{ ++ struct json *j = r->opaque; ++ printf((j->block[level] && !last) ? ",\n" : "\n"); ++ j->block[level] = last ? 0 : 1; ++} ++ ++static int json_init(struct renderer *r) ++{ ++ printf("{\n \"Verbs\": {"); ++ return 0; ++} ++ ++static void json_done(struct renderer *r) ++{ ++ json_block(r, 0, 1); ++ printf(" }\n}\n"); ++} ++ ++static int json_verb_start(struct renderer *r, const char *verb, const char *comment) ++{ ++ char buf[256]; ++ json_block(r, 0, 0); ++ printf(" %s: {", JESC(verb, buf)); ++ if (comment && comment[0]) { ++ json_block(r, 1, 0); ++ printf(" \"Comment\": %s", JESC(comment, buf)); ++ } ++ return 0; ++} ++ ++static int json_verb_end(struct renderer *r) ++{ ++ json_block(r, 1, 1); ++ printf(" }"); ++ return 0; ++} ++ ++static int json_2nd_level_block_end(struct renderer *r) ++{ ++ json_block(r, 2, 1); ++ printf(" }"); ++ return 0; ++} ++ ++static int json_2nd_level_begin(struct renderer *r, ++ const char *val, ++ const char *comment) ++{ ++ char buf[256]; ++ json_block(r, 2, 0); ++ printf(" %s: {", JESC(val, buf)); ++ if (comment && comment[0]) { ++ json_block(r, 3, 0); ++ printf(" \"Comment\": %s", JESC(comment, buf)); ++ } ++ return 0; ++} ++ ++static int json_2nd_level_end(struct renderer *r) ++{ ++ json_block(r, 3, 1); ++ printf(" }"); ++ return 0; ++} ++ ++static int json_2nd_level(struct renderer *r, const char *txt) ++{ ++ printf(" %s", txt); ++ return 0; ++} ++ ++static int json_3rd_level(struct renderer *r, const char *txt) ++{ ++ printf(" %s", txt); ++ return 0; ++} ++ ++static int json_dev_block_start(struct renderer *r) ++{ ++ json_block(r, 1, 0); ++ printf(" \"Devices\": {"); ++ return 0; ++} ++ ++static int json_mod_block_start(struct renderer *r) ++{ ++ json_block(r, 1, 0); ++ printf(" \"Modifiers\": {"); ++ return 0; ++} ++ ++static int json_supcon_start(struct renderer *r, const char *key) ++{ ++ json_block(r, 3, 0); ++ if (json_2nd_level(r, key)) ++ return 1; ++ printf(": ["); ++ return 0; ++} ++ ++static int json_supcon_value(struct renderer *r, const char *value, int last) ++{ ++ char buf[256]; ++ JESC(value, buf); ++ json_block(r, 4, 0); ++ return json_3rd_level(r, buf); ++} ++ ++static int json_supcon_end(struct renderer *r) ++{ ++ json_block(r, 4, 1); ++ return json_2nd_level(r, "]"); ++} ++ ++static int json_sup_start(struct renderer *r) ++{ ++ return json_supcon_start(r, "\"SupportedDevices\""); ++} ++ ++static int json_con_start(struct renderer *r) ++{ ++ return json_supcon_start(r, "\"ConflictingDevices\""); ++} ++ ++static int json_value_begin(struct renderer *r) ++{ ++ json_block(r, 3, 0); ++ return json_2nd_level(r, "\"Values\": {"); ++} ++ ++static int json_value_end(struct renderer *r) ++{ ++ json_block(r, 4, 1); ++ return json_2nd_level(r, "}"); ++} ++ ++static int json_value(struct renderer *r, const char *ident, const char *value) ++{ ++ char buf[256]; ++ int err; ++ ++ json_block(r, 4, 0); ++ JESC(ident, buf); ++ err = json_3rd_level(r, buf); ++ if (err < 0) ++ return err; ++ JESC(value, buf); ++ printf(": %s", buf); ++ return 0; ++} ++ ++static struct renderer json_renderer = { ++ .init = json_init, ++ .done = json_done, ++ .verb_begin = json_verb_start, ++ .verb_end = json_verb_end, ++ .device_block_begin = json_dev_block_start, ++ .device_block_end = json_2nd_level_block_end, ++ .device_begin = json_2nd_level_begin, ++ .device_end = json_2nd_level_end, ++ .modifier_block_begin = json_mod_block_start, ++ .modifier_block_end = json_2nd_level_block_end, ++ .modifier_begin = json_2nd_level_begin, ++ .modifier_end = json_2nd_level_end, ++ .supported_begin = json_sup_start, ++ .supported_value = json_supcon_value, ++ .supported_end = json_supcon_end, ++ .conflict_begin = json_con_start, ++ .conflict_value = json_supcon_value, ++ .conflict_end = json_supcon_end, ++ .value_begin = json_value_begin, ++ .value_end = json_value_end, ++ .value = json_value, ++}; ++ ++/* ++ * universal dump functions ++ */ ++ + static int render_devlist(struct context *context, + struct renderer *render, + const char *verb, +@@ -350,6 +572,12 @@ static void render(struct context *context, struct renderer *render) + context->command, verb); + continue; + } ++ if (dev_num == 0) ++ goto __mods; ++ if (render->device_block_begin && render->device_block_begin(render)) { ++ snd_use_case_free_list(dev_list, dev_num); ++ goto __end; ++ } + for (j = 0; j < dev_num; j += 2) { + render->device_begin(render, dev_list[j + 0], dev_list[j + 1]); + if (render_device(context, render, verb, dev_list[j + 0])) { +@@ -359,6 +587,9 @@ static void render(struct context *context, struct renderer *render) + render->device_end(render); + } + snd_use_case_free_list(dev_list, dev_num); ++ if (render->device_block_end && render->device_block_end(render)) ++ goto __end; ++__mods: + /* modifiers */ + snprintf(buf, sizeof(buf), "_modifiers/%s", verb); + dev_num = snd_use_case_get_list(uc_mgr, buf, &dev_list); +@@ -367,11 +598,20 @@ static void render(struct context *context, struct renderer *render) + context->command, verb); + continue; + } ++ if (dev_num == 0) ++ goto __verb_end; ++ if (render->modifier_block_begin && render->modifier_block_begin(render)) { ++ snd_use_case_free_list(dev_list, dev_num); ++ goto __end; ++ } + for (j = 0; j < dev_num; j += 2) { + render->modifier_begin(render, dev_list[j + 0], dev_list[j + 1]); + render->modifier_end(render); + } + snd_use_case_free_list(dev_list, dev_num); ++ if (render->modifier_block_end && render->modifier_block_end(render)) ++ goto __end; ++__verb_end: + /* end */ + if (render->verb_end(render)) + break; +@@ -385,14 +625,19 @@ __end: + void dump(struct context *context, const char *format) + { + struct renderer r; ++ struct text t; ++ struct json j; + + r.opaque = NULL; + if (strcasecmp(format, "text") == 0 || + strcasecmp(format, "txt") == 0) { +- struct text t; + memset(&t, 0, sizeof(t)); + r = text_renderer; + r.opaque = &t; ++ } else if (strcasecmp(format, "json") == 0) { ++ memset(&j, 0, sizeof(j)); ++ r = json_renderer; ++ r.opaque = &j; + } + if (r.opaque != NULL) { + render(context, &r); +diff --git a/alsaucm/usecase.c b/alsaucm/usecase.c +index 44fc92b..1ed91ea 100644 +--- a/alsaucm/usecase.c ++++ b/alsaucm/usecase.c +@@ -108,7 +108,7 @@ static void dump_help(struct context *context) + " reset reset sound card to default state\n" + " reload reload configuration\n" + " listcards list available cards\n" +-" dump FORMAT dump all config information (format: text)\n" ++" dump FORMAT dump all config information (format: text,json)\n" + " list IDENTIFIER list command, for items with value + comment\n" + " list1 IDENTIFIER list command, for items without comments\n" + " get IDENTIFIER get string value\n" +-- +2.24.1 + + +From 160b47e27c787880f1581a0f2e70138f6b24c41b Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Sat, 30 Nov 2019 20:38:17 +0100 +Subject: [PATCH 10/31] alsaucm: dump - fix the prefixed " + +Signed-off-by: Jaroslav Kysela +--- + alsaucm/dump.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/alsaucm/dump.c b/alsaucm/dump.c +index bc638f1..7a90c82 100644 +--- a/alsaucm/dump.c ++++ b/alsaucm/dump.c +@@ -73,9 +73,9 @@ static char *tesc(const char *s, char *buf, size_t buf_len) + buf_len--; + } + while (*s && buf_len > 2) { +- if (*s == '\"') { ++ if (*s == '"') { + if (buf_len > 3) { +- *dst++ = '"'; ++ *dst++ = '\\'; + *dst++ = *s++; + buf_len -= 2; + continue; +@@ -240,9 +240,9 @@ static char *jesc(const char *s, char *buf, size_t buf_len) + *dst++ = c; + buf_len--; + while (*s && buf_len > 2) { +- if (*s == '\"') { ++ if (*s == '"') { + if (buf_len > 3) { +- *dst++ = '"'; ++ *dst++ = '\\'; + *dst++ = *s++; + buf_len -= 2; + continue; +-- +2.24.1 + + +From 34e373d0b12d96353c49c3dcd73ec52eee11484a Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 3 Dec 2019 13:53:25 +0100 +Subject: [PATCH 11/31] alsactl: fix --sched-idle (set it really to SCHED_IDLE) + +Reported-by: tommy +Signed-off-by: Jaroslav Kysela +--- + alsactl/Makefile.am | 2 ++ + alsactl/alsactl.c | 2 +- + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/alsactl/Makefile.am b/alsactl/Makefile.am +index aaaf74e..e9ab2eb 100644 +--- a/alsactl/Makefile.am ++++ b/alsactl/Makefile.am +@@ -7,6 +7,8 @@ man_MANS += alsactl_init.7 + endif + EXTRA_DIST=alsactl.1 alsactl_init.xml + ++AM_CFLAGS = -D_GNU_SOURCE ++ + alsactl_SOURCES=alsactl.c state.c lock.c utils.c init_parse.c daemon.c \ + monitor.c + +diff --git a/alsactl/alsactl.c b/alsactl/alsactl.c +index 94cae23..dfb1db7 100644 +--- a/alsactl/alsactl.c ++++ b/alsactl/alsactl.c +@@ -161,7 +161,7 @@ static void do_nice(int use_nice, int sched_idle) + if (sched_idle) { + if (sched_getparam(0, &sched_param) >= 0) { + sched_param.sched_priority = 0; +- if (!sched_setscheduler(0, SCHED_RR, &sched_param)) ++ if (!sched_setscheduler(0, SCHED_IDLE, &sched_param)) + error("sched_setparam failed: %s", strerror(errno)); + } else { + error("sched_getparam failed: %s", strerror(errno)); +-- +2.24.1 + + +From f77a269370af917585df59d8c21c89bca07b5b73 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 3 Dec 2019 20:51:56 +0100 +Subject: [PATCH 12/31] configure: Fix linking of alsatplg with the older libs + +BugLink: https://github.com/alsa-project/alsa-utils/issues/33 +Signed-off-by: Jaroslav Kysela +--- + configure.ac | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/configure.ac b/configure.ac +index a4a2dd4..4bee49b 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -70,6 +70,11 @@ AM_CONDITIONAL(HAVE_TOPOLOGY, test "$have_topology" = "yes") + AM_CONDITIONAL(HAVE_SAMPLERATE, test "$have_samplerate" = "yes") + AM_CONDITIONAL(HAVE_FFADO, test "$have_ffado" = "yes") + ++# old libasound with the topology routines in the main library ++if test "x$have_topology" = "xyes" -a "x$ALSA_TOPOLOGY_LIBS" = "x"; then ++ ALSA_TOPOLOGY_LIBS="$ALSA_LIBS" ++fi ++ + dnl Use tinyalsa + alsabat_backend_tiny= + AC_ARG_ENABLE(alsabat_backend_tiny, +-- +2.24.1 + + +From 08d2341a176248a346efbdaa6d8878f3ebd627da Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 12 Dec 2019 19:00:42 +0100 +Subject: [PATCH 13/31] alsatplg: add -n,--normalize option + +This function loads and parses the topology file and +saves back the structured output in the alsa-lib's format +without comments. + +Signed-off-by: Jaroslav Kysela +--- + topology/topology.c | 165 ++++++++++++++++++++++++++++++++++++++------ + 1 file changed, 145 insertions(+), 20 deletions(-) + +diff --git a/topology/topology.c b/topology/topology.c +index b72e341..a6ebafa 100644 +--- a/topology/topology.c ++++ b/topology/topology.c +@@ -43,23 +43,154 @@ _("Usage: %s [OPTIONS]...\n" + "\n" + "-h, --help help\n" + "-c, --compile=FILE compile file\n" ++"-n, --normalize=FILE normalize file\n" + "-v, --verbose=LEVEL set verbosity level (0...1)\n" + "-o, --output=FILE set output file\n" + ), name); + } + +-int main(int argc, char *argv[]) ++static int _compar(const void *a, const void *b) ++{ ++ const snd_config_t *c1 = *(snd_config_t **)a; ++ const snd_config_t *c2 = *(snd_config_t **)b; ++ const char *id1, *id2; ++ if (snd_config_get_id(c1, &id1)) return 0; ++ if (snd_config_get_id(c2, &id2)) return 0; ++ return strcmp(id1, id2); ++} ++ ++static snd_config_t *normalize_config(const char *id, snd_config_t *src) ++{ ++ snd_config_t *dst, **a; ++ snd_config_iterator_t i, next; ++ int index, count; ++ ++ if (snd_config_get_type(src) != SND_CONFIG_TYPE_COMPOUND) { ++ if (snd_config_copy(&dst, src) >= 0) ++ return dst; ++ return NULL; ++ } ++ if (snd_config_make_compound(&dst, id, 0)) ++ return NULL; ++ count = 0; ++ snd_config_for_each(i, next, src) ++ count++; ++ a = malloc(sizeof(dst) * count); ++ if (a == NULL) ++ return NULL; ++ index = 0; ++ snd_config_for_each(i, next, src) { ++ snd_config_t *s = snd_config_iterator_entry(i); ++ a[index++] = s; ++ } ++ qsort(a, count, sizeof(a[0]), _compar); ++ for (index = 0; index < count; index++) { ++ snd_config_t *s = a[index]; ++ const char *id2; ++ if (snd_config_get_id(s, &id2)) { ++ snd_config_delete(dst); ++ return NULL; ++ } ++ s = normalize_config(id2, s); ++ if (s == NULL || snd_config_add(dst, s)) { ++ snd_config_delete(dst); ++ return NULL; ++ } ++ } ++ return dst; ++} ++ ++static int compile(const char *source_file, const char *output_file, int verbose) + { + snd_tplg_t *snd_tplg; +- static const char short_options[] = "hc:v:o:"; ++ int err; ++ ++ snd_tplg = snd_tplg_new(); ++ if (snd_tplg == NULL) { ++ fprintf(stderr, _("failed to create new topology context\n")); ++ return 1; ++ } ++ ++ snd_tplg_verbose(snd_tplg, verbose); ++ ++ err = snd_tplg_build_file(snd_tplg, source_file, output_file); ++ if (err < 0) { ++ fprintf(stderr, _("failed to compile context %s\n"), source_file); ++ snd_tplg_free(snd_tplg); ++ unlink(output_file); ++ return 1; ++ } ++ ++ snd_tplg_free(snd_tplg); ++ return 1; ++} ++ ++static int normalize(const char *source_file, const char *output_file) ++{ ++ snd_input_t *input; ++ snd_output_t *output; ++ snd_config_t *top, *norm; ++ int err; ++ ++ err = snd_input_stdio_open(&input, source_file, "r"); ++ if (err < 0) { ++ fprintf(stderr, "Unable to open source file '%s': %s\n", source_file, snd_strerror(-err)); ++ return 0; ++ } ++ ++ err = snd_config_top(&top); ++ if (err < 0) { ++ snd_input_close(input); ++ return 1; ++ } ++ ++ err = snd_config_load(top, input); ++ snd_input_close(input); ++ if (err < 0) { ++ snd_config_delete(top); ++ fprintf(stderr, "Unable to parse source file '%s': %s\n", source_file, snd_strerror(-err)); ++ snd_config_delete(top); ++ return 1; ++ } ++ ++ err = snd_output_stdio_open(&output, output_file, "w+"); ++ if (err < 0) { ++ fprintf(stderr, "Unable to open output file '%s': %s\n", output_file, snd_strerror(-err)); ++ snd_config_delete(top); ++ return 1; ++ } ++ ++ norm = normalize_config(NULL, top); ++ if (norm == NULL) { ++ fprintf(stderr, "Unable to normalize configuration (out of memory?)\n"); ++ snd_output_close(output); ++ snd_config_delete(top); ++ return 1; ++ } ++ ++ err = snd_config_save(norm, output); ++ snd_output_close(output); ++ snd_config_delete(top); ++ if (err < 0) { ++ fprintf(stderr, "Unable to save normalized contents: %s\n", snd_strerror(-err)); ++ return 1; ++ } ++ ++ return 0; ++} ++ ++int main(int argc, char *argv[]) ++{ ++ static const char short_options[] = "hc:n:v:o:"; + static const struct option long_options[] = { + {"help", 0, NULL, 'h'}, + {"verbose", 1, NULL, 'v'}, + {"compile", 1, NULL, 'c'}, ++ {"normalize", 1, NULL, 'n'}, + {"output", 1, NULL, 'o'}, + {0, 0, 0, 0}, + }; +- char *source_file = NULL, *output_file = NULL; ++ char *source_file = NULL, *normalize_file = NULL, *output_file = NULL; + int c, err, verbose = 0, option_index; + + #ifdef ENABLE_NLS +@@ -81,6 +212,9 @@ int main(int argc, char *argv[]) + case 'c': + source_file = optarg; + break; ++ case 'n': ++ normalize_file = optarg; ++ break; + case 'o': + output_file = optarg; + break; +@@ -90,28 +224,19 @@ int main(int argc, char *argv[]) + } + } + +- if (source_file == NULL || output_file == NULL) { +- usage(argv[0]); +- return 1; +- } +- +- snd_tplg = snd_tplg_new(); +- if (snd_tplg == NULL) { +- fprintf(stderr, _("failed to create new topology context\n")); ++ if (source_file && normalize_file) { ++ fprintf(stderr, "Cannot normalize and compile at a time!\n"); + return 1; + } + +- snd_tplg_verbose(snd_tplg, verbose); +- +- err = snd_tplg_build_file(snd_tplg, source_file, output_file); +- if (err < 0) { +- fprintf(stderr, _("failed to compile context %s\n"), source_file); +- snd_tplg_free(snd_tplg); +- unlink(output_file); ++ if ((source_file == NULL && normalize_file == NULL) || output_file == NULL) { ++ usage(argv[0]); + return 1; + } + +- snd_tplg_free(snd_tplg); ++ if (source_file) ++ err = compile(source_file, output_file, verbose); ++ else ++ err = normalize(normalize_file, output_file); + return 0; + } +- +-- +2.24.1 + + +From 2656d4bec8fab8b4b9046d3b8c9c255dc2166014 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 12 Dec 2019 19:18:28 +0100 +Subject: [PATCH 14/31] alsatplg: add -s,--sort and fix memory leaks + +Signed-off-by: Jaroslav Kysela +--- + topology/topology.c | 34 ++++++++++++++++++++++++---------- + 1 file changed, 24 insertions(+), 10 deletions(-) + +diff --git a/topology/topology.c b/topology/topology.c +index a6ebafa..c12be78 100644 +--- a/topology/topology.c ++++ b/topology/topology.c +@@ -46,6 +46,7 @@ _("Usage: %s [OPTIONS]...\n" + "-n, --normalize=FILE normalize file\n" + "-v, --verbose=LEVEL set verbosity level (0...1)\n" + "-o, --output=FILE set output file\n" ++"-s, --sort sort the identifiers in the normalized output\n" + ), name); + } + +@@ -59,7 +60,7 @@ static int _compar(const void *a, const void *b) + return strcmp(id1, id2); + } + +-static snd_config_t *normalize_config(const char *id, snd_config_t *src) ++static snd_config_t *normalize_config(const char *id, snd_config_t *src, int sort) + { + snd_config_t *dst, **a; + snd_config_iterator_t i, next; +@@ -70,8 +71,6 @@ static snd_config_t *normalize_config(const char *id, snd_config_t *src) + return dst; + return NULL; + } +- if (snd_config_make_compound(&dst, id, 0)) +- return NULL; + count = 0; + snd_config_for_each(i, next, src) + count++; +@@ -83,20 +82,28 @@ static snd_config_t *normalize_config(const char *id, snd_config_t *src) + snd_config_t *s = snd_config_iterator_entry(i); + a[index++] = s; + } +- qsort(a, count, sizeof(a[0]), _compar); ++ if (sort) ++ qsort(a, count, sizeof(a[0]), _compar); ++ if (snd_config_make_compound(&dst, id, count == 1)) { ++ free(a); ++ return NULL; ++ } + for (index = 0; index < count; index++) { + snd_config_t *s = a[index]; + const char *id2; + if (snd_config_get_id(s, &id2)) { + snd_config_delete(dst); ++ free(a); + return NULL; + } +- s = normalize_config(id2, s); ++ s = normalize_config(id2, s, sort); + if (s == NULL || snd_config_add(dst, s)) { + snd_config_delete(dst); ++ free(a); + return NULL; + } + } ++ free(a); + return dst; + } + +@@ -125,7 +132,7 @@ static int compile(const char *source_file, const char *output_file, int verbose + return 1; + } + +-static int normalize(const char *source_file, const char *output_file) ++static int normalize(const char *source_file, const char *output_file, int sort) + { + snd_input_t *input; + snd_output_t *output; +@@ -160,7 +167,7 @@ static int normalize(const char *source_file, const char *output_file) + return 1; + } + +- norm = normalize_config(NULL, top); ++ norm = normalize_config(NULL, top, sort); + if (norm == NULL) { + fprintf(stderr, "Unable to normalize configuration (out of memory?)\n"); + snd_output_close(output); +@@ -170,6 +177,7 @@ static int normalize(const char *source_file, const char *output_file) + + err = snd_config_save(norm, output); + snd_output_close(output); ++ snd_config_delete(norm); + snd_config_delete(top); + if (err < 0) { + fprintf(stderr, "Unable to save normalized contents: %s\n", snd_strerror(-err)); +@@ -181,17 +189,18 @@ static int normalize(const char *source_file, const char *output_file) + + int main(int argc, char *argv[]) + { +- static const char short_options[] = "hc:n:v:o:"; ++ static const char short_options[] = "hc:n:v:o:s"; + static const struct option long_options[] = { + {"help", 0, NULL, 'h'}, + {"verbose", 1, NULL, 'v'}, + {"compile", 1, NULL, 'c'}, + {"normalize", 1, NULL, 'n'}, + {"output", 1, NULL, 'o'}, ++ {"sort", 0, NULL, 's'}, + {0, 0, 0, 0}, + }; + char *source_file = NULL, *normalize_file = NULL, *output_file = NULL; +- int c, err, verbose = 0, option_index; ++ int c, err, verbose = 0, sort = 0, option_index; + + #ifdef ENABLE_NLS + setlocale(LC_ALL, ""); +@@ -218,6 +227,9 @@ int main(int argc, char *argv[]) + case 'o': + output_file = optarg; + break; ++ case 's': ++ sort = 1; ++ break; + default: + fprintf(stderr, _("Try `%s --help' for more information.\n"), argv[0]); + return 1; +@@ -237,6 +249,8 @@ int main(int argc, char *argv[]) + if (source_file) + err = compile(source_file, output_file, verbose); + else +- err = normalize(normalize_file, output_file); ++ err = normalize(normalize_file, output_file, sort); ++ ++ snd_output_close(log); + return 0; + } +-- +2.24.1 + + +From 10db898d9b97f0a8d3093405ad5b4aa4ed53801d Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 13 Dec 2019 10:44:36 +0100 +Subject: [PATCH 15/31] alsatplg: fix another small leak in normalize_config() + +Signed-off-by: Jaroslav Kysela +--- + topology/topology.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/topology/topology.c b/topology/topology.c +index c12be78..bc5797c 100644 +--- a/topology/topology.c ++++ b/topology/topology.c +@@ -98,6 +98,8 @@ static snd_config_t *normalize_config(const char *id, snd_config_t *src, int sor + } + s = normalize_config(id2, s, sort); + if (s == NULL || snd_config_add(dst, s)) { ++ if (s) ++ snd_config_delete(s); + snd_config_delete(dst); + free(a); + return NULL; +-- +2.24.1 + + +From 11e083d81c330539f0f170bb238a17b1c2e0cb4d Mon Sep 17 00:00:00 2001 +From: David Ward +Date: Sat, 21 Dec 2019 00:32:01 -0500 +Subject: [PATCH 16/31] alsa-info.sh: Consolidate PCI device output + +Include numeric IDs and subsystem info in the PCI device output, +without placing them in a separate section. + +Signed-off-by: David Ward +Signed-off-by: Takashi Iwai +--- + alsa-info/alsa-info.sh | 10 +++------- + 1 file changed, 3 insertions(+), 7 deletions(-) + +diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh +index cf7ad89..8fc6997 100755 +--- a/alsa-info/alsa-info.sh ++++ b/alsa-info/alsa-info.sh +@@ -455,7 +455,9 @@ fi + cat /proc/asound/modules 2>/dev/null | awk '{ print $2 }' > $TEMPDIR/alsamodules.tmp + cat /proc/asound/cards > $TEMPDIR/alsacards.tmp + if [[ ! -z "$LSPCI" ]]; then +- lspci | grep -i "multi\|audio">$TEMPDIR/lspci.tmp ++ for class in 0401 0402 0403; do ++ lspci -vvnn -d "::$class" | sed -n '/^[^\t]/,+1p' ++ done > $TEMPDIR/lspci.tmp + fi + + #Check for HDA-Intel cards codec#* +@@ -585,12 +587,6 @@ echo "" >> $FILE + cat $TEMPDIR/lspci.tmp >> $FILE + echo "" >> $FILE + echo "" >> $FILE +-echo "!!Advanced information - PCI Vendor/Device/Subsystem ID's" >> $FILE +-echo "!!-------------------------------------------------------" >> $FILE +-echo "" >> $FILE +-lspci -vvn |grep -A1 040[1-3] >> $FILE +-echo "" >> $FILE +-echo "" >> $FILE + fi + + if [ "$SNDOPTIONS" ] +-- +2.24.1 + + +From 86b1f80e24b68ce8153874e6ac851fa2b90c43b5 Mon Sep 17 00:00:00 2001 +From: David Ward +Date: Sat, 21 Dec 2019 00:32:02 -0500 +Subject: [PATCH 17/31] alsa-info.sh: Read from /proc/modules and sort the + result + +Sorting the list of loaded modules makes it much easier to compare +two alsa-info.txt files, even if they are both from the same system +(since the order actually changes after each reboot). + +lsmod just formats the contents of /proc/modules. After this script +calls lsmod, it strips everything but module names from the output. +This same result can be obtained just as easily by reading directly +from /proc/modules; then there is no need to remove the header line +printed by lsmod before sorting the output. + +Signed-off-by: David Ward +Signed-off-by: Takashi Iwai +--- + alsa-info/alsa-info.sh | 9 ++++----- + 1 file changed, 4 insertions(+), 5 deletions(-) + +diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh +index 8fc6997..ed1d9e2 100755 +--- a/alsa-info/alsa-info.sh ++++ b/alsa-info/alsa-info.sh +@@ -35,7 +35,7 @@ BGTITLE="ALSA-Info v $SCRIPT_VERSION" + PASTEBINKEY="C9cRIO8m/9y8Cs0nVs0FraRx7U0pHsuc" + + WGET=$(which wget 2>/dev/null | sed 's|^[^/]*||' 2>/dev/null) +-REQUIRES="mktemp grep pgrep whereis ping awk date uname cat dmesg amixer alsactl" ++REQUIRES="mktemp grep pgrep whereis ping awk date uname cat sort dmesg amixer alsactl" + + # + # Define some simple functions +@@ -131,11 +131,11 @@ withaplay() { + echo "" >> $FILE + } + +-withlsmod() { ++withmodules() { + echo "!!All Loaded Modules" >> $FILE + echo "!!------------------" >> $FILE + echo "" >> $FILE +- lsmod | awk '{print $1}' >> $FILE ++ awk '{print $1}' < /proc/modules | sort >> $FILE + echo "" >> $FILE + echo "" >> $FILE + } +@@ -254,7 +254,7 @@ withall() { + withaplay + withamixer + withalsactl +- withlsmod ++ withmodules + withsysfs + withdmesg + WITHALL="no" +@@ -366,7 +366,6 @@ information about your ALSA installation and sound related hardware. + + dmesg + lspci +- lsmod + aplay + amixer + alsactl +-- +2.24.1 + + +From 068dd55717d4e020849e4dd12610d16968cf49be Mon Sep 17 00:00:00 2001 +From: David Ward +Date: Sat, 21 Dec 2019 00:32:03 -0500 +Subject: [PATCH 18/31] alsa-info.sh: Simplify iteration over cards when + calling amixer + +Read card names directly from individual procfs files, and pass them +to amixer using the '-c' option. + +Signed-off-by: David Ward +Signed-off-by: Takashi Iwai +--- + alsa-info/alsa-info.sh | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh +index ed1d9e2..e1067d4 100755 +--- a/alsa-info/alsa-info.sh ++++ b/alsa-info/alsa-info.sh +@@ -144,12 +144,12 @@ withamixer() { + echo "!!Amixer output" >> $FILE + echo "!!-------------" >> $FILE + echo "" >> $FILE +- for i in $(grep "]: " /proc/asound/cards | awk -F ' ' '{ print $1 }') ; do +- CARD_NAME=$(grep "^ *$i " $TEMPDIR/alsacards.tmp | awk '{ print $2 }') +- echo "!!-------Mixer controls for card $i $CARD_NAME]" >> $FILE ++ for f in /proc/asound/card*/id; do ++ [ -f "$f" ] && read -r CARD_NAME < "$f" || continue ++ echo "!!-------Mixer controls for card $CARD_NAME" >> $FILE + echo "" >>$FILE +- amixer -c$i info >> $FILE 2>&1 +- amixer -c$i >> $FILE 2>&1 ++ amixer -c "$CARD_NAME" info >> $FILE 2>&1 ++ amixer -c "$CARD_NAME" >> $FILE 2>&1 + echo "" >> $FILE + done + echo "" >> $FILE +-- +2.24.1 + + +From de5ce14163dbc1337075de1f5d632fd49865a338 Mon Sep 17 00:00:00 2001 +From: David Ward +Date: Sat, 21 Dec 2019 00:32:04 -0500 +Subject: [PATCH 19/31] alsa-info.sh: Use existing function to print ALSA + configuration files + +Signed-off-by: David Ward +Signed-off-by: Takashi Iwai +--- + alsa-info/alsa-info.sh | 27 +-------------------------- + 1 file changed, 1 insertion(+), 26 deletions(-) + +diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh +index e1067d4..bf353de 100755 +--- a/alsa-info/alsa-info.sh ++++ b/alsa-info/alsa-info.sh +@@ -710,33 +710,8 @@ if [ -n "$1" ]; then + WITHALL="no" + ;; + --with-configs) ++ withconfigs + WITHALL="no" +- if [[ -e $HOME/.asoundrc ]] || [[ -e /etc/asound.conf ]] +- then +- echo "!!ALSA configuration files" >> $FILE +- echo "!!------------------------" >> $FILE +- echo "" >> $FILE +- +- #Check for ~/.asoundrc +- if [[ -e $HOME/.asoundrc ]] +- then +- echo "!!User specific config file ($HOME/.asoundrc)" >> $FILE +- echo "" >> $FILE +- cat $HOME/.asoundrc >> $FILE +- echo "" >> $FILE +- echo "" >> $FILE +- fi +- +- #Check for /etc/asound.conf +- if [[ -e /etc/asound.conf ]] +- then +- echo "!!System wide config file (/etc/asound.conf)" >> $FILE +- echo "" >> $FILE +- cat /etc/asound.conf >> $FILE +- echo "" >> $FILE +- echo "" >> $FILE +- fi +- fi + ;; + --stdout) + UPLOAD="no" +-- +2.24.1 + + +From e9e3c3a27d4faad0000a10386da471227b0644d8 Mon Sep 17 00:00:00 2001 +From: David Ward +Date: Sat, 21 Dec 2019 00:32:05 -0500 +Subject: [PATCH 20/31] alsa-info.sh: Exit script after writing information to + stdout + +The '--stdout' option is mutually exclusive with uploading the file. + +Signed-off-by: David Ward +Signed-off-by: Takashi Iwai +--- + alsa-info/alsa-info.sh | 17 ++++++----------- + 1 file changed, 6 insertions(+), 11 deletions(-) + +diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh +index bf353de..372d7ae 100755 +--- a/alsa-info/alsa-info.sh ++++ b/alsa-info/alsa-info.sh +@@ -349,9 +349,7 @@ case "$1" in + ;; + --stdout) + DIALOG="" +- UPLOAD="no" + WELCOME="no" +- TOSTDOUT="yes" + ;; + esac + done +@@ -720,6 +718,7 @@ if [ -n "$1" ]; then + fi + cat $FILE + rm $FILE ++ exit + ;; + --about) + echo "Written/Tested by the following users of #alsa on irc.freenode.net:" +@@ -793,10 +792,8 @@ fi + + if [ "$UPLOAD" = "no" ]; then + +- if [ -z "$TOSTDOUT" ]; then +- mv -f $FILE $NFILE || exit 1 +- KEEP_OUTPUT="yes" +- fi ++ mv -f $FILE $NFILE || exit 1 ++ KEEP_OUTPUT="yes" + + if [[ -n $DIALOG ]] + then +@@ -815,11 +812,9 @@ if [ "$UPLOAD" = "no" ]; then + echo "Your ALSA information is in $NFILE" + echo "" + else +- if [ -z "$TOSTDOUT" ]; then +- echo "" +- echo "Your ALSA information is in $NFILE" +- echo "" +- fi ++ echo "" ++ echo "Your ALSA information is in $NFILE" ++ echo "" + fi + fi + +-- +2.24.1 + + +From d928f7667cfead36b33f38ad7668ca96c6045d4e Mon Sep 17 00:00:00 2001 +From: David Ward +Date: Sat, 21 Dec 2019 00:32:06 -0500 +Subject: [PATCH 21/31] alsa-info.sh: Replace gauge with infobox for upload + dialog + +The gauge did not actually show the upload progress; in fact, the +dialog did not even appear until after the upload was completed. + +Use an infobox instead, which will be displayed while wget runs. + +Signed-off-by: David Ward +Signed-off-by: Takashi Iwai +--- + alsa-info/alsa-info.sh | 12 ++---------- + 1 file changed, 2 insertions(+), 10 deletions(-) + +diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh +index 372d7ae..a02864d 100755 +--- a/alsa-info/alsa-info.sh ++++ b/alsa-info/alsa-info.sh +@@ -830,19 +830,11 @@ if [[ -n $DIALOG ]] + then + + if [[ -z $PASTEBIN ]]; then ++ dialog --backtitle "$BGTITLE" --infobox "Uploading information to www.alsa-project.org ..." 6 70 + wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://www.alsa-project.org/cardinfo-db/" &>$TEMPDIR/wget.tmp || echo "Upload failed; exit" +- { for i in 10 20 30 40 50 60 70 80 90; do +- echo $i +- sleep 0.2 +- done +- echo; } |dialog --backtitle "$BGTITLE" --guage "Uploading information to www.alsa-project.org ..." 6 70 0 + else ++ dialog --backtitle "$BGTITLE" --infobox "Uploading information to www.pastebin.ca ..." 6 70 + wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://pastebin.ca/quiet-paste.php?api=$PASTEBINKEY&encrypt=t&encryptpw=blahblah" &>$TEMPDIR/wget.tmp || echo "Upload failed; exit" +- { for i in 10 20 30 40 50 60 70 80 90; do +- echo $i +- sleep 0.2 +- done +- echo; } |dialog --backtitle "$BGTITLE" --guage "Uploading information to www.pastebin.ca ..." 6 70 0 + fi + + dialog --backtitle "$BGTITLE" --title "Information uploaded" --yesno "Would you like to see the uploaded information?" 5 100 +-- +2.24.1 + + +From 1ebe877b8d89c74e76efd47f2a4dba6cfccf86af Mon Sep 17 00:00:00 2001 +From: David Ward +Date: Sat, 21 Dec 2019 00:32:07 -0500 +Subject: [PATCH 22/31] alsa-info.sh: Remove progress spinner during upload + without dialog + +The spinner did not actually provide information about the status +of the file upload, and caused other problems: it would repeatedly +spawn new pgrep processes (without a delay between them), and it +blocked the script if any wget process was running on the system. + +Signed-off-by: David Ward +Signed-off-by: Takashi Iwai +--- + alsa-info/alsa-info.sh | 11 +---------- + 1 file changed, 1 insertion(+), 10 deletions(-) + +diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh +index a02864d..9bc8c38 100755 +--- a/alsa-info/alsa-info.sh ++++ b/alsa-info/alsa-info.sh +@@ -857,16 +857,7 @@ else + wget -O - --tries=5 --timeout=60 --post-file=$FILE http://pastebin.ca/quiet-paste.php?api=$PASTEBINKEY &>$TEMPDIR/wget.tmp & + fi + +-#Progess spinner for wget transfer. +-i=1 +-sp="/-\|" +-echo -n ' ' +-while pgrep wget &>/dev/null +-do +- echo -en "\b${sp:i++%${#sp}:1}" +-done +- +-echo -e "\b Done!" ++echo -e " Done!" + echo "" + + fi # dialog +-- +2.24.1 + + +From ad49ee756bbc355aa2cf7e9931c81fde17a50913 Mon Sep 17 00:00:00 2001 +From: David Ward +Date: Sat, 21 Dec 2019 00:32:08 -0500 +Subject: [PATCH 23/31] alsa-info.sh: Condense nested commands for file upload + +Signed-off-by: David Ward +Signed-off-by: Takashi Iwai +--- + alsa-info/alsa-info.sh | 16 ++++++---------- + 1 file changed, 6 insertions(+), 10 deletions(-) + +diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh +index 9bc8c38..7560b0d 100755 +--- a/alsa-info/alsa-info.sh ++++ b/alsa-info/alsa-info.sh +@@ -828,15 +828,19 @@ then + + if [[ -n $DIALOG ]] + then ++ dialog --backtitle "$BGTITLE" --infobox "Uploading information to $WWWSERVICE ..." 6 70 ++else ++ echo -n "Uploading information to $WWWSERVICE ..." ++fi + + if [[ -z $PASTEBIN ]]; then +- dialog --backtitle "$BGTITLE" --infobox "Uploading information to www.alsa-project.org ..." 6 70 + wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://www.alsa-project.org/cardinfo-db/" &>$TEMPDIR/wget.tmp || echo "Upload failed; exit" + else +- dialog --backtitle "$BGTITLE" --infobox "Uploading information to www.pastebin.ca ..." 6 70 + wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://pastebin.ca/quiet-paste.php?api=$PASTEBINKEY&encrypt=t&encryptpw=blahblah" &>$TEMPDIR/wget.tmp || echo "Upload failed; exit" + fi + ++if [ -n "$DIALOG" ]; then ++ + dialog --backtitle "$BGTITLE" --title "Information uploaded" --yesno "Would you like to see the uploaded information?" 5 100 + DIALOG_EXIT_CODE=$? + if [ $DIALOG_EXIT_CODE = 0 ]; then +@@ -849,14 +853,6 @@ clear + # no dialog + else + +-if [[ -z $PASTEBIN ]]; then +- echo -n "Uploading information to www.alsa-project.org ... " +- wget -O - --tries=5 --timeout=60 --post-file=$FILE http://www.alsa-project.org/cardinfo-db/ &>$TEMPDIR/wget.tmp & +-else +- echo -n "Uploading information to www.pastebin.ca ... " +- wget -O - --tries=5 --timeout=60 --post-file=$FILE http://pastebin.ca/quiet-paste.php?api=$PASTEBINKEY &>$TEMPDIR/wget.tmp & +-fi +- + echo -e " Done!" + echo "" + +-- +2.24.1 + + +From f93d491a08c7a5c34642aac166d0329c27eaa502 Mon Sep 17 00:00:00 2001 +From: David Ward +Date: Sat, 21 Dec 2019 00:32:09 -0500 +Subject: [PATCH 24/31] alsa-info.sh: Condense nested commands for formatting + upload result + +Signed-off-by: David Ward +Signed-off-by: Takashi Iwai +--- + alsa-info/alsa-info.sh | 20 ++++++++------------ + 1 file changed, 8 insertions(+), 12 deletions(-) + +diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh +index 7560b0d..8b4745b 100755 +--- a/alsa-info/alsa-info.sh ++++ b/alsa-info/alsa-info.sh +@@ -858,19 +858,15 @@ echo "" + + fi # dialog + +-# See if tput is available, and use it if it is. +-if [ -n "$TPUT" ]; then +- if [[ -z $PASTEBIN ]]; then +- FINAL_URL=$(tput setaf 1; grep "SUCCESS:" $TEMPDIR/wget.tmp | cut -d ' ' -f 2 ; tput sgr0) +- else +- FINAL_URL=$(tput setaf 1; grep "SUCCESS:" $TEMPDIR/wget.tmp | sed -n 's/.*\:\([0-9]\+\).*/http:\/\/pastebin.ca\/\1/p'; tput sgr0) +- fi ++if [ -z "$PASTEBIN" ]; then ++ FINAL_URL=$(grep "SUCCESS:" $TEMPDIR/wget.tmp | cut -d ' ' -f 2) + else +- if [[ -z $PASTEBIN ]]; then +- FINAL_URL=$(grep "SUCCESS:" $TEMPDIR/wget.tmp | cut -d ' ' -f 2) +- else +- FINAL_URL=$(grep "SUCCESS:" $TEMPDIR/wget.tmp | sed -n 's/.*\:\([0-9]\+\).*/http:\/\/pastebin.ca\/\1/p') +- fi ++ FINAL_URL=$(grep "SUCCESS:" $TEMPDIR/wget.tmp | sed -n 's/.*\:\([0-9]\+\).*/http:\/\/pastebin.ca\/\1/p') ++fi ++ ++# See if tput is available, and use it if it is. ++if [ -x "$TPUT" ]; then ++ FINAL_URL=$(tput setaf 1; printf '%s' "$FINAL_URL"; tput sgr0) + fi + + # Output the URL of the uploaded file. +-- +2.24.1 + + +From fe322c46e6c2ae6ce130eed70f33a42fc4f6295a Mon Sep 17 00:00:00 2001 +From: David Ward +Date: Sat, 21 Dec 2019 00:32:10 -0500 +Subject: [PATCH 25/31] alsa-info.sh: Perform test for wget earlier + +If wget is not present, do not ask about uploading the information. + +Signed-off-by: David Ward +Signed-off-by: Takashi Iwai +--- + alsa-info/alsa-info.sh | 73 ++++++++++++++++++++---------------------- + 1 file changed, 35 insertions(+), 38 deletions(-) + +diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh +index 8b4745b..399d662 100755 +--- a/alsa-info/alsa-info.sh ++++ b/alsa-info/alsa-info.sh +@@ -769,6 +769,41 @@ if [ -z "$WITHALL" ]; then + withall + fi + ++# Check if wget is installed, and supports --post-file. ++if ! wget --help 2>/dev/null | grep -q post-file; then ++ # We couldn't find a suitable wget. If --upload was passed, tell the user to upload manually. ++ if [ "$UPLOAD" != "yes" ]; then ++ : ++ elif [ -n "$DIALOG" ]; then ++ if [ -z "$PASTEBIN" ]; then ++ dialog --backtitle "$BGTITLE" --msgbox "Could not automatically upload output to http://www.alsa-project.org.\nPossible reasons are:\n\n 1. Couldn't find 'wget' in your PATH\n 2. Your version of wget is less than 1.8.2\n\nPlease manually upload $NFILE to http://www.alsa-project.org/cardinfo-db/ and submit your post." 25 100 ++ else ++ dialog --backtitle "$BGTITLE" --msgbox "Could not automatically upload output to http://www.pastebin.ca.\nPossible reasons are:\n\n 1. Couldn't find 'wget' in your PATH\n 2. Your version of wget is less than 1.8.2\n\nPlease manually upload $NFILE to http://www.pastebin.ca/upload.php and submit your post." 25 100 ++ fi ++ else ++ if [ -z "$PASTEBIN" ]; then ++ echo "" ++ echo "Could not automatically upload output to http://www.alsa-project.org" ++ echo "Possible reasons are:" ++ echo " 1. Couldn't find 'wget' in your PATH" ++ echo " 2. Your version of wget is less than 1.8.2" ++ echo "" ++ echo "Please manually upload $NFILE to http://www.alsa-project.org/cardinfo-db/ and submit your post." ++ echo "" ++ else ++ echo "" ++ echo "Could not automatically upload output to http://www.pastebin.ca" ++ echo "Possible reasons are:" ++ echo " 1. Couldn't find 'wget' in your PATH" ++ echo " 2. Your version of wget is less than 1.8.2" ++ echo "" ++ echo "Please manually upload $NFILE to http://www.pastebin.ca/upload.php and submit your post." ++ echo "" ++ fi ++ fi ++ UPLOAD="no" ++fi ++ + if [ "$UPLOAD" = "ask" ]; then + if [ -n "$DIALOG" ]; then + dialog --backtitle "$BGTITLE" --title "Information collected" --yes-label " UPLOAD / SHARE " --no-label " SAVE LOCALLY " --defaultno --yesno "\n\nAutomatically upload ALSA information to $WWWSERVICE?" 10 80 +@@ -822,10 +857,6 @@ if [ "$UPLOAD" = "no" ]; then + + fi # UPLOAD + +-# Test that wget is installed, and supports --post-file. Upload $FILE if it does, and prompt user to upload file if it does not. +-if [[ -n "${WGET}" ]] && [[ -x "${WGET}" ]] && [[ $(wget --help | grep post-file) ]] +-then +- + if [[ -n $DIALOG ]] + then + dialog --backtitle "$BGTITLE" --infobox "Uploading information to $WWWSERVICE ..." 6 70 +@@ -873,37 +904,3 @@ fi + echo "Your ALSA information is located at $FINAL_URL" + echo "Please inform the person helping you." + echo "" +- +-# We couldnt find a suitable wget, so tell the user to upload manually. +-else +- mv -f $FILE $NFILE || exit 1 +- KEEP_OUTPUT="yes" +- if [[ -z $DIALOG ]] +- then +- if [[ -z $PASTEBIN ]]; then +- echo "" +- echo "Could not automatically upload output to http://www.alsa-project.org" +- echo "Possible reasons are:" +- echo " 1. Couldnt find 'wget' in your PATH" +- echo " 2. Your version of wget is less than 1.8.2" +- echo "" +- echo "Please manually upload $NFILE to http://www.alsa-project.org/cardinfo-db/ and submit your post." +- echo "" +- else +- echo "" +- echo "Could not automatically upload output to http://www.pastebin.ca" +- echo "Possible reasons are:" +- echo " 1. Couldnt find 'wget' in your PATH" +- echo " 2. Your version of wget is less than 1.8.2" +- echo "" +- echo "Please manually upload $NFILE to http://www.pastebin.ca/upload.php and submit your post." +- echo "" +- fi +- else +- if [[ -z $PASTEBIN ]]; then +- dialog --backtitle "$BGTITLE" --msgbox "Could not automatically upload output to http://www.alsa-project.org.\nPossible reasons are:\n\n 1. Couldn't find 'wget' in your PATH\n 2. Your version of wget is less than 1.8.2\n\nPlease manually upload $NFILE to http://www.alsa-project,org/cardinfo-db/ and submit your post." 25 100 +- else +- dialog --backtitle "$BGTITLE" --msgbox "Could not automatically upload output to http://www.pastebin.ca.\nPossible reasons are:\n\n 1. Couldn't find 'wget' in your PATH\n 2. Your version of wget is less than 1.8.2\n\nPlease manually upload $NFILE to http://www.pastebin.ca/upload.php and submit your post." 25 100 +- fi +- fi +-fi +-- +2.24.1 + + +From 27b5c6c19c8d3b4e994f258dc5e51571726ff924 Mon Sep 17 00:00:00 2001 +From: David Ward +Date: Sat, 21 Dec 2019 00:32:11 -0500 +Subject: [PATCH 26/31] alsa-info.sh: Warn after actual upload failure; do not + ping server + +Check the return value of wget to determine if the upload actually +failed. If so, display the message about upload failure, then exit. + +Do not ping the web server; the result does not indicate whether a +file upload will succeed or not. + +Signed-off-by: David Ward +Signed-off-by: Takashi Iwai +--- + alsa-info/alsa-info.sh | 58 ++++++++++++++++++------------------------ + 1 file changed, 25 insertions(+), 33 deletions(-) + +diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh +index 399d662..7bae30a 100755 +--- a/alsa-info/alsa-info.sh ++++ b/alsa-info/alsa-info.sh +@@ -35,22 +35,12 @@ BGTITLE="ALSA-Info v $SCRIPT_VERSION" + PASTEBINKEY="C9cRIO8m/9y8Cs0nVs0FraRx7U0pHsuc" + + WGET=$(which wget 2>/dev/null | sed 's|^[^/]*||' 2>/dev/null) +-REQUIRES="mktemp grep pgrep whereis ping awk date uname cat sort dmesg amixer alsactl" ++REQUIRES="mktemp grep pgrep whereis awk date uname cat sort dmesg amixer alsactl" + + # + # Define some simple functions + # + +-pbcheck() { +- [[ $UPLOAD = "no" ]] && return +- +- if [[ -z $PASTEBIN ]]; then +- [[ $(ping -c1 www.alsa-project.org) ]] || KEEP_FILES="yes" UPLOAD="no" PBERROR="yes" +- else +- [[ $(ping -c1 www.pastebin.ca) ]] || KEEP_FILES="yes" UPLOAD="no" PBERROR="yes" +- fi +-} +- + update() { + test -z "$WGET" -o ! -x "$WGET" && return + +@@ -650,7 +640,6 @@ fi + #If no command line options are specified, then run as though --with-all was specified + if [ -z "$1" ]; then + update +- pbcheck + fi + + fi # proceed +@@ -662,7 +651,6 @@ if [ -n "$1" ]; then + case "$1" in + --pastebin) + update +- pbcheck + ;; + --update) + update +@@ -832,25 +820,11 @@ if [ "$UPLOAD" = "no" ]; then + + if [[ -n $DIALOG ]] + then +- if [[ -n $PBERROR ]]; then +- dialog --backtitle "$BGTITLE" --title "Information collected" --msgbox "An error occurred while contacting the $WWWSERVICE.\n Your information was NOT automatically uploaded.\n\nYour ALSA information is in $NFILE" 10 100 +- else +- dialog --backtitle "$BGTITLE" --title "Information collected" --msgbox "\n\nYour ALSA information is in $NFILE" 10 60 +- fi ++ dialog --backtitle "$BGTITLE" --title "Information collected" --msgbox "\n\nYour ALSA information is in $NFILE" 10 60 + else +- echo +- +- if [[ -n $PBERROR ]]; then +- echo "An error occurred while contacting the $WWWSERVICE." +- echo "Your information was NOT automatically uploaded." +- echo "" +- echo "Your ALSA information is in $NFILE" +- echo "" +- else +- echo "" +- echo "Your ALSA information is in $NFILE" +- echo "" +- fi ++ echo "" ++ echo "Your ALSA information is in $NFILE" ++ echo "" + fi + + exit +@@ -865,9 +839,27 @@ else + fi + + if [[ -z $PASTEBIN ]]; then +- wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://www.alsa-project.org/cardinfo-db/" &>$TEMPDIR/wget.tmp || echo "Upload failed; exit" ++ wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://www.alsa-project.org/cardinfo-db/" &>$TEMPDIR/wget.tmp + else +- wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://pastebin.ca/quiet-paste.php?api=$PASTEBINKEY&encrypt=t&encryptpw=blahblah" &>$TEMPDIR/wget.tmp || echo "Upload failed; exit" ++ wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://pastebin.ca/quiet-paste.php?api=$PASTEBINKEY&encrypt=t&encryptpw=blahblah" &>$TEMPDIR/wget.tmp ++fi ++ ++if [ $? -ne 0 ]; then ++ mv -f $FILE $NFILE || exit 1 ++ KEEP_OUTPUT="yes" ++ ++ if [ -n "$DIALOG" ]; then ++ dialog --backtitle "$BGTITLE" --title "Information not uploaded" --msgbox "An error occurred while contacting $WWWSERVICE.\n Your information was NOT automatically uploaded.\n\nYour ALSA information is in $NFILE" 10 100 ++ else ++ echo "" ++ echo "An error occurred while contacting $WWWSERVICE." ++ echo "Your information was NOT automatically uploaded." ++ echo "" ++ echo "Your ALSA information is in $NFILE" ++ echo "" ++ fi ++ ++ exit + fi + + if [ -n "$DIALOG" ]; then +-- +2.24.1 + + +From cbabe7a3f0cc84ecd352d4cbf85148946fa6c0d5 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 19 Dec 2019 15:36:05 +0100 +Subject: [PATCH 27/31] alsatplg: rewrite to use the new libatopology functions + +Add '-u,--dump' operation. +Add '-g,--group' and '-x,--nocheck' modifiers. +Add '-z,--dapm-nosort' modifier. +Allow to operate with stdin/stdout for the file input/output. + +Signed-off-by: Jaroslav Kysela +--- + topology/alsatplg.rst | 17 ++- + topology/topology.c | 304 +++++++++++++++++++++++++----------------- + 2 files changed, 199 insertions(+), 122 deletions(-) + +diff --git a/topology/alsatplg.rst b/topology/alsatplg.rst +index 855edff..e09c865 100644 +--- a/topology/alsatplg.rst ++++ b/topology/alsatplg.rst +@@ -50,12 +50,27 @@ Available options: + **-c**, **--compile** `FILE` + source configuration file for the compilation + ++ **-n**, **--normalize** `FILE` ++ parse and save the configuration file in the normalized format ++ ++ **-u**, **--dump** `FILE` ++ parse and save the configuration file in the specified format ++ + **-o**, **--output** `FILE` +- output binary file ++ output file + + **-v**, **--verbose** `LEVEL` + set verbose level + ++ **-s**, **--sort** ++ sort the configuration identifiers (set for normalization) ++ ++ **-x**, **--nocheck** ++ save the configuration without additional integrity check ++ ++ **-z**, **--dapm-nosort** ++ do not sort DAPM graph items (like in version 1.2.1-) ++ + + FILES + ===== +diff --git a/topology/topology.c b/topology/topology.c +index bc5797c..a94941a 100644 +--- a/topology/topology.c ++++ b/topology/topology.c +@@ -1,4 +1,5 @@ + /* ++ Copyright(c) 2019 Red Hat Inc. + Copyright(c) 2014-2015 Intel Corporation + Copyright(c) 2010-2011 Texas Instruments Incorporated, + All rights reserved. +@@ -44,165 +45,205 @@ _("Usage: %s [OPTIONS]...\n" + "-h, --help help\n" + "-c, --compile=FILE compile file\n" + "-n, --normalize=FILE normalize file\n" ++"-u, --dump=FILE dump (reparse) file\n" + "-v, --verbose=LEVEL set verbosity level (0...1)\n" + "-o, --output=FILE set output file\n" + "-s, --sort sort the identifiers in the normalized output\n" ++"-g, --group save configuration by group indexes\n" ++"-x, --nocheck save configuration without additional integrity checks\n" + ), name); + } + +-static int _compar(const void *a, const void *b) ++static int load(snd_tplg_t **tplg, const char *source_file, int cflags) + { +- const snd_config_t *c1 = *(snd_config_t **)a; +- const snd_config_t *c2 = *(snd_config_t **)b; +- const char *id1, *id2; +- if (snd_config_get_id(c1, &id1)) return 0; +- if (snd_config_get_id(c2, &id2)) return 0; +- return strcmp(id1, id2); +-} ++ int fd, err; ++ char *buf, *buf2; ++ size_t size, pos; ++ ssize_t r; + +-static snd_config_t *normalize_config(const char *id, snd_config_t *src, int sort) +-{ +- snd_config_t *dst, **a; +- snd_config_iterator_t i, next; +- int index, count; +- +- if (snd_config_get_type(src) != SND_CONFIG_TYPE_COMPOUND) { +- if (snd_config_copy(&dst, src) >= 0) +- return dst; +- return NULL; +- } +- count = 0; +- snd_config_for_each(i, next, src) +- count++; +- a = malloc(sizeof(dst) * count); +- if (a == NULL) +- return NULL; +- index = 0; +- snd_config_for_each(i, next, src) { +- snd_config_t *s = snd_config_iterator_entry(i); +- a[index++] = s; +- } +- if (sort) +- qsort(a, count, sizeof(a[0]), _compar); +- if (snd_config_make_compound(&dst, id, count == 1)) { +- free(a); +- return NULL; +- } +- for (index = 0; index < count; index++) { +- snd_config_t *s = a[index]; +- const char *id2; +- if (snd_config_get_id(s, &id2)) { +- snd_config_delete(dst); +- free(a); +- return NULL; +- } +- s = normalize_config(id2, s, sort); +- if (s == NULL || snd_config_add(dst, s)) { +- if (s) +- snd_config_delete(s); +- snd_config_delete(dst); +- free(a); +- return NULL; ++ if (strcmp(source_file, "-") == 0) { ++ fd = fileno(stdin); ++ } else { ++ fd = open(source_file, O_RDONLY); ++ if (fd < 0) { ++ fprintf(stderr, _("Unable to open input file '%s': %s\n"), ++ source_file, strerror(-errno)); ++ return 1; + } + } +- free(a); +- return dst; +-} + +-static int compile(const char *source_file, const char *output_file, int verbose) +-{ +- snd_tplg_t *snd_tplg; +- int err; ++ size = 16*1024; ++ pos = 0; ++ buf = malloc(size); ++ if (buf == NULL) ++ goto _nomem; ++ while (1) { ++ r = read(fd, buf + pos, size - pos); ++ if (r < 0 && (errno == EAGAIN || errno == EINTR)) ++ continue; ++ if (r <= 0) ++ break; ++ pos += r; ++ size += 8*1024; ++ buf2 = realloc(buf, size); ++ if (buf2 == NULL) { ++ free(buf); ++ goto _nomem; ++ } ++ buf = buf2; ++ } ++ if (fd != fileno(stdin)) ++ close(fd); ++ if (r < 0) { ++ fprintf(stderr, _("Read error: %s\n"), strerror(-errno)); ++ free(buf); ++ goto _err; ++ } + +- snd_tplg = snd_tplg_new(); +- if (snd_tplg == NULL) { ++ *tplg = snd_tplg_create(cflags); ++ if (*tplg == NULL) { + fprintf(stderr, _("failed to create new topology context\n")); ++ free(buf); + return 1; + } + +- snd_tplg_verbose(snd_tplg, verbose); +- +- err = snd_tplg_build_file(snd_tplg, source_file, output_file); ++ err = snd_tplg_load(*tplg, buf, pos); ++ free(buf); + if (err < 0) { +- fprintf(stderr, _("failed to compile context %s\n"), source_file); +- snd_tplg_free(snd_tplg); +- unlink(output_file); ++ fprintf(stderr, _("Unable to load configuration: %s\n"), ++ snd_strerror(-err)); ++ snd_tplg_free(*tplg); + return 1; + } + +- snd_tplg_free(snd_tplg); ++ return 0; ++ ++_nomem: ++ fprintf(stderr, _("No enough memory\n")); ++_err: ++ if (fd != fileno(stdin)) ++ close(fd); ++ free(buf); + return 1; + } + +-static int normalize(const char *source_file, const char *output_file, int sort) ++static int save(const char *output_file, void *buf, size_t size) + { +- snd_input_t *input; +- snd_output_t *output; +- snd_config_t *top, *norm; +- int err; ++ char *fname = NULL; ++ int fd; ++ ssize_t r; + +- err = snd_input_stdio_open(&input, source_file, "r"); +- if (err < 0) { +- fprintf(stderr, "Unable to open source file '%s': %s\n", source_file, snd_strerror(-err)); +- return 0; ++ if (strcmp(output_file, "-") == 0) { ++ fd = fileno(stdout); ++ } else { ++ fname = alloca(strlen(output_file) + 5); ++ strcpy(fname, output_file); ++ strcat(fname, ".new"); ++ fd = open(fname, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); ++ if (fd < 0) { ++ fprintf(stderr, _("Unable to open output file '%s': %s\n"), ++ fname, strerror(-errno)); ++ return 1; ++ } + } + +- err = snd_config_top(&top); +- if (err < 0) { +- snd_input_close(input); +- return 1; ++ r = 0; ++ while (size > 0) { ++ r = write(fd, buf, size); ++ if (r < 0 && (errno == EAGAIN || errno == EINTR)) ++ continue; ++ if (r < 0) ++ break; ++ size -= r; ++ buf += r; + } + +- err = snd_config_load(top, input); +- snd_input_close(input); +- if (err < 0) { +- snd_config_delete(top); +- fprintf(stderr, "Unable to parse source file '%s': %s\n", source_file, snd_strerror(-err)); +- snd_config_delete(top); ++ if (r < 0) { ++ fprintf(stderr, _("Write error: %s\n"), strerror(-errno)); ++ if (fd != fileno(stdout)) { ++ remove(fname); ++ close(fd); ++ } + return 1; + } + +- err = snd_output_stdio_open(&output, output_file, "w+"); +- if (err < 0) { +- fprintf(stderr, "Unable to open output file '%s': %s\n", output_file, snd_strerror(-err)); +- snd_config_delete(top); +- return 1; +- } ++ if (fd != fileno(stdout)) ++ close(fd); + +- norm = normalize_config(NULL, top, sort); +- if (norm == NULL) { +- fprintf(stderr, "Unable to normalize configuration (out of memory?)\n"); +- snd_output_close(output); +- snd_config_delete(top); ++ if (fname && rename(fname, output_file)) { ++ fprintf(stderr, _("Unable to rename file '%s' to '%s': %s\n"), ++ fname, output_file, strerror(-errno)); + return 1; + } + +- err = snd_config_save(norm, output); +- snd_output_close(output); +- snd_config_delete(norm); +- snd_config_delete(top); ++ return 0; ++} ++ ++static int dump(const char *source_file, const char *output_file, int cflags, int sflags) ++{ ++ snd_tplg_t *tplg; ++ char *text; ++ int err; ++ ++ err = load(&tplg, source_file, cflags); ++ if (err) ++ return err; ++ err = snd_tplg_save(tplg, &text, sflags); ++ snd_tplg_free(tplg); + if (err < 0) { +- fprintf(stderr, "Unable to save normalized contents: %s\n", snd_strerror(-err)); ++ fprintf(stderr, _("Unable to save parsed configuration: %s\n"), ++ snd_strerror(-err)); + return 1; + } ++ err = save(output_file, text, strlen(text)); ++ free(text); ++ return err; ++} + +- return 0; ++static int compile(const char *source_file, const char *output_file, int cflags) ++{ ++ snd_tplg_t *tplg; ++ void *bin; ++ size_t size; ++ int err; ++ ++ err = load(&tplg, source_file, cflags); ++ if (err) ++ return err; ++ err = snd_tplg_build_bin(tplg, &bin, &size); ++ snd_tplg_free(tplg); ++ if (err < 0 || size == 0) { ++ fprintf(stderr, _("failed to compile context %s\n"), source_file); ++ return 1; ++ } ++ err = save(output_file, bin, size); ++ free(bin); ++ return err; + } + ++#define OP_COMPILE 1 ++#define OP_NORMALIZE 2 ++#define OP_DUMP 3 ++ + int main(int argc, char *argv[]) + { +- static const char short_options[] = "hc:n:v:o:s"; ++ static const char short_options[] = "hc:n:u:v:o:sgxz"; + static const struct option long_options[] = { + {"help", 0, NULL, 'h'}, + {"verbose", 1, NULL, 'v'}, + {"compile", 1, NULL, 'c'}, + {"normalize", 1, NULL, 'n'}, ++ {"dump", 1, NULL, 'u'}, + {"output", 1, NULL, 'o'}, + {"sort", 0, NULL, 's'}, ++ {"group", 0, NULL, 'g'}, ++ {"nocheck", 0, NULL, 'x'}, ++ {"dapm-nosort", 0, NULL, 'z'}, + {0, 0, 0, 0}, + }; +- char *source_file = NULL, *normalize_file = NULL, *output_file = NULL; +- int c, err, verbose = 0, sort = 0, option_index; ++ char *source_file = NULL; ++ char *output_file = NULL; ++ int c, err, op = 'c', cflags = 0, sflags = 0, option_index; + + #ifdef ENABLE_NLS + setlocale(LC_ALL, ""); +@@ -218,19 +259,32 @@ int main(int argc, char *argv[]) + usage(argv[0]); + return 0; + case 'v': +- verbose = atoi(optarg); ++ cflags |= SND_TPLG_CREATE_VERBOSE; + break; +- case 'c': +- source_file = optarg; ++ case 'z': ++ cflags |= SND_TPLG_CREATE_DAPM_NOSORT; + break; ++ case 'c': + case 'n': +- normalize_file = optarg; ++ case 'u': ++ if (source_file) { ++ fprintf(stderr, _("Cannot combine operations (compile, normalize, dump)\n")); ++ return 1; ++ } ++ source_file = optarg; ++ op = c; + break; + case 'o': + output_file = optarg; + break; + case 's': +- sort = 1; ++ sflags |= SND_TPLG_SAVE_SORT; ++ break; ++ case 'g': ++ sflags |= SND_TPLG_SAVE_GROUPS; ++ break; ++ case 'x': ++ sflags |= SND_TPLG_SAVE_NOCHECK; + break; + default: + fprintf(stderr, _("Try `%s --help' for more information.\n"), argv[0]); +@@ -238,21 +292,29 @@ int main(int argc, char *argv[]) + } + } + +- if (source_file && normalize_file) { +- fprintf(stderr, "Cannot normalize and compile at a time!\n"); ++ if (source_file == NULL || output_file == NULL) { ++ usage(argv[0]); + return 1; + } + +- if ((source_file == NULL && normalize_file == NULL) || output_file == NULL) { +- usage(argv[0]); +- return 1; ++ if (op == 'n') { ++ if (sflags != 0 && sflags != SND_TPLG_SAVE_SORT) { ++ fprintf(stderr, _("Wrong parameters for the normalize operation!\n")); ++ return 1; ++ } ++ /* normalize has predefined output */ ++ sflags = SND_TPLG_SAVE_SORT; + } + +- if (source_file) +- err = compile(source_file, output_file, verbose); +- else +- err = normalize(normalize_file, output_file, sort); ++ switch (op) { ++ case 'c': ++ err = compile(source_file, output_file, cflags); ++ break; ++ default: ++ err = dump(source_file, output_file, cflags, sflags); ++ break; ++ } + + snd_output_close(log); +- return 0; ++ return err ? 1 : 0; + } +-- +2.24.1 + + +From 32e7016fd710f6ed9d514100c7c05453974036d0 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 20 Dec 2019 15:23:27 +0100 +Subject: [PATCH 28/31] alsatplg: add -V,--version option + +Signed-off-by: Jaroslav Kysela +--- + topology/alsatplg.rst | 3 +++ + topology/topology.c | 20 ++++++++++++++++++-- + 2 files changed, 21 insertions(+), 2 deletions(-) + +diff --git a/topology/alsatplg.rst b/topology/alsatplg.rst +index e09c865..260454b 100644 +--- a/topology/alsatplg.rst ++++ b/topology/alsatplg.rst +@@ -47,6 +47,9 @@ Available options: + **-h**, **--help** + this help + ++ **-V**, **--version** ++ show the utility version and versions of used libraries ++ + **-c**, **--compile** `FILE` + source configuration file for the compilation + +diff --git a/topology/topology.c b/topology/topology.c +index a94941a..101f8cc 100644 +--- a/topology/topology.c ++++ b/topology/topology.c +@@ -34,10 +34,11 @@ + #include + #include + #include "gettext.h" ++#include "version.h" + + static snd_output_t *log; + +-static void usage(char *name) ++static void usage(const char *name) + { + printf( + _("Usage: %s [OPTIONS]...\n" +@@ -51,9 +52,20 @@ _("Usage: %s [OPTIONS]...\n" + "-s, --sort sort the identifiers in the normalized output\n" + "-g, --group save configuration by group indexes\n" + "-x, --nocheck save configuration without additional integrity checks\n" ++"-V, --version print version\n" + ), name); + } + ++static void version(const char *name) ++{ ++ printf( ++_("%s version %s\n" ++"libasound version %s\n" ++"libatopology version %s\n" ++), name, SND_UTIL_VERSION_STR, ++ snd_asoundlib_version(), snd_tplg_version()); ++} ++ + static int load(snd_tplg_t **tplg, const char *source_file, int cflags) + { + int fd, err; +@@ -227,7 +239,7 @@ static int compile(const char *source_file, const char *output_file, int cflags) + + int main(int argc, char *argv[]) + { +- static const char short_options[] = "hc:n:u:v:o:sgxz"; ++ static const char short_options[] = "hc:n:u:v:o:sgxzV"; + static const struct option long_options[] = { + {"help", 0, NULL, 'h'}, + {"verbose", 1, NULL, 'v'}, +@@ -239,6 +251,7 @@ int main(int argc, char *argv[]) + {"group", 0, NULL, 'g'}, + {"nocheck", 0, NULL, 'x'}, + {"dapm-nosort", 0, NULL, 'z'}, ++ {"version", 0, NULL, 'V'}, + {0, 0, 0, 0}, + }; + char *source_file = NULL; +@@ -286,6 +299,9 @@ int main(int argc, char *argv[]) + case 'x': + sflags |= SND_TPLG_SAVE_NOCHECK; + break; ++ case 'V': ++ version(argv[0]); ++ return 0; + default: + fprintf(stderr, _("Try `%s --help' for more information.\n"), argv[0]); + return 1; +-- +2.24.1 + + +From 786c3ee8144893dfb56b35c46542d3ded78d746c Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Sun, 22 Dec 2019 15:44:56 +0100 +Subject: [PATCH 29/31] alsatplg: add decode command + +Signed-off-by: Jaroslav Kysela +--- + topology/alsatplg.rst | 3 ++ + topology/topology.c | 111 ++++++++++++++++++++++++++++++++---------- + 2 files changed, 87 insertions(+), 27 deletions(-) + +diff --git a/topology/alsatplg.rst b/topology/alsatplg.rst +index 260454b..56324d5 100644 +--- a/topology/alsatplg.rst ++++ b/topology/alsatplg.rst +@@ -53,6 +53,9 @@ Available options: + **-c**, **--compile** `FILE` + source configuration file for the compilation + ++ **-d**, **--decode** `FILE` ++ source binary topology file for the decode ++ + **-n**, **--normalize** `FILE` + parse and save the configuration file in the normalized format + +diff --git a/topology/topology.c b/topology/topology.c +index 101f8cc..91d2fce 100644 +--- a/topology/topology.c ++++ b/topology/topology.c +@@ -44,9 +44,10 @@ static void usage(const char *name) + _("Usage: %s [OPTIONS]...\n" + "\n" + "-h, --help help\n" +-"-c, --compile=FILE compile file\n" +-"-n, --normalize=FILE normalize file\n" +-"-u, --dump=FILE dump (reparse) file\n" ++"-c, --compile=FILE compile configuration file\n" ++"-d, --decode=FILE decode binary topology file\n" ++"-n, --normalize=FILE normalize configuration file\n" ++"-u, --dump=FILE dump (reparse) configuration file\n" + "-v, --verbose=LEVEL set verbosity level (0...1)\n" + "-o, --output=FILE set output file\n" + "-s, --sort sort the identifiers in the normalized output\n" +@@ -66,10 +67,10 @@ _("%s version %s\n" + snd_asoundlib_version(), snd_tplg_version()); + } + +-static int load(snd_tplg_t **tplg, const char *source_file, int cflags) ++static int load(const char *source_file, void **dst, size_t *dst_size) + { +- int fd, err; +- char *buf, *buf2; ++ int fd; ++ void *buf, *buf2; + size_t size, pos; + ssize_t r; + +@@ -112,15 +113,31 @@ static int load(snd_tplg_t **tplg, const char *source_file, int cflags) + goto _err; + } + ++ *dst = buf; ++ *dst_size = pos; ++ return 0; ++ ++_nomem: ++ fprintf(stderr, _("No enough memory\n")); ++_err: ++ if (fd != fileno(stdin)) ++ close(fd); ++ free(buf); ++ return 1; ++} ++ ++static int load_topology(snd_tplg_t **tplg, char *config, ++ size_t config_size, int cflags) ++{ ++ int err; ++ + *tplg = snd_tplg_create(cflags); + if (*tplg == NULL) { + fprintf(stderr, _("failed to create new topology context\n")); +- free(buf); + return 1; + } + +- err = snd_tplg_load(*tplg, buf, pos); +- free(buf); ++ err = snd_tplg_load(*tplg, config, config_size); + if (err < 0) { + fprintf(stderr, _("Unable to load configuration: %s\n"), + snd_strerror(-err)); +@@ -129,14 +146,6 @@ static int load(snd_tplg_t **tplg, const char *source_file, int cflags) + } + + return 0; +- +-_nomem: +- fprintf(stderr, _("No enough memory\n")); +-_err: +- if (fd != fileno(stdin)) +- close(fd); +- free(buf); +- return 1; + } + + static int save(const char *output_file, void *buf, size_t size) +@@ -194,10 +203,15 @@ static int save(const char *output_file, void *buf, size_t size) + static int dump(const char *source_file, const char *output_file, int cflags, int sflags) + { + snd_tplg_t *tplg; +- char *text; ++ char *config, *text; ++ size_t size; + int err; + +- err = load(&tplg, source_file, cflags); ++ err = load(source_file, (void **)&config, &size); ++ if (err) ++ return err; ++ err = load_topology(&tplg, config, size, cflags); ++ free(config); + if (err) + return err; + err = snd_tplg_save(tplg, &text, sflags); +@@ -215,17 +229,23 @@ static int dump(const char *source_file, const char *output_file, int cflags, in + static int compile(const char *source_file, const char *output_file, int cflags) + { + snd_tplg_t *tplg; ++ char *config; + void *bin; +- size_t size; ++ size_t config_size, size; + int err; + +- err = load(&tplg, source_file, cflags); ++ err = load(source_file, (void **)&config, &config_size); ++ if (err) ++ return err; ++ err = load_topology(&tplg, config, config_size, cflags); ++ free(config); + if (err) + return err; + err = snd_tplg_build_bin(tplg, &bin, &size); + snd_tplg_free(tplg); + if (err < 0 || size == 0) { +- fprintf(stderr, _("failed to compile context %s\n"), source_file); ++ fprintf(stderr, _("failed to compile context %s: %s\n"), ++ source_file, snd_strerror(-err)); + return 1; + } + err = save(output_file, bin, size); +@@ -233,17 +253,50 @@ static int compile(const char *source_file, const char *output_file, int cflags) + return err; + } + +-#define OP_COMPILE 1 +-#define OP_NORMALIZE 2 +-#define OP_DUMP 3 ++static int decode(const char *source_file, const char *output_file, ++ int cflags, int dflags, int sflags) ++{ ++ snd_tplg_t *tplg; ++ void *bin; ++ char *text; ++ size_t size; ++ int err; ++ ++ if (load(source_file, &bin, &size)) ++ return 1; ++ tplg = snd_tplg_create(cflags); ++ if (tplg == NULL) { ++ fprintf(stderr, _("failed to create new topology context\n")); ++ return 1; ++ } ++ err = snd_tplg_decode(tplg, bin, size, dflags); ++ free(bin); ++ if (err < 0) { ++ snd_tplg_free(tplg); ++ fprintf(stderr, _("failed to decode context %s: %s\n"), ++ source_file, snd_strerror(-err)); ++ return 1; ++ } ++ err = snd_tplg_save(tplg, &text, sflags); ++ snd_tplg_free(tplg); ++ if (err < 0) { ++ fprintf(stderr, _("Unable to save parsed configuration: %s\n"), ++ snd_strerror(-err)); ++ return 1; ++ } ++ err = save(output_file, text, strlen(text)); ++ free(text); ++ return err; ++} + + int main(int argc, char *argv[]) + { +- static const char short_options[] = "hc:n:u:v:o:sgxzV"; ++ static const char short_options[] = "hc:d:n:u:v:o:sgxzV"; + static const struct option long_options[] = { + {"help", 0, NULL, 'h'}, + {"verbose", 1, NULL, 'v'}, + {"compile", 1, NULL, 'c'}, ++ {"decode", 1, NULL, 'd'}, + {"normalize", 1, NULL, 'n'}, + {"dump", 1, NULL, 'u'}, + {"output", 1, NULL, 'o'}, +@@ -256,7 +309,7 @@ int main(int argc, char *argv[]) + }; + char *source_file = NULL; + char *output_file = NULL; +- int c, err, op = 'c', cflags = 0, sflags = 0, option_index; ++ int c, err, op = 'c', cflags = 0, dflags = 0, sflags = 0, option_index; + + #ifdef ENABLE_NLS + setlocale(LC_ALL, ""); +@@ -278,6 +331,7 @@ int main(int argc, char *argv[]) + cflags |= SND_TPLG_CREATE_DAPM_NOSORT; + break; + case 'c': ++ case 'd': + case 'n': + case 'u': + if (source_file) { +@@ -326,6 +380,9 @@ int main(int argc, char *argv[]) + case 'c': + err = compile(source_file, output_file, cflags); + break; ++ case 'd': ++ err = decode(source_file, output_file, cflags, dflags, sflags); ++ break; + default: + err = dump(source_file, output_file, cflags, sflags); + break; +-- +2.24.1 + + +From 56e1b879d4bccda62e7c0177b0a395d57a37931c Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Wed, 1 Jan 2020 17:45:06 +0100 +Subject: [PATCH 30/31] alsatplg: add documentation for -z,--dapm-nosort (-h) + +Signed-off-by: Jaroslav Kysela +--- + topology/topology.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/topology/topology.c b/topology/topology.c +index 91d2fce..ad0d108 100644 +--- a/topology/topology.c ++++ b/topology/topology.c +@@ -53,6 +53,7 @@ _("Usage: %s [OPTIONS]...\n" + "-s, --sort sort the identifiers in the normalized output\n" + "-g, --group save configuration by group indexes\n" + "-x, --nocheck save configuration without additional integrity checks\n" ++"-z, --dapm-nosort do not sort the DAPM widgets\n" + "-V, --version print version\n" + ), name); + } +-- +2.24.1 + + +From 996a638e04766df43cb8026673f93927b1047639 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Fri, 3 Jan 2020 23:46:51 +0100 +Subject: [PATCH 31/31] configure: fix new libatopology check + +--- + configure.ac | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 4bee49b..b7ed81a 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -49,6 +49,7 @@ AC_CHECK_LIB([asound], [snd_seq_client_info_get_pid], [HAVE_SEQ_CLIENT_INFO_GET_ + if test "$HAVE_SEQ_CLIENT_INFO_GET_PID" = "yes" ; then + AC_DEFINE([HAVE_SEQ_CLIENT_INFO_GET_PID], 1, [alsa-lib supports snd_seq_client_info_get_pid]) + fi ++AC_CHECK_LIB([atopology], [snd_tplg_save], [have_topology="no"]) + + # + # NOTE: The library 'libffado' (at least v2.4.1) executes ctor/dtor of instances +@@ -70,11 +71,6 @@ AM_CONDITIONAL(HAVE_TOPOLOGY, test "$have_topology" = "yes") + AM_CONDITIONAL(HAVE_SAMPLERATE, test "$have_samplerate" = "yes") + AM_CONDITIONAL(HAVE_FFADO, test "$have_ffado" = "yes") + +-# old libasound with the topology routines in the main library +-if test "x$have_topology" = "xyes" -a "x$ALSA_TOPOLOGY_LIBS" = "x"; then +- ALSA_TOPOLOGY_LIBS="$ALSA_LIBS" +-fi +- + dnl Use tinyalsa + alsabat_backend_tiny= + AC_ARG_ENABLE(alsabat_backend_tiny, +-- +2.24.1 diff --git a/alsa-utils.spec b/alsa-utils.spec index 086461d..94dc7dc 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -5,7 +5,7 @@ Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 5%{?dist} +Release: 6%{?dist} License: GPLv2+ URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -61,7 +61,7 @@ Architecture (ALSA) framework and Fast Fourier Transform library. %prep %setup -q -n %{name}-%{version} -#%patch1 -p1 +%patch1 -p1 %build %configure CFLAGS="$RPM_OPT_FLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" --disable-alsaconf \ @@ -195,6 +195,9 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Sun Feb 9 2020 Jaroslav Kysela - 1.2.1-6 +- UCM and topology fixes + * Tue Jan 28 2020 Fedora Release Engineering - 1.2.1-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild From bf45105506dccad9959a6def0091011375b32704 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 19 Feb 2020 12:25:57 +0100 Subject: [PATCH 02/58] updated to 1.2.2 --- alsa-utils.spec | 7 +++++-- sources | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index 94dc7dc..ab5e16e 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -1,11 +1,11 @@ -%define baseversion 1.2.1 +%define baseversion 1.2.2 #define fixversion .2 %global _hardened_build 1 Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 6%{?dist} +Release: 1%{?dist} License: GPLv2+ URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -195,6 +195,9 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Wed Feb 19 2020 Jaroslav Kysela - 1.2.2-1 +* Updated to 1.2.2 + * Sun Feb 9 2020 Jaroslav Kysela - 1.2.1-6 - UCM and topology fixes diff --git a/sources b/sources index 784dcc0..9b26ebe 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (alsa-utils-1.2.1.tar.bz2) = b7729659cd9809197dc30042f522f5103ff41ddc047f13f9c733c93f7e91a26f90cd864c70e654d12ef7a552b1d9ebe2727a24ec9fad03560cb7cdea906662ec +SHA512 (alsa-utils-1.2.2.tar.bz2) = 6398d316b3f770b5ffbb89cff55a8a9b725599fbf8109f866964b2b4367cb2de544ab4c322f97798d1b6e859de12bd1bd464a812c01602f0ca53fb5d0d845b1d From fc57d3c019157442dd2c93fb3a9d6f7552643c2a Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 19 Feb 2020 12:45:19 +0100 Subject: [PATCH 03/58] clean alsa-git.patch Signed-off-by: Jaroslav Kysela --- alsa-git.patch | 3553 ------------------------------------------------ 1 file changed, 3553 deletions(-) diff --git a/alsa-git.patch b/alsa-git.patch index ddfa20e..e69de29 100644 --- a/alsa-git.patch +++ b/alsa-git.patch @@ -1,3553 +0,0 @@ -From 5e6df5ae4ba587ba324dd97b7bd8af9f8159f59a Mon Sep 17 00:00:00 2001 -From: Rosen Penev -Date: Tue, 19 Nov 2019 20:28:53 -0800 -Subject: [PATCH 01/31] treewide: sys/poll to poll - -Fixes warning on musl: - -warning redirecting incorrect #include to - -Signed-off-by: Rosen Penev -Signed-off-by: Takashi Iwai ---- - amidi/amidi.c | 2 +- - amixer/amixer.c | 2 +- - aplay/aplay.c | 2 +- - seq/aplaymidi/arecordmidi.c | 2 +- - seq/aseqdump/aseqdump.c | 2 +- - 5 files changed, 5 insertions(+), 5 deletions(-) - -diff --git a/amidi/amidi.c b/amidi/amidi.c -index b6e05e1..c6268e4 100644 ---- a/amidi/amidi.c -+++ b/amidi/amidi.c -@@ -31,7 +31,7 @@ - #include - #include - #include --#include -+#include - #include - #include - #include -diff --git a/amixer/amixer.c b/amixer/amixer.c -index ad9c482..f7f31f0 100644 ---- a/amixer/amixer.c -+++ b/amixer/amixer.c -@@ -28,7 +28,7 @@ - #include - #include - #include --#include -+#include - #include - #include "amixer.h" - #include "../alsamixer/volume_mapping.h" -diff --git a/aplay/aplay.c b/aplay/aplay.c -index 274bbce..5241068 100644 ---- a/aplay/aplay.c -+++ b/aplay/aplay.c -@@ -44,7 +44,7 @@ - #include - #include - #include --#include -+#include - #include - #include - #include -diff --git a/seq/aplaymidi/arecordmidi.c b/seq/aplaymidi/arecordmidi.c -index f3db65e..604cd0d 100644 ---- a/seq/aplaymidi/arecordmidi.c -+++ b/seq/aplaymidi/arecordmidi.c -@@ -27,7 +27,7 @@ - #include - #include - #include --#include -+#include - #include - #include "aconfig.h" - #include "version.h" -diff --git a/seq/aseqdump/aseqdump.c b/seq/aseqdump/aseqdump.c -index 7904540..578e06f 100644 ---- a/seq/aseqdump/aseqdump.c -+++ b/seq/aseqdump/aseqdump.c -@@ -25,7 +25,7 @@ - #include - #include - #include --#include -+#include - #include - #include "aconfig.h" - #include "version.h" --- -2.24.1 - - -From 66e9a816093c7d8fbdfbc407062daabe89825b35 Mon Sep 17 00:00:00 2001 -From: Rosen Penev -Date: Tue, 19 Nov 2019 20:28:54 -0800 -Subject: [PATCH 02/31] treewide: Fix wrong formats on 32-bit - -uint64_t evaluates to unsigned long long on 32-bit, not unsigned long. -Use the proper formats. - -Signed-off-by: Rosen Penev -Signed-off-by: Takashi Iwai ---- - axfer/container.c | 7 ++++--- - axfer/subcmd-transfer.c | 4 +++- - 2 files changed, 7 insertions(+), 4 deletions(-) - -diff --git a/axfer/container.c b/axfer/container.c -index 7da97c6..566acd0 100644 ---- a/axfer/container.c -+++ b/axfer/container.c -@@ -13,6 +13,7 @@ - #include - #include - #include -+#include - - static const char *const cntr_type_labels[] = { - [CONTAINER_TYPE_PARSER] = "parser", -@@ -356,10 +357,10 @@ int container_context_pre_process(struct container_context *cntr, - fprintf(stderr, " frames/second: %u\n", - cntr->frames_per_second); - if (cntr->type == CONTAINER_TYPE_PARSER) { -- fprintf(stderr, " frames: %lu\n", -+ fprintf(stderr, " frames: %" PRIu64 "\n", - *frame_count); - } else { -- fprintf(stderr, " max frames: %lu\n", -+ fprintf(stderr, " max frames: %" PRIu64 "\n", - *frame_count); - } - } -@@ -427,7 +428,7 @@ int container_context_post_process(struct container_context *cntr, - assert(frame_count); - - if (cntr->verbose && cntr->handled_byte_count > 0) { -- fprintf(stderr, " Handled bytes: %lu\n", -+ fprintf(stderr, " Handled bytes: %" PRIu64 "\n", - cntr->handled_byte_count); - } - -diff --git a/axfer/subcmd-transfer.c b/axfer/subcmd-transfer.c -index 3ca745a..8746e6f 100644 ---- a/axfer/subcmd-transfer.c -+++ b/axfer/subcmd-transfer.c -@@ -11,6 +11,7 @@ - #include "misc.h" - - #include -+#include - - struct context { - struct xfer_context xfer; -@@ -389,7 +390,8 @@ static int context_process_frames(struct context *ctx, - - if (!ctx->xfer.quiet) { - fprintf(stderr, -- "%s: Expected %lu frames, Actual %lu frames\n", -+ "%s: Expected %" PRIu64 "frames, " -+ "Actual %" PRIu64 "frames\n", - snd_pcm_stream_name(direction), expected_frame_count, - *actual_frame_count); - if (ctx->interrupted) { --- -2.24.1 - - -From 80fd81f4a8647fe2b62a02db9a497d2a7639d9e3 Mon Sep 17 00:00:00 2001 -From: Rosen Penev -Date: Tue, 19 Nov 2019 20:28:55 -0800 -Subject: [PATCH 03/31] treewide: Fix printf formats - -Found with cppcheck - -Signed-off-by: Rosen Penev -Signed-off-by: Takashi Iwai ---- - alsactl/init_parse.c | 4 ++-- - alsaloop/pcmjob.c | 10 +++++----- - amixer/amixer.c | 6 +++--- - aplay/aplay.c | 2 +- - axfer/subcmd-list.c | 2 +- - axfer/xfer-libffado.c | 2 +- - axfer/xfer-options.c | 2 +- - 7 files changed, 14 insertions(+), 14 deletions(-) - -diff --git a/alsactl/init_parse.c b/alsactl/init_parse.c -index 562e674..c048fd3 100644 ---- a/alsactl/init_parse.c -+++ b/alsactl/init_parse.c -@@ -187,7 +187,7 @@ static int init_space(struct space **space, int card) - return -ENOMEM; - res->ctl_id_changed = ~0; - res->linenum = -1; -- sprintf(device, "hw:%u", card); -+ sprintf(device, "hw:%d", card); - err = snd_hctl_open(&res->ctl_handle, device, 0); - if (err < 0) - goto error; -@@ -734,7 +734,7 @@ dbvalue: - elem = snd_hctl_elem_next(elem); - } - snd_ctl_elem_id_free(id); -- sprintf(res, "%u", index); -+ sprintf(res, "%d", index); - dbg("do_ctl_count found %s controls", res); - return res; - } -diff --git a/alsaloop/pcmjob.c b/alsaloop/pcmjob.c -index 29d1aba..b252486 100644 ---- a/alsaloop/pcmjob.c -+++ b/alsaloop/pcmjob.c -@@ -120,7 +120,7 @@ static int setparams_stream(struct loopback_handle *lhandle, - } - err = snd_pcm_hw_params_set_rate_resample(handle, params, lhandle->resample); - if (err < 0) { -- logit(LOG_CRIT, "Resample setup failed for %s (val %i): %s\n", lhandle->id, lhandle->resample, snd_strerror(err)); -+ logit(LOG_CRIT, "Resample setup failed for %s (val %u): %s\n", lhandle->id, lhandle->resample, snd_strerror(err)); - return err; - } - err = snd_pcm_hw_params_set_access(handle, params, lhandle->access); -@@ -135,13 +135,13 @@ static int setparams_stream(struct loopback_handle *lhandle, - } - err = snd_pcm_hw_params_set_channels(handle, params, lhandle->channels); - if (err < 0) { -- logit(LOG_CRIT, "Channels count (%i) not available for %s: %s\n", lhandle->channels, lhandle->id, snd_strerror(err)); -+ logit(LOG_CRIT, "Channels count (%u) not available for %s: %s\n", lhandle->channels, lhandle->id, snd_strerror(err)); - return err; - } - rrate = lhandle->rate_req; - err = snd_pcm_hw_params_set_rate_near(handle, params, &rrate, 0); - if (err < 0) { -- logit(LOG_CRIT, "Rate %iHz not available for %s: %s\n", lhandle->rate_req, lhandle->id, snd_strerror(err)); -+ logit(LOG_CRIT, "Rate %uHz not available for %s: %s\n", lhandle->rate_req, lhandle->id, snd_strerror(err)); - return err; - } - rrate = 0; -@@ -152,7 +152,7 @@ static int setparams_stream(struct loopback_handle *lhandle, - !lhandle->loopback->src_enable && - #endif - (int)rrate != lhandle->rate) { -- logit(LOG_CRIT, "Rate does not match (requested %iHz, got %iHz, resample %i)\n", lhandle->rate, rrate, lhandle->resample); -+ logit(LOG_CRIT, "Rate does not match (requested %uHz, got %uHz, resample %u)\n", lhandle->rate, rrate, lhandle->resample); - return -EINVAL; - } - lhandle->pitch = (double)lhandle->rate_req / (double)lhandle->rate; -@@ -1613,7 +1613,7 @@ __again: - if (count > loop->play->buffer_size) - count = loop->play->buffer_size; - if (err != count) { -- logit(LOG_CRIT, "%s: initial playback fill error (%i/%i/%i)\n", loop->id, err, (int)count, loop->play->buffer_size); -+ logit(LOG_CRIT, "%s: initial playback fill error (%i/%i/%u)\n", loop->id, err, (int)count, loop->play->buffer_size); - err = -EIO; - goto __error; - } -diff --git a/amixer/amixer.c b/amixer/amixer.c -index f7f31f0..928f7c5 100644 ---- a/amixer/amixer.c -+++ b/amixer/amixer.c -@@ -465,7 +465,7 @@ static void decode_tlv(unsigned int spaces, unsigned int *tlv, unsigned int tlv_ - size = tlv[idx++]; - tlv_size -= 2 * sizeof(unsigned int); - if (size > tlv_size) { -- printf("TLV size error (%i, %i, %i)!\n", type, size, tlv_size); -+ printf("TLV size error (%u, %u, %u)!\n", type, size, tlv_size); - return; - } - switch (type) { -@@ -576,7 +576,7 @@ static void decode_tlv(unsigned int spaces, unsigned int *tlv, unsigned int tlv_ - break; - #endif - default: -- printf("unk-%i-", type); -+ printf("unk-%u-", type); - while (size > 0) { - printf("0x%08x,", tlv[idx++]); - size -= sizeof(unsigned int); -@@ -611,7 +611,7 @@ static int show_control(const char *space, snd_hctl_elem_t *elem, - } - count = snd_ctl_elem_info_get_count(info); - type = snd_ctl_elem_info_get_type(info); -- printf("%s; type=%s,access=%s,values=%i", space, control_type(info), control_access(info), count); -+ printf("%s; type=%s,access=%s,values=%u", space, control_type(info), control_access(info), count); - switch (type) { - case SND_CTL_ELEM_TYPE_INTEGER: - printf(",min=%li,max=%li,step=%li\n", -diff --git a/aplay/aplay.c b/aplay/aplay.c -index 5241068..72fa567 100644 ---- a/aplay/aplay.c -+++ b/aplay/aplay.c -@@ -3346,7 +3346,7 @@ static void playbackv(char **names, unsigned int count) - } - alloced = 1; - } else if (count != channels) { -- error(_("You need to specify %d files"), channels); -+ error(_("You need to specify %u files"), channels); - prg_exit(EXIT_FAILURE); - } - -diff --git a/axfer/subcmd-list.c b/axfer/subcmd-list.c -index e22628c..359f73f 100644 ---- a/axfer/subcmd-list.c -+++ b/axfer/subcmd-list.c -@@ -31,7 +31,7 @@ static int dump_device(snd_ctl_t *handle, const char *id, const char *name, - snd_pcm_info_get_name(info)); - - count = snd_pcm_info_get_subdevices_count(info); -- printf(" Subdevices: %i/%i\n", -+ printf(" Subdevices: %i/%u\n", - snd_pcm_info_get_subdevices_avail(info), count); - - for (i = 0; i < count; ++i) { -diff --git a/axfer/xfer-libffado.c b/axfer/xfer-libffado.c -index a37cce6..6db835d 100644 ---- a/axfer/xfer-libffado.c -+++ b/axfer/xfer-libffado.c -@@ -440,7 +440,7 @@ static int xfer_libffado_pre_process(struct xfer_context *xfer, - } - if (*samples_per_frame != channels) { - fprintf(stderr, -- "The number of samples per frame should be %i.\n", -+ "The number of samples per frame should be %u.\n", - channels); - return -EINVAL; - } -diff --git a/axfer/xfer-options.c b/axfer/xfer-options.c -index 352d126..3740b16 100644 ---- a/axfer/xfer-options.c -+++ b/axfer/xfer-options.c -@@ -238,7 +238,7 @@ static int validate_options(struct xfer_context *xfer) - xfer->frames_per_second *= 1000; - if (xfer->frames_per_second < 2000 || - xfer->frames_per_second > 192000) { -- fprintf(stderr, "bad speed value '%i'\n", val); -+ fprintf(stderr, "bad speed value '%u'\n", val); - return -EINVAL; - } - --- -2.24.1 - - -From ac82b651676303e0689b1c23ad72aaf7b264ce5f Mon Sep 17 00:00:00 2001 -From: Rosen Penev -Date: Wed, 20 Nov 2019 10:19:20 -0800 -Subject: [PATCH 04/31] aplay: Adjust buffer sizes to fix snprintf warnings - -It also reduces compiled size slightly. - -aplay.c: In function 'capture': -aplay.c:3055:34: error: '-01' directive output may be truncated writing 3 -bytes into a region of size between 1 and 4097 [-Werror=format-truncation= -] - 3055 | snprintf(namebuf, namelen, "%s-01", buf); - | ^~~ -aplay.c:3055:4: note: 'snprintf' output between 4 and 4100 bytes into a -destination of size 4097 - 3055 | snprintf(namebuf, namelen, "%s-01", buf); - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -aplay.c:3053:34: error: '-01.' directive output may be truncated writing 4 -bytes into a region of size between 1 and 4097 [-Werror=format-truncation= -] - 3053 | snprintf(namebuf, namelen, "%s-01.%s", buf, s); - | ^~~~ -aplay.c:3053:4: note: 'snprintf' output 5 or more bytes (assuming 4101) -into a destination of size 4097 - 3053 | snprintf(namebuf, namelen, "%s-01.%s", buf, s); - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -aplay.c:3065:34: error: '%02i' directive output may be truncated writing -between 2 and 10 bytes into a region of size between 0 and 4096 [-Werror= -format-truncation=] - 3065 | snprintf(namebuf, namelen, "%s-%02i", buf, filecount); - | ^~~~ -aplay.c:3065:30: note: directive argument in the range [1, 2147483647] - 3065 | snprintf(namebuf, namelen, "%s-%02i", buf, filecount); - | ^~~~~~~~~ -aplay.c:3065:3: note: 'snprintf' output between 4 and 4108 bytes into a -destination of size 4097 - 3065 | snprintf(namebuf, namelen, "%s-%02i", buf, filecount); - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -aplay.c:3063:34: error: '%02i' directive output may be truncated writing -between 2 and 10 bytes into a region of size between 0 and 4096 [-Werror= -format-truncation=] - 3063 | snprintf(namebuf, namelen, "%s-%02i.%s", buf, filecount, s); - | ^~~~ -aplay.c:3063:30: note: directive argument in the range [1, 2147483647] - 3063 | snprintf(namebuf, namelen, "%s-%02i.%s", buf, filecount, s); - | ^~~~~~~~~~~~ -aplay.c:3063:3: note: 'snprintf' output 5 or more bytes (assuming 4109) -into a destination of size 4097 - 3063 | snprintf(namebuf, namelen, "%s-%02i.%s", buf, filecount, s); - -Signed-off-by: Rosen Penev -Signed-off-by: Takashi Iwai ---- - aplay/aplay.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/aplay/aplay.c b/aplay/aplay.c -index 72fa567..78adee2 100644 ---- a/aplay/aplay.c -+++ b/aplay/aplay.c -@@ -3015,7 +3015,7 @@ static int new_capture_file(char *name, char *namebuf, size_t namelen, - int filecount) - { - char *s; -- char buf[PATH_MAX+1]; -+ char buf[PATH_MAX-10]; - time_t t; - struct tm *tmp; - -@@ -3122,7 +3122,7 @@ static void capture(char *orig_name) - int tostdout=0; /* boolean which describes output stream */ - int filecount=0; /* number of files written */ - char *name = orig_name; /* current filename */ -- char namebuf[PATH_MAX+1]; -+ char namebuf[PATH_MAX+2]; - off64_t count, rest; /* number of bytes to capture */ - struct stat statbuf; - --- -2.24.1 - - -From c9dc401264ad3c0b621f52e8098e7c1661c50cea Mon Sep 17 00:00:00 2001 -From: Rosen Penev -Date: Wed, 20 Nov 2019 11:13:55 -0800 -Subject: [PATCH 05/31] aplay: Limit VUMeter progress bar to 100 for negative - as well - -While the progress bar cannot be negative, GCC concludes that it can be -and assumes tmp can be written past the end. Fixes this GCC warning: - -aplay.c:1747:18: warning: '%02d' directive writing between 2 and 11 bytes - into a region of size 4 [-Wformat-overflow=] - 1747 | sprintf(tmp, "%02d%%", maxperc[c]); - -Signed-off-by: Rosen Penev -Signed-off-by: Takashi Iwai ---- - aplay/aplay.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/aplay/aplay.c b/aplay/aplay.c -index 78adee2..1a887e4 100644 ---- a/aplay/aplay.c -+++ b/aplay/aplay.c -@@ -54,6 +54,8 @@ - #include "formats.h" - #include "version.h" - -+#define ABS(a) (a) < 0 ? -(a) : (a) -+ - #ifdef SND_CHMAP_API_VERSION - #define CONFIG_SUPPORT_CHMAP 1 - #endif -@@ -1741,7 +1743,7 @@ static void print_vu_meter_stereo(int *perc, int *maxperc) - line[bar_length + 6 + 1 + p] = '+'; - else - line[bar_length - p - 1] = '+'; -- if (maxperc[c] > 99) -+ if (ABS(maxperc[c]) > 99) - sprintf(tmp, "MAX"); - else - sprintf(tmp, "%02d%%", maxperc[c]); --- -2.24.1 - - -From 3c740d90490abe64c86c667934ba5d990817b873 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 20 Nov 2019 13:20:39 +0100 -Subject: [PATCH 06/31] alsactl: sysfs - add /sys/kernel/uevent_seqnum check to - init - -Signed-off-by: Jaroslav Kysela ---- - alsactl/init_sysfs.c | 13 +++++++++---- - 1 file changed, 9 insertions(+), 4 deletions(-) - -diff --git a/alsactl/init_sysfs.c b/alsactl/init_sysfs.c -index 5c789b6..57ef615 100644 ---- a/alsactl/init_sysfs.c -+++ b/alsactl/init_sysfs.c -@@ -34,6 +34,8 @@ static int sysfs_init(void) - const char *env; - char sysfs_test[PATH_SIZE]; - -+ INIT_LIST_HEAD(&attr_list); -+ - env = getenv("SYSFS_PATH"); - if (env) { - strlcpy(sysfs_path, env, sizeof(sysfs_path)); -@@ -43,13 +45,16 @@ static int sysfs_init(void) - dbg("sysfs_path='%s'", sysfs_path); - - strlcpy(sysfs_test, sysfs_path, sizeof(sysfs_test)); -- strlcat(sysfs_test, "/kernel/uevent_helper", sizeof(sysfs_test)); -+ strlcat(sysfs_test, "/kernel/uevent_seqnum", sizeof(sysfs_test)); - if (access(sysfs_test, F_OK)) { -- error("sysfs path '%s' is invalid\n", sysfs_path); -- return -errno; -+ strlcpy(sysfs_test, sysfs_path, sizeof(sysfs_test)); -+ strlcat(sysfs_test, "/kernel/uevent_helper", sizeof(sysfs_test)); -+ if (access(sysfs_test, F_OK)) { -+ error("sysfs path '%s' is invalid", sysfs_path); -+ return -errno; -+ } - } - -- INIT_LIST_HEAD(&attr_list); - return 0; - } - --- -2.24.1 - - -From 745c5df26066de94622dd38c667da31ac6b88510 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Mon, 25 Nov 2019 17:58:51 +0100 -Subject: [PATCH 07/31] alsaucm: use the first sound card (use case name - 'hw:CARDNO') as default - -Signed-off-by: Jaroslav Kysela ---- - alsaucm/go.sh | 5 ++++- - alsaucm/usecase.c | 17 +++++++---------- - 2 files changed, 11 insertions(+), 11 deletions(-) - -diff --git a/alsaucm/usecase.c b/alsaucm/usecase.c -index 7677422..8b1c8c7 100644 ---- a/alsaucm/usecase.c -+++ b/alsaucm/usecase.c -@@ -188,22 +188,19 @@ static void my_exit(struct context *context, int exitcode) - - static void do_initial_open(struct context *context) - { -- const char **list; -- int err; -+ int card, err; -+ char name[16]; - - if (!context->no_open && context->card == NULL) { -- err = snd_use_case_card_list(&list); -+ card = -1; -+ err = snd_card_next(&card); - if (err < 0) { -- fprintf(stderr, "%s: unable to obtain card list: %s\n", -+ fprintf(stderr, "%s: no sound card found: %s\n", - context->command, snd_strerror(err)); - my_exit(context, EXIT_FAILURE); - } -- if (err == 0) { -- printf("No card found\n"); -- my_exit(context, EXIT_SUCCESS); -- } -- context->card = strdup(list[0]); -- snd_use_case_free_list(list, err); -+ snprintf(name, sizeof(name), "hw:%d", card); -+ context->card = strdup(name); - } - - /* open library */ --- -2.24.1 - - -From 860ffda82518dad6018f877f58aed1485d49e3a0 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 27 Nov 2019 08:51:29 +0100 -Subject: [PATCH 08/31] alsaucm: add text dump command - -Signed-off-by: Jaroslav Kysela ---- - alsaucm/Makefile.am | 2 +- - alsaucm/dump.c | 403 ++++++++++++++++++++++++++++++++++++++++++++ - alsaucm/usecase.c | 22 +-- - alsaucm/usecase.h | 35 ++++ - 4 files changed, 447 insertions(+), 15 deletions(-) - create mode 100644 alsaucm/dump.c - create mode 100644 alsaucm/usecase.h - -diff --git a/alsaucm/Makefile.am b/alsaucm/Makefile.am -index 4b447dd..03f99e0 100644 ---- a/alsaucm/Makefile.am -+++ b/alsaucm/Makefile.am -@@ -5,7 +5,7 @@ if USE_RST2MAN - man_MANS = alsaucm.1 - endif - --alsaucm_SOURCES = usecase.c -+alsaucm_SOURCES = usecase.c dump.c - - AM_CPPFLAGS = \ - -Wall -I$(top_srcdir)/include -diff --git a/alsaucm/dump.c b/alsaucm/dump.c -new file mode 100644 -index 0000000..ae0af2f ---- /dev/null -+++ b/alsaucm/dump.c -@@ -0,0 +1,403 @@ -+/* -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ * -+ * Copyright (C) 2019 Red Hat Inc. -+ * Authors: Jaroslav Kysela -+ */ -+ -+#include -+#include -+#include -+#include -+#include "usecase.h" -+#include "aconfig.h" -+#include "version.h" -+ -+struct renderer { -+ int (*init)(struct renderer *r); -+ void (*done)(struct renderer *r); -+ int (*verb_begin)(struct renderer *r, -+ const char *verb, -+ const char *comment); -+ int (*verb_end)(struct renderer *r); -+ int (*device_begin)(struct renderer *r, -+ const char *device, -+ const char *comment); -+ int (*device_end)(struct renderer *r); -+ int (*modifier_begin)(struct renderer *r, -+ const char *device, -+ const char *comment); -+ int (*modifier_end)(struct renderer *r); -+ int (*supported_begin)(struct renderer *r); -+ int (*supported_value)(struct renderer *r, const char *value, int last); -+ int (*supported_end)(struct renderer *r); -+ int (*conflict_begin)(struct renderer *r); -+ int (*conflict_value)(struct renderer *r, const char *value, int last); -+ int (*conflict_end)(struct renderer *r); -+ int (*value_begin)(struct renderer *r); -+ int (*value_end)(struct renderer *r); -+ int (*value)(struct renderer *r, const char *ident, const char *value); -+ void *opaque; -+}; -+ -+struct text { -+ char a[1]; -+}; -+ -+static char *tesc(const char *s, char *buf, size_t buf_len) -+{ -+ char *dst = buf; -+ char c = '\0'; -+ if (strchr(s, '"') || strchr(s, ' ') || strchr(s, '.')) { -+ *dst++ = c = '"'; -+ buf_len--; -+ } -+ while (*s && buf_len > 2) { -+ if (*s == '\"') { -+ if (buf_len > 3) { -+ *dst++ = '"'; -+ *dst++ = *s++; -+ buf_len -= 2; -+ continue; -+ } else { -+ break; -+ } -+ } -+ *dst++ = *s++; -+ } -+ if (c) -+ *dst++ = c; -+ *dst = '\0'; -+ return buf; -+} -+ -+#define ESC(s, esc) tesc((s), (esc), sizeof(esc)) -+ -+static int text_verb_start(struct renderer *r, const char *verb, const char *comment) -+{ -+ char buf1[128], buf2[128]; -+ printf("Verb.%s {\n", ESC(verb, buf1)); -+ if (comment && comment[0]) -+ printf("\tComment %s\n", ESC(comment, buf2)); -+ return 0; -+} -+ -+static int text_verb_end(struct renderer *r) -+{ -+ printf("}\n"); -+ return 0; -+} -+ -+static int text_2nd_level_begin(struct renderer *r, -+ const char *key, -+ const char *val, -+ const char *comment) -+{ -+ char buf1[128], buf2[128]; -+ printf("\t%s.%s {\n", key, ESC(val, buf1)); -+ if (comment && comment[0]) -+ printf("\t\tComment %s\n", ESC(comment, buf2)); -+ return 0; -+} -+ -+static int text_2nd_level_end(struct renderer *r) -+{ -+ printf("\t}\n"); -+ return 0; -+} -+ -+static int text_2nd_level(struct renderer *r, const char *txt) -+{ -+ printf("\t\t%s", txt); -+ return 0; -+} -+ -+static int text_3rd_level(struct renderer *r, const char *txt) -+{ -+ printf("\t\t\t%s", txt); -+ return 0; -+} -+ -+static int text_dev_start(struct renderer *r, const char *dev, const char *comment) -+{ -+ return text_2nd_level_begin(r, "Device", dev, comment); -+} -+ -+static int text_mod_start(struct renderer *r, const char *dev, const char *comment) -+{ -+ return text_2nd_level_begin(r, "Modifier", dev, comment); -+} -+ -+static int text_supcon_start(struct renderer *r, const char *key) -+{ -+ if (text_2nd_level(r, key)) -+ return 1; -+ printf(" [\n"); -+ return 0; -+} -+ -+static int text_supcon_value(struct renderer *r, const char *value, int last) -+{ -+ char buf[256]; -+ ESC(value, buf); -+ if (!last && strlen(buf) < sizeof(buf) - 2) -+ strcat(buf, ","); -+ if (text_3rd_level(r, buf)) -+ return 1; -+ printf("\n"); -+ return 0; -+} -+ -+static int text_supcon_end(struct renderer *r) -+{ -+ return text_2nd_level(r, "]\n"); -+} -+ -+static int text_sup_start(struct renderer *r) -+{ -+ return text_supcon_start(r, "SupportedDevices"); -+} -+ -+static int text_con_start(struct renderer *r) -+{ -+ return text_supcon_start(r, "ConflictingDevices"); -+} -+ -+static int text_value_begin(struct renderer *r) -+{ -+ return text_2nd_level(r, "Values [\n"); -+} -+ -+static int text_value_end(struct renderer *r) -+{ -+ return text_2nd_level(r, "]\n"); -+} -+ -+static int text_value(struct renderer *r, const char *ident, const char *value) -+{ -+ char buf1[256], buf2[256]; -+ int err; -+ -+ ESC(ident, buf1); -+ err = text_3rd_level(r, buf1); -+ if (err < 0) -+ return err; -+ ESC(value, buf2); -+ printf(" %s\n", buf2); -+ return 0; -+} -+ -+static struct renderer text_renderer = { -+ .verb_begin = text_verb_start, -+ .verb_end = text_verb_end, -+ .device_begin = text_dev_start, -+ .device_end = text_2nd_level_end, -+ .modifier_begin = text_mod_start, -+ .modifier_end = text_2nd_level_end, -+ .supported_begin = text_sup_start, -+ .supported_value = text_supcon_value, -+ .supported_end = text_supcon_end, -+ .conflict_begin = text_con_start, -+ .conflict_value = text_supcon_value, -+ .conflict_end = text_supcon_end, -+ .value_begin = text_value_begin, -+ .value_end = text_value_end, -+ .value = text_value, -+}; -+ -+static int render_devlist(struct context *context, -+ struct renderer *render, -+ const char *verb, -+ const char *device, -+ const char *list, -+ int (*begin)(struct renderer *), -+ int (*value)(struct renderer *, const char *value, int last), -+ int (*end)(struct renderer *)) -+{ -+ snd_use_case_mgr_t *uc_mgr = context->uc_mgr; -+ const char **dev_list; -+ char buf[256]; -+ int err = 0, j, dev_num; -+ -+ snprintf(buf, sizeof(buf), "%s/%s/%s", list, device, verb); -+ dev_num = snd_use_case_get_list(uc_mgr, buf, &dev_list); -+ if (dev_num < 0) { -+ fprintf(stderr, "%s: unable to get %s for verb '%s' for device '%s'\n", -+ context->command, list, verb, device); -+ return dev_num; -+ } -+ if (dev_num > 0) { -+ err = begin(render); -+ if (err < 0) -+ goto __err; -+ for (j = 0; j < dev_num; j++) { -+ err = value(render, dev_list[j], j + 1 == dev_num); -+ if (err < 0) -+ goto __err; -+ } -+ err = end(render); -+ } -+__err: -+ snd_use_case_free_list(dev_list, dev_num); -+ return err; -+} -+ -+static int render_values(struct context *context, -+ struct renderer *render, -+ const char *verb, -+ const char *device) -+{ -+ snd_use_case_mgr_t *uc_mgr = context->uc_mgr; -+ const char **list, *value; -+ char buf[256]; -+ int err = 0, j, num; -+ -+ snprintf(buf, sizeof(buf), "_identifiers/%s/%s", device, verb); -+ num = snd_use_case_get_list(uc_mgr, buf, &list); -+ if (num < 0) { -+ fprintf(stderr, "%s: unable to get _identifiers for verb '%s' for device '%s': %s\n", -+ context->command, verb, device, snd_strerror(num)); -+ return num; -+ } -+ if (num == 0) -+ goto __err; -+ if (render->value_begin) { -+ err = render->value_begin(render); -+ if (err < 0) -+ goto __err; -+ } -+ for (j = 0; j < num; j++) { -+ snprintf(buf, sizeof(buf), "%s/%s/%s", list[j], device, verb); -+ err = snd_use_case_get(uc_mgr, buf, &value); -+ if (err < 0) { -+ fprintf(stderr, "%s: unable to get value '%s' for verb '%s' for device '%s': %s\n", -+ context->command, list[j], verb, device, snd_strerror(err)); -+ goto __err; -+ } -+ err = render->value(render, list[j], value); -+ free((char *)value); -+ if (err < 0) -+ goto __err; -+ } -+ if (render->value_end) -+ err = render->value_end(render); -+__err: -+ snd_use_case_free_list(list, num); -+ return err; -+} -+ -+static int render_device(struct context *context, -+ struct renderer *render, -+ const char *verb, -+ const char *device) -+{ -+ int err; -+ -+ err = render_devlist(context, render, verb, device, -+ "_supporteddevs", -+ render->supported_begin, -+ render->supported_value, -+ render->supported_end); -+ if (err < 0) -+ return err; -+ err = render_devlist(context, render, verb, device, -+ "_conflictingdevs", -+ render->conflict_begin, -+ render->conflict_value, -+ render->conflict_end); -+ if (err < 0) -+ return err; -+ return render_values(context, render, verb, device); -+} -+ -+static void render(struct context *context, struct renderer *render) -+{ -+ snd_use_case_mgr_t *uc_mgr = context->uc_mgr; -+ int i, j, num, dev_num; -+ const char **list, **dev_list, *verb, *comment; -+ char buf[256]; -+ -+ num = snd_use_case_verb_list(uc_mgr, &list); -+ if (num < 0) { -+ fprintf(stderr, "%s: no verbs found\n", context->command); -+ return; -+ } -+ if (render->init && render->init(render)) -+ goto __end; -+ for (i = 0; i < num; i += 2) { -+ /* verb */ -+ verb = list[i + 0]; -+ comment = list[i + 1]; -+ if (render->verb_begin(render, verb, comment)) -+ break; -+ /* devices */ -+ snprintf(buf, sizeof(buf), "_devices/%s", verb); -+ dev_num = snd_use_case_get_list(uc_mgr, buf, &dev_list); -+ if (dev_num < 0) { -+ fprintf(stderr, "%s: unable to get devices for verb '%s'\n", -+ context->command, verb); -+ continue; -+ } -+ for (j = 0; j < dev_num; j += 2) { -+ render->device_begin(render, dev_list[j + 0], dev_list[j + 1]); -+ if (render_device(context, render, verb, dev_list[j + 0])) { -+ snd_use_case_free_list(dev_list, dev_num); -+ goto __end; -+ } -+ render->device_end(render); -+ } -+ snd_use_case_free_list(dev_list, dev_num); -+ /* modifiers */ -+ snprintf(buf, sizeof(buf), "_modifiers/%s", verb); -+ dev_num = snd_use_case_get_list(uc_mgr, buf, &dev_list); -+ if (dev_num < 0) { -+ fprintf(stderr, "%s: unable to get modifiers for verb '%s'\n", -+ context->command, verb); -+ continue; -+ } -+ for (j = 0; j < dev_num; j += 2) { -+ render->modifier_begin(render, dev_list[j + 0], dev_list[j + 1]); -+ render->modifier_end(render); -+ } -+ snd_use_case_free_list(dev_list, dev_num); -+ /* end */ -+ if (render->verb_end(render)) -+ break; -+ } -+ if (render->done) -+ render->done(render); -+__end: -+ snd_use_case_free_list(list, num); -+} -+ -+void dump(struct context *context, const char *format) -+{ -+ struct renderer r; -+ -+ r.opaque = NULL; -+ if (strcasecmp(format, "text") == 0 || -+ strcasecmp(format, "txt") == 0) { -+ struct text t; -+ memset(&t, 0, sizeof(t)); -+ r = text_renderer; -+ r.opaque = &t; -+ } -+ if (r.opaque != NULL) { -+ render(context, &r); -+ return; -+ } -+ fprintf(stderr, "%s: unknown dump format '%s'\n", -+ context->command, format); -+} -diff --git a/alsaucm/usecase.c b/alsaucm/usecase.c -index 8b1c8c7..44fc92b 100644 ---- a/alsaucm/usecase.c -+++ b/alsaucm/usecase.c -@@ -38,24 +38,12 @@ - #include - #include - #include -+#include "usecase.h" - #include "aconfig.h" - #include "version.h" - - #define MAX_BUF 256 - --struct context { -- snd_use_case_mgr_t *uc_mgr; -- const char *command; -- char *card; -- char **argv; -- int argc; -- int arga; -- char *batch; -- unsigned int interactive:1; -- unsigned int no_open:1; -- unsigned int do_exit:1; --}; -- - enum uc_cmd { - /* management */ - OM_UNKNOWN = 0, -@@ -63,6 +51,7 @@ enum uc_cmd { - OM_RESET, - OM_RELOAD, - OM_LISTCARDS, -+ OM_DUMP, - OM_LIST2, - OM_LIST1, - -@@ -88,11 +77,13 @@ static struct cmd cmds[] = { - { OM_RESET, 0, 1, "reset" }, - { OM_RELOAD, 0, 1, "reload" }, - { OM_LISTCARDS, 0, 0, "listcards" }, -+ { OM_DUMP, 1, 1, "dump" }, - { OM_LIST1, 1, 1, "list1" }, - { OM_LIST2, 1, 1, "list" }, - { OM_SET, 2, 1, "set" }, - { OM_GET, 1, 1, "get" }, - { OM_GETI, 1, 1, "geti" }, -+ { OM_DUMP, 1, 1, "dump" }, - { OM_HELP, 0, 0, "help" }, - { OM_QUIT, 0, 0, "quit" }, - { OM_HELP, 0, 0, "h" }, -@@ -117,6 +108,7 @@ static void dump_help(struct context *context) - " reset reset sound card to default state\n" - " reload reload configuration\n" - " listcards list available cards\n" -+" dump FORMAT dump all config information (format: text)\n" - " list IDENTIFIER list command, for items with value + comment\n" - " list1 IDENTIFIER list command, for items without comments\n" - " get IDENTIFIER get string value\n" -@@ -185,7 +177,6 @@ static void my_exit(struct context *context, int exitcode) - snd_config_update_free_global(); - exit(exitcode); - } -- - static void do_initial_open(struct context *context) - { - int card, err; -@@ -288,6 +279,9 @@ static int do_one(struct context *context, struct cmd *cmd, char **argv) - } - snd_use_case_free_list(list, err); - break; -+ case OM_DUMP: -+ dump(context, argv[0]); -+ break; - case OM_LIST1: - case OM_LIST2: - switch (cmd->code) { -diff --git a/alsaucm/usecase.h b/alsaucm/usecase.h -new file mode 100644 -index 0000000..a85716a ---- /dev/null -+++ b/alsaucm/usecase.h -@@ -0,0 +1,35 @@ -+/* -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ */ -+ -+#ifndef __USECASE_H -+#define __USECASE_H -+ -+struct context { -+ snd_use_case_mgr_t *uc_mgr; -+ const char *command; -+ char *card; -+ char **argv; -+ int argc; -+ int arga; -+ char *batch; -+ unsigned int interactive:1; -+ unsigned int no_open:1; -+ unsigned int do_exit:1; -+}; -+ -+void dump(struct context *context, const char *format); -+ -+#endif --- -2.24.1 - - -From 49716fa61e9ddc67476d40f9ea84f07fe0017748 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Sat, 30 Nov 2019 20:30:33 +0100 -Subject: [PATCH 09/31] alsaucm: add json dump command - -Signed-off-by: Jaroslav Kysela ---- - alsaucm/dump.c | 251 +++++++++++++++++++++++++++++++++++++++++++++- - alsaucm/usecase.c | 2 +- - 2 files changed, 249 insertions(+), 4 deletions(-) - -diff --git a/alsaucm/dump.c b/alsaucm/dump.c -index ae0af2f..bc638f1 100644 ---- a/alsaucm/dump.c -+++ b/alsaucm/dump.c -@@ -32,10 +32,14 @@ struct renderer { - const char *verb, - const char *comment); - int (*verb_end)(struct renderer *r); -+ int (*device_block_begin)(struct renderer *r); -+ int (*device_block_end)(struct renderer *r); - int (*device_begin)(struct renderer *r, - const char *device, - const char *comment); - int (*device_end)(struct renderer *r); -+ int (*modifier_block_begin)(struct renderer *r); -+ int (*modifier_block_end)(struct renderer *r); - int (*modifier_begin)(struct renderer *r, - const char *device, - const char *comment); -@@ -52,6 +56,10 @@ struct renderer { - void *opaque; - }; - -+/* -+ * Text renderer -+ */ -+ - struct text { - char a[1]; - }; -@@ -177,12 +185,12 @@ static int text_con_start(struct renderer *r) - - static int text_value_begin(struct renderer *r) - { -- return text_2nd_level(r, "Values [\n"); -+ return text_2nd_level(r, "Values {\n"); - } - - static int text_value_end(struct renderer *r) - { -- return text_2nd_level(r, "]\n"); -+ return text_2nd_level(r, "}\n"); - } - - static int text_value(struct renderer *r, const char *ident, const char *value) -@@ -217,6 +225,220 @@ static struct renderer text_renderer = { - .value = text_value, - }; - -+/* -+ * JSON renderer -+ */ -+ -+struct json { -+ int block[5]; -+}; -+ -+static char *jesc(const char *s, char *buf, size_t buf_len) -+{ -+ char *dst = buf; -+ char c = '"'; -+ *dst++ = c; -+ buf_len--; -+ while (*s && buf_len > 2) { -+ if (*s == '\"') { -+ if (buf_len > 3) { -+ *dst++ = '"'; -+ *dst++ = *s++; -+ buf_len -= 2; -+ continue; -+ } else { -+ break; -+ } -+ } -+ *dst++ = *s++; -+ } -+ *dst++ = c; -+ *dst = '\0'; -+ return buf; -+} -+ -+#define JESC(s, esc) jesc((s), (esc), sizeof(esc)) -+ -+static void json_block(struct renderer *r, int level, int last) -+{ -+ struct json *j = r->opaque; -+ printf((j->block[level] && !last) ? ",\n" : "\n"); -+ j->block[level] = last ? 0 : 1; -+} -+ -+static int json_init(struct renderer *r) -+{ -+ printf("{\n \"Verbs\": {"); -+ return 0; -+} -+ -+static void json_done(struct renderer *r) -+{ -+ json_block(r, 0, 1); -+ printf(" }\n}\n"); -+} -+ -+static int json_verb_start(struct renderer *r, const char *verb, const char *comment) -+{ -+ char buf[256]; -+ json_block(r, 0, 0); -+ printf(" %s: {", JESC(verb, buf)); -+ if (comment && comment[0]) { -+ json_block(r, 1, 0); -+ printf(" \"Comment\": %s", JESC(comment, buf)); -+ } -+ return 0; -+} -+ -+static int json_verb_end(struct renderer *r) -+{ -+ json_block(r, 1, 1); -+ printf(" }"); -+ return 0; -+} -+ -+static int json_2nd_level_block_end(struct renderer *r) -+{ -+ json_block(r, 2, 1); -+ printf(" }"); -+ return 0; -+} -+ -+static int json_2nd_level_begin(struct renderer *r, -+ const char *val, -+ const char *comment) -+{ -+ char buf[256]; -+ json_block(r, 2, 0); -+ printf(" %s: {", JESC(val, buf)); -+ if (comment && comment[0]) { -+ json_block(r, 3, 0); -+ printf(" \"Comment\": %s", JESC(comment, buf)); -+ } -+ return 0; -+} -+ -+static int json_2nd_level_end(struct renderer *r) -+{ -+ json_block(r, 3, 1); -+ printf(" }"); -+ return 0; -+} -+ -+static int json_2nd_level(struct renderer *r, const char *txt) -+{ -+ printf(" %s", txt); -+ return 0; -+} -+ -+static int json_3rd_level(struct renderer *r, const char *txt) -+{ -+ printf(" %s", txt); -+ return 0; -+} -+ -+static int json_dev_block_start(struct renderer *r) -+{ -+ json_block(r, 1, 0); -+ printf(" \"Devices\": {"); -+ return 0; -+} -+ -+static int json_mod_block_start(struct renderer *r) -+{ -+ json_block(r, 1, 0); -+ printf(" \"Modifiers\": {"); -+ return 0; -+} -+ -+static int json_supcon_start(struct renderer *r, const char *key) -+{ -+ json_block(r, 3, 0); -+ if (json_2nd_level(r, key)) -+ return 1; -+ printf(": ["); -+ return 0; -+} -+ -+static int json_supcon_value(struct renderer *r, const char *value, int last) -+{ -+ char buf[256]; -+ JESC(value, buf); -+ json_block(r, 4, 0); -+ return json_3rd_level(r, buf); -+} -+ -+static int json_supcon_end(struct renderer *r) -+{ -+ json_block(r, 4, 1); -+ return json_2nd_level(r, "]"); -+} -+ -+static int json_sup_start(struct renderer *r) -+{ -+ return json_supcon_start(r, "\"SupportedDevices\""); -+} -+ -+static int json_con_start(struct renderer *r) -+{ -+ return json_supcon_start(r, "\"ConflictingDevices\""); -+} -+ -+static int json_value_begin(struct renderer *r) -+{ -+ json_block(r, 3, 0); -+ return json_2nd_level(r, "\"Values\": {"); -+} -+ -+static int json_value_end(struct renderer *r) -+{ -+ json_block(r, 4, 1); -+ return json_2nd_level(r, "}"); -+} -+ -+static int json_value(struct renderer *r, const char *ident, const char *value) -+{ -+ char buf[256]; -+ int err; -+ -+ json_block(r, 4, 0); -+ JESC(ident, buf); -+ err = json_3rd_level(r, buf); -+ if (err < 0) -+ return err; -+ JESC(value, buf); -+ printf(": %s", buf); -+ return 0; -+} -+ -+static struct renderer json_renderer = { -+ .init = json_init, -+ .done = json_done, -+ .verb_begin = json_verb_start, -+ .verb_end = json_verb_end, -+ .device_block_begin = json_dev_block_start, -+ .device_block_end = json_2nd_level_block_end, -+ .device_begin = json_2nd_level_begin, -+ .device_end = json_2nd_level_end, -+ .modifier_block_begin = json_mod_block_start, -+ .modifier_block_end = json_2nd_level_block_end, -+ .modifier_begin = json_2nd_level_begin, -+ .modifier_end = json_2nd_level_end, -+ .supported_begin = json_sup_start, -+ .supported_value = json_supcon_value, -+ .supported_end = json_supcon_end, -+ .conflict_begin = json_con_start, -+ .conflict_value = json_supcon_value, -+ .conflict_end = json_supcon_end, -+ .value_begin = json_value_begin, -+ .value_end = json_value_end, -+ .value = json_value, -+}; -+ -+/* -+ * universal dump functions -+ */ -+ - static int render_devlist(struct context *context, - struct renderer *render, - const char *verb, -@@ -350,6 +572,12 @@ static void render(struct context *context, struct renderer *render) - context->command, verb); - continue; - } -+ if (dev_num == 0) -+ goto __mods; -+ if (render->device_block_begin && render->device_block_begin(render)) { -+ snd_use_case_free_list(dev_list, dev_num); -+ goto __end; -+ } - for (j = 0; j < dev_num; j += 2) { - render->device_begin(render, dev_list[j + 0], dev_list[j + 1]); - if (render_device(context, render, verb, dev_list[j + 0])) { -@@ -359,6 +587,9 @@ static void render(struct context *context, struct renderer *render) - render->device_end(render); - } - snd_use_case_free_list(dev_list, dev_num); -+ if (render->device_block_end && render->device_block_end(render)) -+ goto __end; -+__mods: - /* modifiers */ - snprintf(buf, sizeof(buf), "_modifiers/%s", verb); - dev_num = snd_use_case_get_list(uc_mgr, buf, &dev_list); -@@ -367,11 +598,20 @@ static void render(struct context *context, struct renderer *render) - context->command, verb); - continue; - } -+ if (dev_num == 0) -+ goto __verb_end; -+ if (render->modifier_block_begin && render->modifier_block_begin(render)) { -+ snd_use_case_free_list(dev_list, dev_num); -+ goto __end; -+ } - for (j = 0; j < dev_num; j += 2) { - render->modifier_begin(render, dev_list[j + 0], dev_list[j + 1]); - render->modifier_end(render); - } - snd_use_case_free_list(dev_list, dev_num); -+ if (render->modifier_block_end && render->modifier_block_end(render)) -+ goto __end; -+__verb_end: - /* end */ - if (render->verb_end(render)) - break; -@@ -385,14 +625,19 @@ __end: - void dump(struct context *context, const char *format) - { - struct renderer r; -+ struct text t; -+ struct json j; - - r.opaque = NULL; - if (strcasecmp(format, "text") == 0 || - strcasecmp(format, "txt") == 0) { -- struct text t; - memset(&t, 0, sizeof(t)); - r = text_renderer; - r.opaque = &t; -+ } else if (strcasecmp(format, "json") == 0) { -+ memset(&j, 0, sizeof(j)); -+ r = json_renderer; -+ r.opaque = &j; - } - if (r.opaque != NULL) { - render(context, &r); -diff --git a/alsaucm/usecase.c b/alsaucm/usecase.c -index 44fc92b..1ed91ea 100644 ---- a/alsaucm/usecase.c -+++ b/alsaucm/usecase.c -@@ -108,7 +108,7 @@ static void dump_help(struct context *context) - " reset reset sound card to default state\n" - " reload reload configuration\n" - " listcards list available cards\n" --" dump FORMAT dump all config information (format: text)\n" -+" dump FORMAT dump all config information (format: text,json)\n" - " list IDENTIFIER list command, for items with value + comment\n" - " list1 IDENTIFIER list command, for items without comments\n" - " get IDENTIFIER get string value\n" --- -2.24.1 - - -From 160b47e27c787880f1581a0f2e70138f6b24c41b Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Sat, 30 Nov 2019 20:38:17 +0100 -Subject: [PATCH 10/31] alsaucm: dump - fix the prefixed " - -Signed-off-by: Jaroslav Kysela ---- - alsaucm/dump.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/alsaucm/dump.c b/alsaucm/dump.c -index bc638f1..7a90c82 100644 ---- a/alsaucm/dump.c -+++ b/alsaucm/dump.c -@@ -73,9 +73,9 @@ static char *tesc(const char *s, char *buf, size_t buf_len) - buf_len--; - } - while (*s && buf_len > 2) { -- if (*s == '\"') { -+ if (*s == '"') { - if (buf_len > 3) { -- *dst++ = '"'; -+ *dst++ = '\\'; - *dst++ = *s++; - buf_len -= 2; - continue; -@@ -240,9 +240,9 @@ static char *jesc(const char *s, char *buf, size_t buf_len) - *dst++ = c; - buf_len--; - while (*s && buf_len > 2) { -- if (*s == '\"') { -+ if (*s == '"') { - if (buf_len > 3) { -- *dst++ = '"'; -+ *dst++ = '\\'; - *dst++ = *s++; - buf_len -= 2; - continue; --- -2.24.1 - - -From 34e373d0b12d96353c49c3dcd73ec52eee11484a Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 3 Dec 2019 13:53:25 +0100 -Subject: [PATCH 11/31] alsactl: fix --sched-idle (set it really to SCHED_IDLE) - -Reported-by: tommy -Signed-off-by: Jaroslav Kysela ---- - alsactl/Makefile.am | 2 ++ - alsactl/alsactl.c | 2 +- - 2 files changed, 3 insertions(+), 1 deletion(-) - -diff --git a/alsactl/Makefile.am b/alsactl/Makefile.am -index aaaf74e..e9ab2eb 100644 ---- a/alsactl/Makefile.am -+++ b/alsactl/Makefile.am -@@ -7,6 +7,8 @@ man_MANS += alsactl_init.7 - endif - EXTRA_DIST=alsactl.1 alsactl_init.xml - -+AM_CFLAGS = -D_GNU_SOURCE -+ - alsactl_SOURCES=alsactl.c state.c lock.c utils.c init_parse.c daemon.c \ - monitor.c - -diff --git a/alsactl/alsactl.c b/alsactl/alsactl.c -index 94cae23..dfb1db7 100644 ---- a/alsactl/alsactl.c -+++ b/alsactl/alsactl.c -@@ -161,7 +161,7 @@ static void do_nice(int use_nice, int sched_idle) - if (sched_idle) { - if (sched_getparam(0, &sched_param) >= 0) { - sched_param.sched_priority = 0; -- if (!sched_setscheduler(0, SCHED_RR, &sched_param)) -+ if (!sched_setscheduler(0, SCHED_IDLE, &sched_param)) - error("sched_setparam failed: %s", strerror(errno)); - } else { - error("sched_getparam failed: %s", strerror(errno)); --- -2.24.1 - - -From f77a269370af917585df59d8c21c89bca07b5b73 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 3 Dec 2019 20:51:56 +0100 -Subject: [PATCH 12/31] configure: Fix linking of alsatplg with the older libs - -BugLink: https://github.com/alsa-project/alsa-utils/issues/33 -Signed-off-by: Jaroslav Kysela ---- - configure.ac | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/configure.ac b/configure.ac -index a4a2dd4..4bee49b 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -70,6 +70,11 @@ AM_CONDITIONAL(HAVE_TOPOLOGY, test "$have_topology" = "yes") - AM_CONDITIONAL(HAVE_SAMPLERATE, test "$have_samplerate" = "yes") - AM_CONDITIONAL(HAVE_FFADO, test "$have_ffado" = "yes") - -+# old libasound with the topology routines in the main library -+if test "x$have_topology" = "xyes" -a "x$ALSA_TOPOLOGY_LIBS" = "x"; then -+ ALSA_TOPOLOGY_LIBS="$ALSA_LIBS" -+fi -+ - dnl Use tinyalsa - alsabat_backend_tiny= - AC_ARG_ENABLE(alsabat_backend_tiny, --- -2.24.1 - - -From 08d2341a176248a346efbdaa6d8878f3ebd627da Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Thu, 12 Dec 2019 19:00:42 +0100 -Subject: [PATCH 13/31] alsatplg: add -n,--normalize option - -This function loads and parses the topology file and -saves back the structured output in the alsa-lib's format -without comments. - -Signed-off-by: Jaroslav Kysela ---- - topology/topology.c | 165 ++++++++++++++++++++++++++++++++++++++------ - 1 file changed, 145 insertions(+), 20 deletions(-) - -diff --git a/topology/topology.c b/topology/topology.c -index b72e341..a6ebafa 100644 ---- a/topology/topology.c -+++ b/topology/topology.c -@@ -43,23 +43,154 @@ _("Usage: %s [OPTIONS]...\n" - "\n" - "-h, --help help\n" - "-c, --compile=FILE compile file\n" -+"-n, --normalize=FILE normalize file\n" - "-v, --verbose=LEVEL set verbosity level (0...1)\n" - "-o, --output=FILE set output file\n" - ), name); - } - --int main(int argc, char *argv[]) -+static int _compar(const void *a, const void *b) -+{ -+ const snd_config_t *c1 = *(snd_config_t **)a; -+ const snd_config_t *c2 = *(snd_config_t **)b; -+ const char *id1, *id2; -+ if (snd_config_get_id(c1, &id1)) return 0; -+ if (snd_config_get_id(c2, &id2)) return 0; -+ return strcmp(id1, id2); -+} -+ -+static snd_config_t *normalize_config(const char *id, snd_config_t *src) -+{ -+ snd_config_t *dst, **a; -+ snd_config_iterator_t i, next; -+ int index, count; -+ -+ if (snd_config_get_type(src) != SND_CONFIG_TYPE_COMPOUND) { -+ if (snd_config_copy(&dst, src) >= 0) -+ return dst; -+ return NULL; -+ } -+ if (snd_config_make_compound(&dst, id, 0)) -+ return NULL; -+ count = 0; -+ snd_config_for_each(i, next, src) -+ count++; -+ a = malloc(sizeof(dst) * count); -+ if (a == NULL) -+ return NULL; -+ index = 0; -+ snd_config_for_each(i, next, src) { -+ snd_config_t *s = snd_config_iterator_entry(i); -+ a[index++] = s; -+ } -+ qsort(a, count, sizeof(a[0]), _compar); -+ for (index = 0; index < count; index++) { -+ snd_config_t *s = a[index]; -+ const char *id2; -+ if (snd_config_get_id(s, &id2)) { -+ snd_config_delete(dst); -+ return NULL; -+ } -+ s = normalize_config(id2, s); -+ if (s == NULL || snd_config_add(dst, s)) { -+ snd_config_delete(dst); -+ return NULL; -+ } -+ } -+ return dst; -+} -+ -+static int compile(const char *source_file, const char *output_file, int verbose) - { - snd_tplg_t *snd_tplg; -- static const char short_options[] = "hc:v:o:"; -+ int err; -+ -+ snd_tplg = snd_tplg_new(); -+ if (snd_tplg == NULL) { -+ fprintf(stderr, _("failed to create new topology context\n")); -+ return 1; -+ } -+ -+ snd_tplg_verbose(snd_tplg, verbose); -+ -+ err = snd_tplg_build_file(snd_tplg, source_file, output_file); -+ if (err < 0) { -+ fprintf(stderr, _("failed to compile context %s\n"), source_file); -+ snd_tplg_free(snd_tplg); -+ unlink(output_file); -+ return 1; -+ } -+ -+ snd_tplg_free(snd_tplg); -+ return 1; -+} -+ -+static int normalize(const char *source_file, const char *output_file) -+{ -+ snd_input_t *input; -+ snd_output_t *output; -+ snd_config_t *top, *norm; -+ int err; -+ -+ err = snd_input_stdio_open(&input, source_file, "r"); -+ if (err < 0) { -+ fprintf(stderr, "Unable to open source file '%s': %s\n", source_file, snd_strerror(-err)); -+ return 0; -+ } -+ -+ err = snd_config_top(&top); -+ if (err < 0) { -+ snd_input_close(input); -+ return 1; -+ } -+ -+ err = snd_config_load(top, input); -+ snd_input_close(input); -+ if (err < 0) { -+ snd_config_delete(top); -+ fprintf(stderr, "Unable to parse source file '%s': %s\n", source_file, snd_strerror(-err)); -+ snd_config_delete(top); -+ return 1; -+ } -+ -+ err = snd_output_stdio_open(&output, output_file, "w+"); -+ if (err < 0) { -+ fprintf(stderr, "Unable to open output file '%s': %s\n", output_file, snd_strerror(-err)); -+ snd_config_delete(top); -+ return 1; -+ } -+ -+ norm = normalize_config(NULL, top); -+ if (norm == NULL) { -+ fprintf(stderr, "Unable to normalize configuration (out of memory?)\n"); -+ snd_output_close(output); -+ snd_config_delete(top); -+ return 1; -+ } -+ -+ err = snd_config_save(norm, output); -+ snd_output_close(output); -+ snd_config_delete(top); -+ if (err < 0) { -+ fprintf(stderr, "Unable to save normalized contents: %s\n", snd_strerror(-err)); -+ return 1; -+ } -+ -+ return 0; -+} -+ -+int main(int argc, char *argv[]) -+{ -+ static const char short_options[] = "hc:n:v:o:"; - static const struct option long_options[] = { - {"help", 0, NULL, 'h'}, - {"verbose", 1, NULL, 'v'}, - {"compile", 1, NULL, 'c'}, -+ {"normalize", 1, NULL, 'n'}, - {"output", 1, NULL, 'o'}, - {0, 0, 0, 0}, - }; -- char *source_file = NULL, *output_file = NULL; -+ char *source_file = NULL, *normalize_file = NULL, *output_file = NULL; - int c, err, verbose = 0, option_index; - - #ifdef ENABLE_NLS -@@ -81,6 +212,9 @@ int main(int argc, char *argv[]) - case 'c': - source_file = optarg; - break; -+ case 'n': -+ normalize_file = optarg; -+ break; - case 'o': - output_file = optarg; - break; -@@ -90,28 +224,19 @@ int main(int argc, char *argv[]) - } - } - -- if (source_file == NULL || output_file == NULL) { -- usage(argv[0]); -- return 1; -- } -- -- snd_tplg = snd_tplg_new(); -- if (snd_tplg == NULL) { -- fprintf(stderr, _("failed to create new topology context\n")); -+ if (source_file && normalize_file) { -+ fprintf(stderr, "Cannot normalize and compile at a time!\n"); - return 1; - } - -- snd_tplg_verbose(snd_tplg, verbose); -- -- err = snd_tplg_build_file(snd_tplg, source_file, output_file); -- if (err < 0) { -- fprintf(stderr, _("failed to compile context %s\n"), source_file); -- snd_tplg_free(snd_tplg); -- unlink(output_file); -+ if ((source_file == NULL && normalize_file == NULL) || output_file == NULL) { -+ usage(argv[0]); - return 1; - } - -- snd_tplg_free(snd_tplg); -+ if (source_file) -+ err = compile(source_file, output_file, verbose); -+ else -+ err = normalize(normalize_file, output_file); - return 0; - } -- --- -2.24.1 - - -From 2656d4bec8fab8b4b9046d3b8c9c255dc2166014 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Thu, 12 Dec 2019 19:18:28 +0100 -Subject: [PATCH 14/31] alsatplg: add -s,--sort and fix memory leaks - -Signed-off-by: Jaroslav Kysela ---- - topology/topology.c | 34 ++++++++++++++++++++++++---------- - 1 file changed, 24 insertions(+), 10 deletions(-) - -diff --git a/topology/topology.c b/topology/topology.c -index a6ebafa..c12be78 100644 ---- a/topology/topology.c -+++ b/topology/topology.c -@@ -46,6 +46,7 @@ _("Usage: %s [OPTIONS]...\n" - "-n, --normalize=FILE normalize file\n" - "-v, --verbose=LEVEL set verbosity level (0...1)\n" - "-o, --output=FILE set output file\n" -+"-s, --sort sort the identifiers in the normalized output\n" - ), name); - } - -@@ -59,7 +60,7 @@ static int _compar(const void *a, const void *b) - return strcmp(id1, id2); - } - --static snd_config_t *normalize_config(const char *id, snd_config_t *src) -+static snd_config_t *normalize_config(const char *id, snd_config_t *src, int sort) - { - snd_config_t *dst, **a; - snd_config_iterator_t i, next; -@@ -70,8 +71,6 @@ static snd_config_t *normalize_config(const char *id, snd_config_t *src) - return dst; - return NULL; - } -- if (snd_config_make_compound(&dst, id, 0)) -- return NULL; - count = 0; - snd_config_for_each(i, next, src) - count++; -@@ -83,20 +82,28 @@ static snd_config_t *normalize_config(const char *id, snd_config_t *src) - snd_config_t *s = snd_config_iterator_entry(i); - a[index++] = s; - } -- qsort(a, count, sizeof(a[0]), _compar); -+ if (sort) -+ qsort(a, count, sizeof(a[0]), _compar); -+ if (snd_config_make_compound(&dst, id, count == 1)) { -+ free(a); -+ return NULL; -+ } - for (index = 0; index < count; index++) { - snd_config_t *s = a[index]; - const char *id2; - if (snd_config_get_id(s, &id2)) { - snd_config_delete(dst); -+ free(a); - return NULL; - } -- s = normalize_config(id2, s); -+ s = normalize_config(id2, s, sort); - if (s == NULL || snd_config_add(dst, s)) { - snd_config_delete(dst); -+ free(a); - return NULL; - } - } -+ free(a); - return dst; - } - -@@ -125,7 +132,7 @@ static int compile(const char *source_file, const char *output_file, int verbose - return 1; - } - --static int normalize(const char *source_file, const char *output_file) -+static int normalize(const char *source_file, const char *output_file, int sort) - { - snd_input_t *input; - snd_output_t *output; -@@ -160,7 +167,7 @@ static int normalize(const char *source_file, const char *output_file) - return 1; - } - -- norm = normalize_config(NULL, top); -+ norm = normalize_config(NULL, top, sort); - if (norm == NULL) { - fprintf(stderr, "Unable to normalize configuration (out of memory?)\n"); - snd_output_close(output); -@@ -170,6 +177,7 @@ static int normalize(const char *source_file, const char *output_file) - - err = snd_config_save(norm, output); - snd_output_close(output); -+ snd_config_delete(norm); - snd_config_delete(top); - if (err < 0) { - fprintf(stderr, "Unable to save normalized contents: %s\n", snd_strerror(-err)); -@@ -181,17 +189,18 @@ static int normalize(const char *source_file, const char *output_file) - - int main(int argc, char *argv[]) - { -- static const char short_options[] = "hc:n:v:o:"; -+ static const char short_options[] = "hc:n:v:o:s"; - static const struct option long_options[] = { - {"help", 0, NULL, 'h'}, - {"verbose", 1, NULL, 'v'}, - {"compile", 1, NULL, 'c'}, - {"normalize", 1, NULL, 'n'}, - {"output", 1, NULL, 'o'}, -+ {"sort", 0, NULL, 's'}, - {0, 0, 0, 0}, - }; - char *source_file = NULL, *normalize_file = NULL, *output_file = NULL; -- int c, err, verbose = 0, option_index; -+ int c, err, verbose = 0, sort = 0, option_index; - - #ifdef ENABLE_NLS - setlocale(LC_ALL, ""); -@@ -218,6 +227,9 @@ int main(int argc, char *argv[]) - case 'o': - output_file = optarg; - break; -+ case 's': -+ sort = 1; -+ break; - default: - fprintf(stderr, _("Try `%s --help' for more information.\n"), argv[0]); - return 1; -@@ -237,6 +249,8 @@ int main(int argc, char *argv[]) - if (source_file) - err = compile(source_file, output_file, verbose); - else -- err = normalize(normalize_file, output_file); -+ err = normalize(normalize_file, output_file, sort); -+ -+ snd_output_close(log); - return 0; - } --- -2.24.1 - - -From 10db898d9b97f0a8d3093405ad5b4aa4ed53801d Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 13 Dec 2019 10:44:36 +0100 -Subject: [PATCH 15/31] alsatplg: fix another small leak in normalize_config() - -Signed-off-by: Jaroslav Kysela ---- - topology/topology.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/topology/topology.c b/topology/topology.c -index c12be78..bc5797c 100644 ---- a/topology/topology.c -+++ b/topology/topology.c -@@ -98,6 +98,8 @@ static snd_config_t *normalize_config(const char *id, snd_config_t *src, int sor - } - s = normalize_config(id2, s, sort); - if (s == NULL || snd_config_add(dst, s)) { -+ if (s) -+ snd_config_delete(s); - snd_config_delete(dst); - free(a); - return NULL; --- -2.24.1 - - -From 11e083d81c330539f0f170bb238a17b1c2e0cb4d Mon Sep 17 00:00:00 2001 -From: David Ward -Date: Sat, 21 Dec 2019 00:32:01 -0500 -Subject: [PATCH 16/31] alsa-info.sh: Consolidate PCI device output - -Include numeric IDs and subsystem info in the PCI device output, -without placing them in a separate section. - -Signed-off-by: David Ward -Signed-off-by: Takashi Iwai ---- - alsa-info/alsa-info.sh | 10 +++------- - 1 file changed, 3 insertions(+), 7 deletions(-) - -diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh -index cf7ad89..8fc6997 100755 ---- a/alsa-info/alsa-info.sh -+++ b/alsa-info/alsa-info.sh -@@ -455,7 +455,9 @@ fi - cat /proc/asound/modules 2>/dev/null | awk '{ print $2 }' > $TEMPDIR/alsamodules.tmp - cat /proc/asound/cards > $TEMPDIR/alsacards.tmp - if [[ ! -z "$LSPCI" ]]; then -- lspci | grep -i "multi\|audio">$TEMPDIR/lspci.tmp -+ for class in 0401 0402 0403; do -+ lspci -vvnn -d "::$class" | sed -n '/^[^\t]/,+1p' -+ done > $TEMPDIR/lspci.tmp - fi - - #Check for HDA-Intel cards codec#* -@@ -585,12 +587,6 @@ echo "" >> $FILE - cat $TEMPDIR/lspci.tmp >> $FILE - echo "" >> $FILE - echo "" >> $FILE --echo "!!Advanced information - PCI Vendor/Device/Subsystem ID's" >> $FILE --echo "!!-------------------------------------------------------" >> $FILE --echo "" >> $FILE --lspci -vvn |grep -A1 040[1-3] >> $FILE --echo "" >> $FILE --echo "" >> $FILE - fi - - if [ "$SNDOPTIONS" ] --- -2.24.1 - - -From 86b1f80e24b68ce8153874e6ac851fa2b90c43b5 Mon Sep 17 00:00:00 2001 -From: David Ward -Date: Sat, 21 Dec 2019 00:32:02 -0500 -Subject: [PATCH 17/31] alsa-info.sh: Read from /proc/modules and sort the - result - -Sorting the list of loaded modules makes it much easier to compare -two alsa-info.txt files, even if they are both from the same system -(since the order actually changes after each reboot). - -lsmod just formats the contents of /proc/modules. After this script -calls lsmod, it strips everything but module names from the output. -This same result can be obtained just as easily by reading directly -from /proc/modules; then there is no need to remove the header line -printed by lsmod before sorting the output. - -Signed-off-by: David Ward -Signed-off-by: Takashi Iwai ---- - alsa-info/alsa-info.sh | 9 ++++----- - 1 file changed, 4 insertions(+), 5 deletions(-) - -diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh -index 8fc6997..ed1d9e2 100755 ---- a/alsa-info/alsa-info.sh -+++ b/alsa-info/alsa-info.sh -@@ -35,7 +35,7 @@ BGTITLE="ALSA-Info v $SCRIPT_VERSION" - PASTEBINKEY="C9cRIO8m/9y8Cs0nVs0FraRx7U0pHsuc" - - WGET=$(which wget 2>/dev/null | sed 's|^[^/]*||' 2>/dev/null) --REQUIRES="mktemp grep pgrep whereis ping awk date uname cat dmesg amixer alsactl" -+REQUIRES="mktemp grep pgrep whereis ping awk date uname cat sort dmesg amixer alsactl" - - # - # Define some simple functions -@@ -131,11 +131,11 @@ withaplay() { - echo "" >> $FILE - } - --withlsmod() { -+withmodules() { - echo "!!All Loaded Modules" >> $FILE - echo "!!------------------" >> $FILE - echo "" >> $FILE -- lsmod | awk '{print $1}' >> $FILE -+ awk '{print $1}' < /proc/modules | sort >> $FILE - echo "" >> $FILE - echo "" >> $FILE - } -@@ -254,7 +254,7 @@ withall() { - withaplay - withamixer - withalsactl -- withlsmod -+ withmodules - withsysfs - withdmesg - WITHALL="no" -@@ -366,7 +366,6 @@ information about your ALSA installation and sound related hardware. - - dmesg - lspci -- lsmod - aplay - amixer - alsactl --- -2.24.1 - - -From 068dd55717d4e020849e4dd12610d16968cf49be Mon Sep 17 00:00:00 2001 -From: David Ward -Date: Sat, 21 Dec 2019 00:32:03 -0500 -Subject: [PATCH 18/31] alsa-info.sh: Simplify iteration over cards when - calling amixer - -Read card names directly from individual procfs files, and pass them -to amixer using the '-c' option. - -Signed-off-by: David Ward -Signed-off-by: Takashi Iwai ---- - alsa-info/alsa-info.sh | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh -index ed1d9e2..e1067d4 100755 ---- a/alsa-info/alsa-info.sh -+++ b/alsa-info/alsa-info.sh -@@ -144,12 +144,12 @@ withamixer() { - echo "!!Amixer output" >> $FILE - echo "!!-------------" >> $FILE - echo "" >> $FILE -- for i in $(grep "]: " /proc/asound/cards | awk -F ' ' '{ print $1 }') ; do -- CARD_NAME=$(grep "^ *$i " $TEMPDIR/alsacards.tmp | awk '{ print $2 }') -- echo "!!-------Mixer controls for card $i $CARD_NAME]" >> $FILE -+ for f in /proc/asound/card*/id; do -+ [ -f "$f" ] && read -r CARD_NAME < "$f" || continue -+ echo "!!-------Mixer controls for card $CARD_NAME" >> $FILE - echo "" >>$FILE -- amixer -c$i info >> $FILE 2>&1 -- amixer -c$i >> $FILE 2>&1 -+ amixer -c "$CARD_NAME" info >> $FILE 2>&1 -+ amixer -c "$CARD_NAME" >> $FILE 2>&1 - echo "" >> $FILE - done - echo "" >> $FILE --- -2.24.1 - - -From de5ce14163dbc1337075de1f5d632fd49865a338 Mon Sep 17 00:00:00 2001 -From: David Ward -Date: Sat, 21 Dec 2019 00:32:04 -0500 -Subject: [PATCH 19/31] alsa-info.sh: Use existing function to print ALSA - configuration files - -Signed-off-by: David Ward -Signed-off-by: Takashi Iwai ---- - alsa-info/alsa-info.sh | 27 +-------------------------- - 1 file changed, 1 insertion(+), 26 deletions(-) - -diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh -index e1067d4..bf353de 100755 ---- a/alsa-info/alsa-info.sh -+++ b/alsa-info/alsa-info.sh -@@ -710,33 +710,8 @@ if [ -n "$1" ]; then - WITHALL="no" - ;; - --with-configs) -+ withconfigs - WITHALL="no" -- if [[ -e $HOME/.asoundrc ]] || [[ -e /etc/asound.conf ]] -- then -- echo "!!ALSA configuration files" >> $FILE -- echo "!!------------------------" >> $FILE -- echo "" >> $FILE -- -- #Check for ~/.asoundrc -- if [[ -e $HOME/.asoundrc ]] -- then -- echo "!!User specific config file ($HOME/.asoundrc)" >> $FILE -- echo "" >> $FILE -- cat $HOME/.asoundrc >> $FILE -- echo "" >> $FILE -- echo "" >> $FILE -- fi -- -- #Check for /etc/asound.conf -- if [[ -e /etc/asound.conf ]] -- then -- echo "!!System wide config file (/etc/asound.conf)" >> $FILE -- echo "" >> $FILE -- cat /etc/asound.conf >> $FILE -- echo "" >> $FILE -- echo "" >> $FILE -- fi -- fi - ;; - --stdout) - UPLOAD="no" --- -2.24.1 - - -From e9e3c3a27d4faad0000a10386da471227b0644d8 Mon Sep 17 00:00:00 2001 -From: David Ward -Date: Sat, 21 Dec 2019 00:32:05 -0500 -Subject: [PATCH 20/31] alsa-info.sh: Exit script after writing information to - stdout - -The '--stdout' option is mutually exclusive with uploading the file. - -Signed-off-by: David Ward -Signed-off-by: Takashi Iwai ---- - alsa-info/alsa-info.sh | 17 ++++++----------- - 1 file changed, 6 insertions(+), 11 deletions(-) - -diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh -index bf353de..372d7ae 100755 ---- a/alsa-info/alsa-info.sh -+++ b/alsa-info/alsa-info.sh -@@ -349,9 +349,7 @@ case "$1" in - ;; - --stdout) - DIALOG="" -- UPLOAD="no" - WELCOME="no" -- TOSTDOUT="yes" - ;; - esac - done -@@ -720,6 +718,7 @@ if [ -n "$1" ]; then - fi - cat $FILE - rm $FILE -+ exit - ;; - --about) - echo "Written/Tested by the following users of #alsa on irc.freenode.net:" -@@ -793,10 +792,8 @@ fi - - if [ "$UPLOAD" = "no" ]; then - -- if [ -z "$TOSTDOUT" ]; then -- mv -f $FILE $NFILE || exit 1 -- KEEP_OUTPUT="yes" -- fi -+ mv -f $FILE $NFILE || exit 1 -+ KEEP_OUTPUT="yes" - - if [[ -n $DIALOG ]] - then -@@ -815,11 +812,9 @@ if [ "$UPLOAD" = "no" ]; then - echo "Your ALSA information is in $NFILE" - echo "" - else -- if [ -z "$TOSTDOUT" ]; then -- echo "" -- echo "Your ALSA information is in $NFILE" -- echo "" -- fi -+ echo "" -+ echo "Your ALSA information is in $NFILE" -+ echo "" - fi - fi - --- -2.24.1 - - -From d928f7667cfead36b33f38ad7668ca96c6045d4e Mon Sep 17 00:00:00 2001 -From: David Ward -Date: Sat, 21 Dec 2019 00:32:06 -0500 -Subject: [PATCH 21/31] alsa-info.sh: Replace gauge with infobox for upload - dialog - -The gauge did not actually show the upload progress; in fact, the -dialog did not even appear until after the upload was completed. - -Use an infobox instead, which will be displayed while wget runs. - -Signed-off-by: David Ward -Signed-off-by: Takashi Iwai ---- - alsa-info/alsa-info.sh | 12 ++---------- - 1 file changed, 2 insertions(+), 10 deletions(-) - -diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh -index 372d7ae..a02864d 100755 ---- a/alsa-info/alsa-info.sh -+++ b/alsa-info/alsa-info.sh -@@ -830,19 +830,11 @@ if [[ -n $DIALOG ]] - then - - if [[ -z $PASTEBIN ]]; then -+ dialog --backtitle "$BGTITLE" --infobox "Uploading information to www.alsa-project.org ..." 6 70 - wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://www.alsa-project.org/cardinfo-db/" &>$TEMPDIR/wget.tmp || echo "Upload failed; exit" -- { for i in 10 20 30 40 50 60 70 80 90; do -- echo $i -- sleep 0.2 -- done -- echo; } |dialog --backtitle "$BGTITLE" --guage "Uploading information to www.alsa-project.org ..." 6 70 0 - else -+ dialog --backtitle "$BGTITLE" --infobox "Uploading information to www.pastebin.ca ..." 6 70 - wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://pastebin.ca/quiet-paste.php?api=$PASTEBINKEY&encrypt=t&encryptpw=blahblah" &>$TEMPDIR/wget.tmp || echo "Upload failed; exit" -- { for i in 10 20 30 40 50 60 70 80 90; do -- echo $i -- sleep 0.2 -- done -- echo; } |dialog --backtitle "$BGTITLE" --guage "Uploading information to www.pastebin.ca ..." 6 70 0 - fi - - dialog --backtitle "$BGTITLE" --title "Information uploaded" --yesno "Would you like to see the uploaded information?" 5 100 --- -2.24.1 - - -From 1ebe877b8d89c74e76efd47f2a4dba6cfccf86af Mon Sep 17 00:00:00 2001 -From: David Ward -Date: Sat, 21 Dec 2019 00:32:07 -0500 -Subject: [PATCH 22/31] alsa-info.sh: Remove progress spinner during upload - without dialog - -The spinner did not actually provide information about the status -of the file upload, and caused other problems: it would repeatedly -spawn new pgrep processes (without a delay between them), and it -blocked the script if any wget process was running on the system. - -Signed-off-by: David Ward -Signed-off-by: Takashi Iwai ---- - alsa-info/alsa-info.sh | 11 +---------- - 1 file changed, 1 insertion(+), 10 deletions(-) - -diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh -index a02864d..9bc8c38 100755 ---- a/alsa-info/alsa-info.sh -+++ b/alsa-info/alsa-info.sh -@@ -857,16 +857,7 @@ else - wget -O - --tries=5 --timeout=60 --post-file=$FILE http://pastebin.ca/quiet-paste.php?api=$PASTEBINKEY &>$TEMPDIR/wget.tmp & - fi - --#Progess spinner for wget transfer. --i=1 --sp="/-\|" --echo -n ' ' --while pgrep wget &>/dev/null --do -- echo -en "\b${sp:i++%${#sp}:1}" --done -- --echo -e "\b Done!" -+echo -e " Done!" - echo "" - - fi # dialog --- -2.24.1 - - -From ad49ee756bbc355aa2cf7e9931c81fde17a50913 Mon Sep 17 00:00:00 2001 -From: David Ward -Date: Sat, 21 Dec 2019 00:32:08 -0500 -Subject: [PATCH 23/31] alsa-info.sh: Condense nested commands for file upload - -Signed-off-by: David Ward -Signed-off-by: Takashi Iwai ---- - alsa-info/alsa-info.sh | 16 ++++++---------- - 1 file changed, 6 insertions(+), 10 deletions(-) - -diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh -index 9bc8c38..7560b0d 100755 ---- a/alsa-info/alsa-info.sh -+++ b/alsa-info/alsa-info.sh -@@ -828,15 +828,19 @@ then - - if [[ -n $DIALOG ]] - then -+ dialog --backtitle "$BGTITLE" --infobox "Uploading information to $WWWSERVICE ..." 6 70 -+else -+ echo -n "Uploading information to $WWWSERVICE ..." -+fi - - if [[ -z $PASTEBIN ]]; then -- dialog --backtitle "$BGTITLE" --infobox "Uploading information to www.alsa-project.org ..." 6 70 - wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://www.alsa-project.org/cardinfo-db/" &>$TEMPDIR/wget.tmp || echo "Upload failed; exit" - else -- dialog --backtitle "$BGTITLE" --infobox "Uploading information to www.pastebin.ca ..." 6 70 - wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://pastebin.ca/quiet-paste.php?api=$PASTEBINKEY&encrypt=t&encryptpw=blahblah" &>$TEMPDIR/wget.tmp || echo "Upload failed; exit" - fi - -+if [ -n "$DIALOG" ]; then -+ - dialog --backtitle "$BGTITLE" --title "Information uploaded" --yesno "Would you like to see the uploaded information?" 5 100 - DIALOG_EXIT_CODE=$? - if [ $DIALOG_EXIT_CODE = 0 ]; then -@@ -849,14 +853,6 @@ clear - # no dialog - else - --if [[ -z $PASTEBIN ]]; then -- echo -n "Uploading information to www.alsa-project.org ... " -- wget -O - --tries=5 --timeout=60 --post-file=$FILE http://www.alsa-project.org/cardinfo-db/ &>$TEMPDIR/wget.tmp & --else -- echo -n "Uploading information to www.pastebin.ca ... " -- wget -O - --tries=5 --timeout=60 --post-file=$FILE http://pastebin.ca/quiet-paste.php?api=$PASTEBINKEY &>$TEMPDIR/wget.tmp & --fi -- - echo -e " Done!" - echo "" - --- -2.24.1 - - -From f93d491a08c7a5c34642aac166d0329c27eaa502 Mon Sep 17 00:00:00 2001 -From: David Ward -Date: Sat, 21 Dec 2019 00:32:09 -0500 -Subject: [PATCH 24/31] alsa-info.sh: Condense nested commands for formatting - upload result - -Signed-off-by: David Ward -Signed-off-by: Takashi Iwai ---- - alsa-info/alsa-info.sh | 20 ++++++++------------ - 1 file changed, 8 insertions(+), 12 deletions(-) - -diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh -index 7560b0d..8b4745b 100755 ---- a/alsa-info/alsa-info.sh -+++ b/alsa-info/alsa-info.sh -@@ -858,19 +858,15 @@ echo "" - - fi # dialog - --# See if tput is available, and use it if it is. --if [ -n "$TPUT" ]; then -- if [[ -z $PASTEBIN ]]; then -- FINAL_URL=$(tput setaf 1; grep "SUCCESS:" $TEMPDIR/wget.tmp | cut -d ' ' -f 2 ; tput sgr0) -- else -- FINAL_URL=$(tput setaf 1; grep "SUCCESS:" $TEMPDIR/wget.tmp | sed -n 's/.*\:\([0-9]\+\).*/http:\/\/pastebin.ca\/\1/p'; tput sgr0) -- fi -+if [ -z "$PASTEBIN" ]; then -+ FINAL_URL=$(grep "SUCCESS:" $TEMPDIR/wget.tmp | cut -d ' ' -f 2) - else -- if [[ -z $PASTEBIN ]]; then -- FINAL_URL=$(grep "SUCCESS:" $TEMPDIR/wget.tmp | cut -d ' ' -f 2) -- else -- FINAL_URL=$(grep "SUCCESS:" $TEMPDIR/wget.tmp | sed -n 's/.*\:\([0-9]\+\).*/http:\/\/pastebin.ca\/\1/p') -- fi -+ FINAL_URL=$(grep "SUCCESS:" $TEMPDIR/wget.tmp | sed -n 's/.*\:\([0-9]\+\).*/http:\/\/pastebin.ca\/\1/p') -+fi -+ -+# See if tput is available, and use it if it is. -+if [ -x "$TPUT" ]; then -+ FINAL_URL=$(tput setaf 1; printf '%s' "$FINAL_URL"; tput sgr0) - fi - - # Output the URL of the uploaded file. --- -2.24.1 - - -From fe322c46e6c2ae6ce130eed70f33a42fc4f6295a Mon Sep 17 00:00:00 2001 -From: David Ward -Date: Sat, 21 Dec 2019 00:32:10 -0500 -Subject: [PATCH 25/31] alsa-info.sh: Perform test for wget earlier - -If wget is not present, do not ask about uploading the information. - -Signed-off-by: David Ward -Signed-off-by: Takashi Iwai ---- - alsa-info/alsa-info.sh | 73 ++++++++++++++++++++---------------------- - 1 file changed, 35 insertions(+), 38 deletions(-) - -diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh -index 8b4745b..399d662 100755 ---- a/alsa-info/alsa-info.sh -+++ b/alsa-info/alsa-info.sh -@@ -769,6 +769,41 @@ if [ -z "$WITHALL" ]; then - withall - fi - -+# Check if wget is installed, and supports --post-file. -+if ! wget --help 2>/dev/null | grep -q post-file; then -+ # We couldn't find a suitable wget. If --upload was passed, tell the user to upload manually. -+ if [ "$UPLOAD" != "yes" ]; then -+ : -+ elif [ -n "$DIALOG" ]; then -+ if [ -z "$PASTEBIN" ]; then -+ dialog --backtitle "$BGTITLE" --msgbox "Could not automatically upload output to http://www.alsa-project.org.\nPossible reasons are:\n\n 1. Couldn't find 'wget' in your PATH\n 2. Your version of wget is less than 1.8.2\n\nPlease manually upload $NFILE to http://www.alsa-project.org/cardinfo-db/ and submit your post." 25 100 -+ else -+ dialog --backtitle "$BGTITLE" --msgbox "Could not automatically upload output to http://www.pastebin.ca.\nPossible reasons are:\n\n 1. Couldn't find 'wget' in your PATH\n 2. Your version of wget is less than 1.8.2\n\nPlease manually upload $NFILE to http://www.pastebin.ca/upload.php and submit your post." 25 100 -+ fi -+ else -+ if [ -z "$PASTEBIN" ]; then -+ echo "" -+ echo "Could not automatically upload output to http://www.alsa-project.org" -+ echo "Possible reasons are:" -+ echo " 1. Couldn't find 'wget' in your PATH" -+ echo " 2. Your version of wget is less than 1.8.2" -+ echo "" -+ echo "Please manually upload $NFILE to http://www.alsa-project.org/cardinfo-db/ and submit your post." -+ echo "" -+ else -+ echo "" -+ echo "Could not automatically upload output to http://www.pastebin.ca" -+ echo "Possible reasons are:" -+ echo " 1. Couldn't find 'wget' in your PATH" -+ echo " 2. Your version of wget is less than 1.8.2" -+ echo "" -+ echo "Please manually upload $NFILE to http://www.pastebin.ca/upload.php and submit your post." -+ echo "" -+ fi -+ fi -+ UPLOAD="no" -+fi -+ - if [ "$UPLOAD" = "ask" ]; then - if [ -n "$DIALOG" ]; then - dialog --backtitle "$BGTITLE" --title "Information collected" --yes-label " UPLOAD / SHARE " --no-label " SAVE LOCALLY " --defaultno --yesno "\n\nAutomatically upload ALSA information to $WWWSERVICE?" 10 80 -@@ -822,10 +857,6 @@ if [ "$UPLOAD" = "no" ]; then - - fi # UPLOAD - --# Test that wget is installed, and supports --post-file. Upload $FILE if it does, and prompt user to upload file if it does not. --if [[ -n "${WGET}" ]] && [[ -x "${WGET}" ]] && [[ $(wget --help | grep post-file) ]] --then -- - if [[ -n $DIALOG ]] - then - dialog --backtitle "$BGTITLE" --infobox "Uploading information to $WWWSERVICE ..." 6 70 -@@ -873,37 +904,3 @@ fi - echo "Your ALSA information is located at $FINAL_URL" - echo "Please inform the person helping you." - echo "" -- --# We couldnt find a suitable wget, so tell the user to upload manually. --else -- mv -f $FILE $NFILE || exit 1 -- KEEP_OUTPUT="yes" -- if [[ -z $DIALOG ]] -- then -- if [[ -z $PASTEBIN ]]; then -- echo "" -- echo "Could not automatically upload output to http://www.alsa-project.org" -- echo "Possible reasons are:" -- echo " 1. Couldnt find 'wget' in your PATH" -- echo " 2. Your version of wget is less than 1.8.2" -- echo "" -- echo "Please manually upload $NFILE to http://www.alsa-project.org/cardinfo-db/ and submit your post." -- echo "" -- else -- echo "" -- echo "Could not automatically upload output to http://www.pastebin.ca" -- echo "Possible reasons are:" -- echo " 1. Couldnt find 'wget' in your PATH" -- echo " 2. Your version of wget is less than 1.8.2" -- echo "" -- echo "Please manually upload $NFILE to http://www.pastebin.ca/upload.php and submit your post." -- echo "" -- fi -- else -- if [[ -z $PASTEBIN ]]; then -- dialog --backtitle "$BGTITLE" --msgbox "Could not automatically upload output to http://www.alsa-project.org.\nPossible reasons are:\n\n 1. Couldn't find 'wget' in your PATH\n 2. Your version of wget is less than 1.8.2\n\nPlease manually upload $NFILE to http://www.alsa-project,org/cardinfo-db/ and submit your post." 25 100 -- else -- dialog --backtitle "$BGTITLE" --msgbox "Could not automatically upload output to http://www.pastebin.ca.\nPossible reasons are:\n\n 1. Couldn't find 'wget' in your PATH\n 2. Your version of wget is less than 1.8.2\n\nPlease manually upload $NFILE to http://www.pastebin.ca/upload.php and submit your post." 25 100 -- fi -- fi --fi --- -2.24.1 - - -From 27b5c6c19c8d3b4e994f258dc5e51571726ff924 Mon Sep 17 00:00:00 2001 -From: David Ward -Date: Sat, 21 Dec 2019 00:32:11 -0500 -Subject: [PATCH 26/31] alsa-info.sh: Warn after actual upload failure; do not - ping server - -Check the return value of wget to determine if the upload actually -failed. If so, display the message about upload failure, then exit. - -Do not ping the web server; the result does not indicate whether a -file upload will succeed or not. - -Signed-off-by: David Ward -Signed-off-by: Takashi Iwai ---- - alsa-info/alsa-info.sh | 58 ++++++++++++++++++------------------------ - 1 file changed, 25 insertions(+), 33 deletions(-) - -diff --git a/alsa-info/alsa-info.sh b/alsa-info/alsa-info.sh -index 399d662..7bae30a 100755 ---- a/alsa-info/alsa-info.sh -+++ b/alsa-info/alsa-info.sh -@@ -35,22 +35,12 @@ BGTITLE="ALSA-Info v $SCRIPT_VERSION" - PASTEBINKEY="C9cRIO8m/9y8Cs0nVs0FraRx7U0pHsuc" - - WGET=$(which wget 2>/dev/null | sed 's|^[^/]*||' 2>/dev/null) --REQUIRES="mktemp grep pgrep whereis ping awk date uname cat sort dmesg amixer alsactl" -+REQUIRES="mktemp grep pgrep whereis awk date uname cat sort dmesg amixer alsactl" - - # - # Define some simple functions - # - --pbcheck() { -- [[ $UPLOAD = "no" ]] && return -- -- if [[ -z $PASTEBIN ]]; then -- [[ $(ping -c1 www.alsa-project.org) ]] || KEEP_FILES="yes" UPLOAD="no" PBERROR="yes" -- else -- [[ $(ping -c1 www.pastebin.ca) ]] || KEEP_FILES="yes" UPLOAD="no" PBERROR="yes" -- fi --} -- - update() { - test -z "$WGET" -o ! -x "$WGET" && return - -@@ -650,7 +640,6 @@ fi - #If no command line options are specified, then run as though --with-all was specified - if [ -z "$1" ]; then - update -- pbcheck - fi - - fi # proceed -@@ -662,7 +651,6 @@ if [ -n "$1" ]; then - case "$1" in - --pastebin) - update -- pbcheck - ;; - --update) - update -@@ -832,25 +820,11 @@ if [ "$UPLOAD" = "no" ]; then - - if [[ -n $DIALOG ]] - then -- if [[ -n $PBERROR ]]; then -- dialog --backtitle "$BGTITLE" --title "Information collected" --msgbox "An error occurred while contacting the $WWWSERVICE.\n Your information was NOT automatically uploaded.\n\nYour ALSA information is in $NFILE" 10 100 -- else -- dialog --backtitle "$BGTITLE" --title "Information collected" --msgbox "\n\nYour ALSA information is in $NFILE" 10 60 -- fi -+ dialog --backtitle "$BGTITLE" --title "Information collected" --msgbox "\n\nYour ALSA information is in $NFILE" 10 60 - else -- echo -- -- if [[ -n $PBERROR ]]; then -- echo "An error occurred while contacting the $WWWSERVICE." -- echo "Your information was NOT automatically uploaded." -- echo "" -- echo "Your ALSA information is in $NFILE" -- echo "" -- else -- echo "" -- echo "Your ALSA information is in $NFILE" -- echo "" -- fi -+ echo "" -+ echo "Your ALSA information is in $NFILE" -+ echo "" - fi - - exit -@@ -865,9 +839,27 @@ else - fi - - if [[ -z $PASTEBIN ]]; then -- wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://www.alsa-project.org/cardinfo-db/" &>$TEMPDIR/wget.tmp || echo "Upload failed; exit" -+ wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://www.alsa-project.org/cardinfo-db/" &>$TEMPDIR/wget.tmp - else -- wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://pastebin.ca/quiet-paste.php?api=$PASTEBINKEY&encrypt=t&encryptpw=blahblah" &>$TEMPDIR/wget.tmp || echo "Upload failed; exit" -+ wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://pastebin.ca/quiet-paste.php?api=$PASTEBINKEY&encrypt=t&encryptpw=blahblah" &>$TEMPDIR/wget.tmp -+fi -+ -+if [ $? -ne 0 ]; then -+ mv -f $FILE $NFILE || exit 1 -+ KEEP_OUTPUT="yes" -+ -+ if [ -n "$DIALOG" ]; then -+ dialog --backtitle "$BGTITLE" --title "Information not uploaded" --msgbox "An error occurred while contacting $WWWSERVICE.\n Your information was NOT automatically uploaded.\n\nYour ALSA information is in $NFILE" 10 100 -+ else -+ echo "" -+ echo "An error occurred while contacting $WWWSERVICE." -+ echo "Your information was NOT automatically uploaded." -+ echo "" -+ echo "Your ALSA information is in $NFILE" -+ echo "" -+ fi -+ -+ exit - fi - - if [ -n "$DIALOG" ]; then --- -2.24.1 - - -From cbabe7a3f0cc84ecd352d4cbf85148946fa6c0d5 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Thu, 19 Dec 2019 15:36:05 +0100 -Subject: [PATCH 27/31] alsatplg: rewrite to use the new libatopology functions - -Add '-u,--dump' operation. -Add '-g,--group' and '-x,--nocheck' modifiers. -Add '-z,--dapm-nosort' modifier. -Allow to operate with stdin/stdout for the file input/output. - -Signed-off-by: Jaroslav Kysela ---- - topology/alsatplg.rst | 17 ++- - topology/topology.c | 304 +++++++++++++++++++++++++----------------- - 2 files changed, 199 insertions(+), 122 deletions(-) - -diff --git a/topology/alsatplg.rst b/topology/alsatplg.rst -index 855edff..e09c865 100644 ---- a/topology/alsatplg.rst -+++ b/topology/alsatplg.rst -@@ -50,12 +50,27 @@ Available options: - **-c**, **--compile** `FILE` - source configuration file for the compilation - -+ **-n**, **--normalize** `FILE` -+ parse and save the configuration file in the normalized format -+ -+ **-u**, **--dump** `FILE` -+ parse and save the configuration file in the specified format -+ - **-o**, **--output** `FILE` -- output binary file -+ output file - - **-v**, **--verbose** `LEVEL` - set verbose level - -+ **-s**, **--sort** -+ sort the configuration identifiers (set for normalization) -+ -+ **-x**, **--nocheck** -+ save the configuration without additional integrity check -+ -+ **-z**, **--dapm-nosort** -+ do not sort DAPM graph items (like in version 1.2.1-) -+ - - FILES - ===== -diff --git a/topology/topology.c b/topology/topology.c -index bc5797c..a94941a 100644 ---- a/topology/topology.c -+++ b/topology/topology.c -@@ -1,4 +1,5 @@ - /* -+ Copyright(c) 2019 Red Hat Inc. - Copyright(c) 2014-2015 Intel Corporation - Copyright(c) 2010-2011 Texas Instruments Incorporated, - All rights reserved. -@@ -44,165 +45,205 @@ _("Usage: %s [OPTIONS]...\n" - "-h, --help help\n" - "-c, --compile=FILE compile file\n" - "-n, --normalize=FILE normalize file\n" -+"-u, --dump=FILE dump (reparse) file\n" - "-v, --verbose=LEVEL set verbosity level (0...1)\n" - "-o, --output=FILE set output file\n" - "-s, --sort sort the identifiers in the normalized output\n" -+"-g, --group save configuration by group indexes\n" -+"-x, --nocheck save configuration without additional integrity checks\n" - ), name); - } - --static int _compar(const void *a, const void *b) -+static int load(snd_tplg_t **tplg, const char *source_file, int cflags) - { -- const snd_config_t *c1 = *(snd_config_t **)a; -- const snd_config_t *c2 = *(snd_config_t **)b; -- const char *id1, *id2; -- if (snd_config_get_id(c1, &id1)) return 0; -- if (snd_config_get_id(c2, &id2)) return 0; -- return strcmp(id1, id2); --} -+ int fd, err; -+ char *buf, *buf2; -+ size_t size, pos; -+ ssize_t r; - --static snd_config_t *normalize_config(const char *id, snd_config_t *src, int sort) --{ -- snd_config_t *dst, **a; -- snd_config_iterator_t i, next; -- int index, count; -- -- if (snd_config_get_type(src) != SND_CONFIG_TYPE_COMPOUND) { -- if (snd_config_copy(&dst, src) >= 0) -- return dst; -- return NULL; -- } -- count = 0; -- snd_config_for_each(i, next, src) -- count++; -- a = malloc(sizeof(dst) * count); -- if (a == NULL) -- return NULL; -- index = 0; -- snd_config_for_each(i, next, src) { -- snd_config_t *s = snd_config_iterator_entry(i); -- a[index++] = s; -- } -- if (sort) -- qsort(a, count, sizeof(a[0]), _compar); -- if (snd_config_make_compound(&dst, id, count == 1)) { -- free(a); -- return NULL; -- } -- for (index = 0; index < count; index++) { -- snd_config_t *s = a[index]; -- const char *id2; -- if (snd_config_get_id(s, &id2)) { -- snd_config_delete(dst); -- free(a); -- return NULL; -- } -- s = normalize_config(id2, s, sort); -- if (s == NULL || snd_config_add(dst, s)) { -- if (s) -- snd_config_delete(s); -- snd_config_delete(dst); -- free(a); -- return NULL; -+ if (strcmp(source_file, "-") == 0) { -+ fd = fileno(stdin); -+ } else { -+ fd = open(source_file, O_RDONLY); -+ if (fd < 0) { -+ fprintf(stderr, _("Unable to open input file '%s': %s\n"), -+ source_file, strerror(-errno)); -+ return 1; - } - } -- free(a); -- return dst; --} - --static int compile(const char *source_file, const char *output_file, int verbose) --{ -- snd_tplg_t *snd_tplg; -- int err; -+ size = 16*1024; -+ pos = 0; -+ buf = malloc(size); -+ if (buf == NULL) -+ goto _nomem; -+ while (1) { -+ r = read(fd, buf + pos, size - pos); -+ if (r < 0 && (errno == EAGAIN || errno == EINTR)) -+ continue; -+ if (r <= 0) -+ break; -+ pos += r; -+ size += 8*1024; -+ buf2 = realloc(buf, size); -+ if (buf2 == NULL) { -+ free(buf); -+ goto _nomem; -+ } -+ buf = buf2; -+ } -+ if (fd != fileno(stdin)) -+ close(fd); -+ if (r < 0) { -+ fprintf(stderr, _("Read error: %s\n"), strerror(-errno)); -+ free(buf); -+ goto _err; -+ } - -- snd_tplg = snd_tplg_new(); -- if (snd_tplg == NULL) { -+ *tplg = snd_tplg_create(cflags); -+ if (*tplg == NULL) { - fprintf(stderr, _("failed to create new topology context\n")); -+ free(buf); - return 1; - } - -- snd_tplg_verbose(snd_tplg, verbose); -- -- err = snd_tplg_build_file(snd_tplg, source_file, output_file); -+ err = snd_tplg_load(*tplg, buf, pos); -+ free(buf); - if (err < 0) { -- fprintf(stderr, _("failed to compile context %s\n"), source_file); -- snd_tplg_free(snd_tplg); -- unlink(output_file); -+ fprintf(stderr, _("Unable to load configuration: %s\n"), -+ snd_strerror(-err)); -+ snd_tplg_free(*tplg); - return 1; - } - -- snd_tplg_free(snd_tplg); -+ return 0; -+ -+_nomem: -+ fprintf(stderr, _("No enough memory\n")); -+_err: -+ if (fd != fileno(stdin)) -+ close(fd); -+ free(buf); - return 1; - } - --static int normalize(const char *source_file, const char *output_file, int sort) -+static int save(const char *output_file, void *buf, size_t size) - { -- snd_input_t *input; -- snd_output_t *output; -- snd_config_t *top, *norm; -- int err; -+ char *fname = NULL; -+ int fd; -+ ssize_t r; - -- err = snd_input_stdio_open(&input, source_file, "r"); -- if (err < 0) { -- fprintf(stderr, "Unable to open source file '%s': %s\n", source_file, snd_strerror(-err)); -- return 0; -+ if (strcmp(output_file, "-") == 0) { -+ fd = fileno(stdout); -+ } else { -+ fname = alloca(strlen(output_file) + 5); -+ strcpy(fname, output_file); -+ strcat(fname, ".new"); -+ fd = open(fname, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); -+ if (fd < 0) { -+ fprintf(stderr, _("Unable to open output file '%s': %s\n"), -+ fname, strerror(-errno)); -+ return 1; -+ } - } - -- err = snd_config_top(&top); -- if (err < 0) { -- snd_input_close(input); -- return 1; -+ r = 0; -+ while (size > 0) { -+ r = write(fd, buf, size); -+ if (r < 0 && (errno == EAGAIN || errno == EINTR)) -+ continue; -+ if (r < 0) -+ break; -+ size -= r; -+ buf += r; - } - -- err = snd_config_load(top, input); -- snd_input_close(input); -- if (err < 0) { -- snd_config_delete(top); -- fprintf(stderr, "Unable to parse source file '%s': %s\n", source_file, snd_strerror(-err)); -- snd_config_delete(top); -+ if (r < 0) { -+ fprintf(stderr, _("Write error: %s\n"), strerror(-errno)); -+ if (fd != fileno(stdout)) { -+ remove(fname); -+ close(fd); -+ } - return 1; - } - -- err = snd_output_stdio_open(&output, output_file, "w+"); -- if (err < 0) { -- fprintf(stderr, "Unable to open output file '%s': %s\n", output_file, snd_strerror(-err)); -- snd_config_delete(top); -- return 1; -- } -+ if (fd != fileno(stdout)) -+ close(fd); - -- norm = normalize_config(NULL, top, sort); -- if (norm == NULL) { -- fprintf(stderr, "Unable to normalize configuration (out of memory?)\n"); -- snd_output_close(output); -- snd_config_delete(top); -+ if (fname && rename(fname, output_file)) { -+ fprintf(stderr, _("Unable to rename file '%s' to '%s': %s\n"), -+ fname, output_file, strerror(-errno)); - return 1; - } - -- err = snd_config_save(norm, output); -- snd_output_close(output); -- snd_config_delete(norm); -- snd_config_delete(top); -+ return 0; -+} -+ -+static int dump(const char *source_file, const char *output_file, int cflags, int sflags) -+{ -+ snd_tplg_t *tplg; -+ char *text; -+ int err; -+ -+ err = load(&tplg, source_file, cflags); -+ if (err) -+ return err; -+ err = snd_tplg_save(tplg, &text, sflags); -+ snd_tplg_free(tplg); - if (err < 0) { -- fprintf(stderr, "Unable to save normalized contents: %s\n", snd_strerror(-err)); -+ fprintf(stderr, _("Unable to save parsed configuration: %s\n"), -+ snd_strerror(-err)); - return 1; - } -+ err = save(output_file, text, strlen(text)); -+ free(text); -+ return err; -+} - -- return 0; -+static int compile(const char *source_file, const char *output_file, int cflags) -+{ -+ snd_tplg_t *tplg; -+ void *bin; -+ size_t size; -+ int err; -+ -+ err = load(&tplg, source_file, cflags); -+ if (err) -+ return err; -+ err = snd_tplg_build_bin(tplg, &bin, &size); -+ snd_tplg_free(tplg); -+ if (err < 0 || size == 0) { -+ fprintf(stderr, _("failed to compile context %s\n"), source_file); -+ return 1; -+ } -+ err = save(output_file, bin, size); -+ free(bin); -+ return err; - } - -+#define OP_COMPILE 1 -+#define OP_NORMALIZE 2 -+#define OP_DUMP 3 -+ - int main(int argc, char *argv[]) - { -- static const char short_options[] = "hc:n:v:o:s"; -+ static const char short_options[] = "hc:n:u:v:o:sgxz"; - static const struct option long_options[] = { - {"help", 0, NULL, 'h'}, - {"verbose", 1, NULL, 'v'}, - {"compile", 1, NULL, 'c'}, - {"normalize", 1, NULL, 'n'}, -+ {"dump", 1, NULL, 'u'}, - {"output", 1, NULL, 'o'}, - {"sort", 0, NULL, 's'}, -+ {"group", 0, NULL, 'g'}, -+ {"nocheck", 0, NULL, 'x'}, -+ {"dapm-nosort", 0, NULL, 'z'}, - {0, 0, 0, 0}, - }; -- char *source_file = NULL, *normalize_file = NULL, *output_file = NULL; -- int c, err, verbose = 0, sort = 0, option_index; -+ char *source_file = NULL; -+ char *output_file = NULL; -+ int c, err, op = 'c', cflags = 0, sflags = 0, option_index; - - #ifdef ENABLE_NLS - setlocale(LC_ALL, ""); -@@ -218,19 +259,32 @@ int main(int argc, char *argv[]) - usage(argv[0]); - return 0; - case 'v': -- verbose = atoi(optarg); -+ cflags |= SND_TPLG_CREATE_VERBOSE; - break; -- case 'c': -- source_file = optarg; -+ case 'z': -+ cflags |= SND_TPLG_CREATE_DAPM_NOSORT; - break; -+ case 'c': - case 'n': -- normalize_file = optarg; -+ case 'u': -+ if (source_file) { -+ fprintf(stderr, _("Cannot combine operations (compile, normalize, dump)\n")); -+ return 1; -+ } -+ source_file = optarg; -+ op = c; - break; - case 'o': - output_file = optarg; - break; - case 's': -- sort = 1; -+ sflags |= SND_TPLG_SAVE_SORT; -+ break; -+ case 'g': -+ sflags |= SND_TPLG_SAVE_GROUPS; -+ break; -+ case 'x': -+ sflags |= SND_TPLG_SAVE_NOCHECK; - break; - default: - fprintf(stderr, _("Try `%s --help' for more information.\n"), argv[0]); -@@ -238,21 +292,29 @@ int main(int argc, char *argv[]) - } - } - -- if (source_file && normalize_file) { -- fprintf(stderr, "Cannot normalize and compile at a time!\n"); -+ if (source_file == NULL || output_file == NULL) { -+ usage(argv[0]); - return 1; - } - -- if ((source_file == NULL && normalize_file == NULL) || output_file == NULL) { -- usage(argv[0]); -- return 1; -+ if (op == 'n') { -+ if (sflags != 0 && sflags != SND_TPLG_SAVE_SORT) { -+ fprintf(stderr, _("Wrong parameters for the normalize operation!\n")); -+ return 1; -+ } -+ /* normalize has predefined output */ -+ sflags = SND_TPLG_SAVE_SORT; - } - -- if (source_file) -- err = compile(source_file, output_file, verbose); -- else -- err = normalize(normalize_file, output_file, sort); -+ switch (op) { -+ case 'c': -+ err = compile(source_file, output_file, cflags); -+ break; -+ default: -+ err = dump(source_file, output_file, cflags, sflags); -+ break; -+ } - - snd_output_close(log); -- return 0; -+ return err ? 1 : 0; - } --- -2.24.1 - - -From 32e7016fd710f6ed9d514100c7c05453974036d0 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 20 Dec 2019 15:23:27 +0100 -Subject: [PATCH 28/31] alsatplg: add -V,--version option - -Signed-off-by: Jaroslav Kysela ---- - topology/alsatplg.rst | 3 +++ - topology/topology.c | 20 ++++++++++++++++++-- - 2 files changed, 21 insertions(+), 2 deletions(-) - -diff --git a/topology/alsatplg.rst b/topology/alsatplg.rst -index e09c865..260454b 100644 ---- a/topology/alsatplg.rst -+++ b/topology/alsatplg.rst -@@ -47,6 +47,9 @@ Available options: - **-h**, **--help** - this help - -+ **-V**, **--version** -+ show the utility version and versions of used libraries -+ - **-c**, **--compile** `FILE` - source configuration file for the compilation - -diff --git a/topology/topology.c b/topology/topology.c -index a94941a..101f8cc 100644 ---- a/topology/topology.c -+++ b/topology/topology.c -@@ -34,10 +34,11 @@ - #include - #include - #include "gettext.h" -+#include "version.h" - - static snd_output_t *log; - --static void usage(char *name) -+static void usage(const char *name) - { - printf( - _("Usage: %s [OPTIONS]...\n" -@@ -51,9 +52,20 @@ _("Usage: %s [OPTIONS]...\n" - "-s, --sort sort the identifiers in the normalized output\n" - "-g, --group save configuration by group indexes\n" - "-x, --nocheck save configuration without additional integrity checks\n" -+"-V, --version print version\n" - ), name); - } - -+static void version(const char *name) -+{ -+ printf( -+_("%s version %s\n" -+"libasound version %s\n" -+"libatopology version %s\n" -+), name, SND_UTIL_VERSION_STR, -+ snd_asoundlib_version(), snd_tplg_version()); -+} -+ - static int load(snd_tplg_t **tplg, const char *source_file, int cflags) - { - int fd, err; -@@ -227,7 +239,7 @@ static int compile(const char *source_file, const char *output_file, int cflags) - - int main(int argc, char *argv[]) - { -- static const char short_options[] = "hc:n:u:v:o:sgxz"; -+ static const char short_options[] = "hc:n:u:v:o:sgxzV"; - static const struct option long_options[] = { - {"help", 0, NULL, 'h'}, - {"verbose", 1, NULL, 'v'}, -@@ -239,6 +251,7 @@ int main(int argc, char *argv[]) - {"group", 0, NULL, 'g'}, - {"nocheck", 0, NULL, 'x'}, - {"dapm-nosort", 0, NULL, 'z'}, -+ {"version", 0, NULL, 'V'}, - {0, 0, 0, 0}, - }; - char *source_file = NULL; -@@ -286,6 +299,9 @@ int main(int argc, char *argv[]) - case 'x': - sflags |= SND_TPLG_SAVE_NOCHECK; - break; -+ case 'V': -+ version(argv[0]); -+ return 0; - default: - fprintf(stderr, _("Try `%s --help' for more information.\n"), argv[0]); - return 1; --- -2.24.1 - - -From 786c3ee8144893dfb56b35c46542d3ded78d746c Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Sun, 22 Dec 2019 15:44:56 +0100 -Subject: [PATCH 29/31] alsatplg: add decode command - -Signed-off-by: Jaroslav Kysela ---- - topology/alsatplg.rst | 3 ++ - topology/topology.c | 111 ++++++++++++++++++++++++++++++++---------- - 2 files changed, 87 insertions(+), 27 deletions(-) - -diff --git a/topology/alsatplg.rst b/topology/alsatplg.rst -index 260454b..56324d5 100644 ---- a/topology/alsatplg.rst -+++ b/topology/alsatplg.rst -@@ -53,6 +53,9 @@ Available options: - **-c**, **--compile** `FILE` - source configuration file for the compilation - -+ **-d**, **--decode** `FILE` -+ source binary topology file for the decode -+ - **-n**, **--normalize** `FILE` - parse and save the configuration file in the normalized format - -diff --git a/topology/topology.c b/topology/topology.c -index 101f8cc..91d2fce 100644 ---- a/topology/topology.c -+++ b/topology/topology.c -@@ -44,9 +44,10 @@ static void usage(const char *name) - _("Usage: %s [OPTIONS]...\n" - "\n" - "-h, --help help\n" --"-c, --compile=FILE compile file\n" --"-n, --normalize=FILE normalize file\n" --"-u, --dump=FILE dump (reparse) file\n" -+"-c, --compile=FILE compile configuration file\n" -+"-d, --decode=FILE decode binary topology file\n" -+"-n, --normalize=FILE normalize configuration file\n" -+"-u, --dump=FILE dump (reparse) configuration file\n" - "-v, --verbose=LEVEL set verbosity level (0...1)\n" - "-o, --output=FILE set output file\n" - "-s, --sort sort the identifiers in the normalized output\n" -@@ -66,10 +67,10 @@ _("%s version %s\n" - snd_asoundlib_version(), snd_tplg_version()); - } - --static int load(snd_tplg_t **tplg, const char *source_file, int cflags) -+static int load(const char *source_file, void **dst, size_t *dst_size) - { -- int fd, err; -- char *buf, *buf2; -+ int fd; -+ void *buf, *buf2; - size_t size, pos; - ssize_t r; - -@@ -112,15 +113,31 @@ static int load(snd_tplg_t **tplg, const char *source_file, int cflags) - goto _err; - } - -+ *dst = buf; -+ *dst_size = pos; -+ return 0; -+ -+_nomem: -+ fprintf(stderr, _("No enough memory\n")); -+_err: -+ if (fd != fileno(stdin)) -+ close(fd); -+ free(buf); -+ return 1; -+} -+ -+static int load_topology(snd_tplg_t **tplg, char *config, -+ size_t config_size, int cflags) -+{ -+ int err; -+ - *tplg = snd_tplg_create(cflags); - if (*tplg == NULL) { - fprintf(stderr, _("failed to create new topology context\n")); -- free(buf); - return 1; - } - -- err = snd_tplg_load(*tplg, buf, pos); -- free(buf); -+ err = snd_tplg_load(*tplg, config, config_size); - if (err < 0) { - fprintf(stderr, _("Unable to load configuration: %s\n"), - snd_strerror(-err)); -@@ -129,14 +146,6 @@ static int load(snd_tplg_t **tplg, const char *source_file, int cflags) - } - - return 0; -- --_nomem: -- fprintf(stderr, _("No enough memory\n")); --_err: -- if (fd != fileno(stdin)) -- close(fd); -- free(buf); -- return 1; - } - - static int save(const char *output_file, void *buf, size_t size) -@@ -194,10 +203,15 @@ static int save(const char *output_file, void *buf, size_t size) - static int dump(const char *source_file, const char *output_file, int cflags, int sflags) - { - snd_tplg_t *tplg; -- char *text; -+ char *config, *text; -+ size_t size; - int err; - -- err = load(&tplg, source_file, cflags); -+ err = load(source_file, (void **)&config, &size); -+ if (err) -+ return err; -+ err = load_topology(&tplg, config, size, cflags); -+ free(config); - if (err) - return err; - err = snd_tplg_save(tplg, &text, sflags); -@@ -215,17 +229,23 @@ static int dump(const char *source_file, const char *output_file, int cflags, in - static int compile(const char *source_file, const char *output_file, int cflags) - { - snd_tplg_t *tplg; -+ char *config; - void *bin; -- size_t size; -+ size_t config_size, size; - int err; - -- err = load(&tplg, source_file, cflags); -+ err = load(source_file, (void **)&config, &config_size); -+ if (err) -+ return err; -+ err = load_topology(&tplg, config, config_size, cflags); -+ free(config); - if (err) - return err; - err = snd_tplg_build_bin(tplg, &bin, &size); - snd_tplg_free(tplg); - if (err < 0 || size == 0) { -- fprintf(stderr, _("failed to compile context %s\n"), source_file); -+ fprintf(stderr, _("failed to compile context %s: %s\n"), -+ source_file, snd_strerror(-err)); - return 1; - } - err = save(output_file, bin, size); -@@ -233,17 +253,50 @@ static int compile(const char *source_file, const char *output_file, int cflags) - return err; - } - --#define OP_COMPILE 1 --#define OP_NORMALIZE 2 --#define OP_DUMP 3 -+static int decode(const char *source_file, const char *output_file, -+ int cflags, int dflags, int sflags) -+{ -+ snd_tplg_t *tplg; -+ void *bin; -+ char *text; -+ size_t size; -+ int err; -+ -+ if (load(source_file, &bin, &size)) -+ return 1; -+ tplg = snd_tplg_create(cflags); -+ if (tplg == NULL) { -+ fprintf(stderr, _("failed to create new topology context\n")); -+ return 1; -+ } -+ err = snd_tplg_decode(tplg, bin, size, dflags); -+ free(bin); -+ if (err < 0) { -+ snd_tplg_free(tplg); -+ fprintf(stderr, _("failed to decode context %s: %s\n"), -+ source_file, snd_strerror(-err)); -+ return 1; -+ } -+ err = snd_tplg_save(tplg, &text, sflags); -+ snd_tplg_free(tplg); -+ if (err < 0) { -+ fprintf(stderr, _("Unable to save parsed configuration: %s\n"), -+ snd_strerror(-err)); -+ return 1; -+ } -+ err = save(output_file, text, strlen(text)); -+ free(text); -+ return err; -+} - - int main(int argc, char *argv[]) - { -- static const char short_options[] = "hc:n:u:v:o:sgxzV"; -+ static const char short_options[] = "hc:d:n:u:v:o:sgxzV"; - static const struct option long_options[] = { - {"help", 0, NULL, 'h'}, - {"verbose", 1, NULL, 'v'}, - {"compile", 1, NULL, 'c'}, -+ {"decode", 1, NULL, 'd'}, - {"normalize", 1, NULL, 'n'}, - {"dump", 1, NULL, 'u'}, - {"output", 1, NULL, 'o'}, -@@ -256,7 +309,7 @@ int main(int argc, char *argv[]) - }; - char *source_file = NULL; - char *output_file = NULL; -- int c, err, op = 'c', cflags = 0, sflags = 0, option_index; -+ int c, err, op = 'c', cflags = 0, dflags = 0, sflags = 0, option_index; - - #ifdef ENABLE_NLS - setlocale(LC_ALL, ""); -@@ -278,6 +331,7 @@ int main(int argc, char *argv[]) - cflags |= SND_TPLG_CREATE_DAPM_NOSORT; - break; - case 'c': -+ case 'd': - case 'n': - case 'u': - if (source_file) { -@@ -326,6 +380,9 @@ int main(int argc, char *argv[]) - case 'c': - err = compile(source_file, output_file, cflags); - break; -+ case 'd': -+ err = decode(source_file, output_file, cflags, dflags, sflags); -+ break; - default: - err = dump(source_file, output_file, cflags, sflags); - break; --- -2.24.1 - - -From 56e1b879d4bccda62e7c0177b0a395d57a37931c Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Wed, 1 Jan 2020 17:45:06 +0100 -Subject: [PATCH 30/31] alsatplg: add documentation for -z,--dapm-nosort (-h) - -Signed-off-by: Jaroslav Kysela ---- - topology/topology.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/topology/topology.c b/topology/topology.c -index 91d2fce..ad0d108 100644 ---- a/topology/topology.c -+++ b/topology/topology.c -@@ -53,6 +53,7 @@ _("Usage: %s [OPTIONS]...\n" - "-s, --sort sort the identifiers in the normalized output\n" - "-g, --group save configuration by group indexes\n" - "-x, --nocheck save configuration without additional integrity checks\n" -+"-z, --dapm-nosort do not sort the DAPM widgets\n" - "-V, --version print version\n" - ), name); - } --- -2.24.1 - - -From 996a638e04766df43cb8026673f93927b1047639 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Fri, 3 Jan 2020 23:46:51 +0100 -Subject: [PATCH 31/31] configure: fix new libatopology check - ---- - configure.ac | 6 +----- - 1 file changed, 1 insertion(+), 5 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 4bee49b..b7ed81a 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -49,6 +49,7 @@ AC_CHECK_LIB([asound], [snd_seq_client_info_get_pid], [HAVE_SEQ_CLIENT_INFO_GET_ - if test "$HAVE_SEQ_CLIENT_INFO_GET_PID" = "yes" ; then - AC_DEFINE([HAVE_SEQ_CLIENT_INFO_GET_PID], 1, [alsa-lib supports snd_seq_client_info_get_pid]) - fi -+AC_CHECK_LIB([atopology], [snd_tplg_save], [have_topology="no"]) - - # - # NOTE: The library 'libffado' (at least v2.4.1) executes ctor/dtor of instances -@@ -70,11 +71,6 @@ AM_CONDITIONAL(HAVE_TOPOLOGY, test "$have_topology" = "yes") - AM_CONDITIONAL(HAVE_SAMPLERATE, test "$have_samplerate" = "yes") - AM_CONDITIONAL(HAVE_FFADO, test "$have_ffado" = "yes") - --# old libasound with the topology routines in the main library --if test "x$have_topology" = "xyes" -a "x$ALSA_TOPOLOGY_LIBS" = "x"; then -- ALSA_TOPOLOGY_LIBS="$ALSA_LIBS" --fi -- - dnl Use tinyalsa - alsabat_backend_tiny= - AC_ARG_ENABLE(alsabat_backend_tiny, --- -2.24.1 - From fcba1a6023c8a128060c4b330671ea0dbd9c263f Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 19 Feb 2020 13:10:10 +0100 Subject: [PATCH 04/58] updated sources --- sources | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources b/sources index 9b26ebe..4d01295 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (alsa-utils-1.2.2.tar.bz2) = 6398d316b3f770b5ffbb89cff55a8a9b725599fbf8109f866964b2b4367cb2de544ab4c322f97798d1b6e859de12bd1bd464a812c01602f0ca53fb5d0d845b1d +SHA512 (alsa-utils-1.2.2.tar.bz2) = 30598c658f3f2ad71a5ce7911b09ae13add54b293bcf3bebb053371d84a91528bd64fd376f167456b2e27e2546a2279019678e099247513e5142b283af756fd9 From 362038f2d68610e47beecd4a7485bf2703841060 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 3 Mar 2020 10:17:05 +0100 Subject: [PATCH 05/58] add simple tests --- tests/run_tests.sh | 28 ++++++++++++++++++++++++++++ tests/tests.yml | 9 +++++++++ 2 files changed, 37 insertions(+) create mode 100755 tests/run_tests.sh create mode 100644 tests/tests.yml diff --git a/tests/run_tests.sh b/tests/run_tests.sh new file mode 100755 index 0000000..eb91753 --- /dev/null +++ b/tests/run_tests.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +set -ex + +# is alsactl present and working? +alsactl --version + +# is amixer present and working? +amixer --help + +# is alsamixer present and working? +alsamixer --version + +# is amidi present and working? +amidi --version + +# is speaker-test preset and working? +speaker-test -h + +# aplay test (like for alsa-lib) +str=$(aplay -L | grep -E "^null$") +if [ "$str" != "null" ]; then + echo "The 'null' pcm plugin was not found!" + exit 99 +fi + +# alsa-info.sh present and working? +alsa-info.sh --help diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..e56da89 --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,9 @@ +- hosts: localhost + roles: + - role: standard-test-basic + tags: + - classic + tests: + - simple: + dir: . + run: ./run_tests.sh From c358c9c30123512aa16bcf8c226d4dde9dd31d19 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Sun, 7 Jun 2020 19:57:09 +0200 Subject: [PATCH 06/58] update to 1.2.3 --- alsa-utils.spec | 7 +++++-- sources | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index ab5e16e..ea0f8ce 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -1,4 +1,4 @@ -%define baseversion 1.2.2 +%define baseversion 1.2.3 #define fixversion .2 %global _hardened_build 1 @@ -194,7 +194,10 @@ fi %postun %systemd_postun_with_restart alsa-state.service -%changelog +%changelog0 +* Sun Jun 7 2020 Jaroslav Kysela - 1.2.3-1 +* Updated to 1.2.3 + * Wed Feb 19 2020 Jaroslav Kysela - 1.2.2-1 * Updated to 1.2.2 diff --git a/sources b/sources index 4d01295..a402a74 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (alsa-utils-1.2.2.tar.bz2) = 30598c658f3f2ad71a5ce7911b09ae13add54b293bcf3bebb053371d84a91528bd64fd376f167456b2e27e2546a2279019678e099247513e5142b283af756fd9 +SHA512 (alsa-utils-1.2.3.tar.bz2) = 5aeba2e5b7279c62d4df85b61a26b3f41e5465bac5a0b94c7bbe1299f7aa38e8cf2a1f749f618289a63b61f76609fe54169fcbe70792b45adc8957811b672012 From 6ef6d1ed320d2ca05d4748cbba629240e3c9ffe6 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Sun, 7 Jun 2020 20:50:47 +0200 Subject: [PATCH 07/58] cleanups for the alsa git patch --- alsa-git.patch => alsa-utils-git.patch | 0 alsa-utils.spec | 8 ++++---- 2 files changed, 4 insertions(+), 4 deletions(-) rename alsa-git.patch => alsa-utils-git.patch (100%) diff --git a/alsa-git.patch b/alsa-utils-git.patch similarity index 100% rename from alsa-git.patch rename to alsa-utils-git.patch diff --git a/alsa-utils.spec b/alsa-utils.spec index ea0f8ce..808a294 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -5,11 +5,11 @@ Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 -Patch1: alsa-git.patch +Patch1: alsa-utils-git.patch Source4: alsaunmute Source5: alsaunmute.1 Source10: alsa.rules @@ -61,7 +61,7 @@ Architecture (ALSA) framework and Fast Fourier Transform library. %prep %setup -q -n %{name}-%{version} -%patch1 -p1 +%patch1 -p1 -b .alsa-git %build %configure CFLAGS="$RPM_OPT_FLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" --disable-alsaconf \ @@ -195,7 +195,7 @@ fi %systemd_postun_with_restart alsa-state.service %changelog0 -* Sun Jun 7 2020 Jaroslav Kysela - 1.2.3-1 +* Sun Jun 7 2020 Jaroslav Kysela - 1.2.3-2 * Updated to 1.2.3 * Wed Feb 19 2020 Jaroslav Kysela - 1.2.2-1 From 0bc5d5375fedebe06097058b77181de1fce9b2fd Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Sun, 7 Jun 2020 21:01:23 +0200 Subject: [PATCH 08/58] remove alsa-ucm.rules lines --- alsa-utils.spec | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index 808a294..aee878d 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -5,7 +5,7 @@ Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2+ URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -79,8 +79,6 @@ make install DESTDIR=%{buildroot} # Install ALSA udev rules mkdir -p %{buildroot}/%{_prefix}/lib/udev/rules.d install -p -m 644 %{SOURCE10} %{buildroot}/%{_prefix}/lib/udev/rules.d/90-alsa-restore.rules -sed -e 's,@bindir@,%{_bindir},g' alsaucm/89-alsa-ucm.rules.in > alsaucm/89-alsa-ucm.rules -install -p -m 644 alsaucm/89-alsa-ucm.rules %{buildroot}/%{_prefix}/lib/udev/rules.d/89-alsa-ucm.rules mkdir -p %{buildroot}/%{_unitdir} install -p -m 644 %{SOURCE20} %{buildroot}/%{_unitdir}/alsa-restore.service install -p -m 644 %{SOURCE22} %{buildroot}/%{_unitdir}/alsa-state.service @@ -195,7 +193,7 @@ fi %systemd_postun_with_restart alsa-state.service %changelog0 -* Sun Jun 7 2020 Jaroslav Kysela - 1.2.3-2 +* Sun Jun 7 2020 Jaroslav Kysela - 1.2.3-3 * Updated to 1.2.3 * Wed Feb 19 2020 Jaroslav Kysela - 1.2.2-1 From b65f2966e549b7bf0a87905150aa793bbaeedf76 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Sun, 7 Jun 2020 21:12:58 +0200 Subject: [PATCH 09/58] remove alsa-ucm.rules from files sections --- alsa-utils.spec | 2 -- 1 file changed, 2 deletions(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index aee878d..ff8f6fe 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -107,7 +107,6 @@ mkdir -p -m 755 %{buildroot}%{_sharedstatedir}/alsa %doc COPYING ChangeLog README.md TODO %config /etc/alsa/* %{_prefix}/lib/udev/rules.d/* -%exclude %{_prefix}/lib/udev/rules.d/*alsa-ucm* %{_unitdir}/* %{_unitdir}/sound.target.wants/* %{alsacfgdir}/init/* @@ -157,7 +156,6 @@ mkdir -p -m 755 %{buildroot}%{_sharedstatedir}/alsa %dir %{_sharedstatedir}/alsa/ %files -n alsa-ucm-utils -%{_prefix}/lib/udev/rules.d/*alsa-ucm* %{_bindir}/alsaucm %{_mandir}/man1/alsaucm.1.gz From 867def31f6b869720e52ee48c9662ad573e1a386 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 3 Jul 2020 19:36:21 +0200 Subject: [PATCH 10/58] fix the .spec (changelog0) --- alsa-utils.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index ff8f6fe..51999c8 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -5,7 +5,7 @@ Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 3%{?dist} +Release: 4%{?dist} License: GPLv2+ URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -190,7 +190,10 @@ fi %postun %systemd_postun_with_restart alsa-state.service -%changelog0 +%changelog +* Fri Jul 3 2020 Jaroslav Kysela - 1.2.3-4 +* Fix the .spec (changelog0) + * Sun Jun 7 2020 Jaroslav Kysela - 1.2.3-3 * Updated to 1.2.3 From 8cf23961fc7c3dd05b40392b15520146f340f4c6 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Mon, 27 Jul 2020 11:57:53 +0000 Subject: [PATCH 11/58] - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- alsa-utils.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index 51999c8..8bb1a3f 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -5,7 +5,7 @@ Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 4%{?dist} +Release: 5%{?dist} License: GPLv2+ URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -191,6 +191,9 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Mon Jul 27 2020 Fedora Release Engineering - 1.2.3-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + * Fri Jul 3 2020 Jaroslav Kysela - 1.2.3-4 * Fix the .spec (changelog0) From f2a39f9a193593a7ead4ab39e6c85209a5ba5217 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 31 Jul 2020 23:56:10 +0000 Subject: [PATCH 12/58] - Second attempt - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- alsa-utils.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index 8bb1a3f..c0ad905 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -5,7 +5,7 @@ Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 5%{?dist} +Release: 6%{?dist} License: GPLv2+ URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -191,6 +191,10 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Fri Jul 31 2020 Fedora Release Engineering - 1.2.3-6 +- Second attempt - Rebuilt for + https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + * Mon Jul 27 2020 Fedora Release Engineering - 1.2.3-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild From 67cbc921db7174c9370de24eb53f9a3b7a8e8f08 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 15 Oct 2020 20:02:38 +0200 Subject: [PATCH 13/58] update to 1.2.4 --- alsa-utils.spec | 7 +++++-- sources | 1 - 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index c0ad905..17850b0 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -1,11 +1,11 @@ -%define baseversion 1.2.3 +%define baseversion 1.2.4 #define fixversion .2 %global _hardened_build 1 Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 6%{?dist} +Release: 1%{?dist} License: GPLv2+ URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -191,6 +191,9 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Thu Oct 15 2020 Jaroslav Kysela - 1.2.4-1 +* Updated to 1.2.4 + * Fri Jul 31 2020 Fedora Release Engineering - 1.2.3-6 - Second attempt - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild diff --git a/sources b/sources index a402a74..e69de29 100644 --- a/sources +++ b/sources @@ -1 +0,0 @@ -SHA512 (alsa-utils-1.2.3.tar.bz2) = 5aeba2e5b7279c62d4df85b61a26b3f41e5465bac5a0b94c7bbe1299f7aa38e8cf2a1f749f618289a63b61f76609fe54169fcbe70792b45adc8957811b672012 From 2dc8c4c448d674eacead0aba23b59d15ba856d3e Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 15 Oct 2020 20:04:16 +0200 Subject: [PATCH 14/58] update sources with 1.2.4 --- sources | 1 + 1 file changed, 1 insertion(+) diff --git a/sources b/sources index e69de29..34a0d2e 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +SHA512 (alsa-utils-1.2.4.tar.bz2) = 13080abda55269513b3751044dac292d695e273073a62d74ed4a32c68f448a2b015fe16604650821a6398b6ef6a7b6008cb9f0b7fb7f4ee1fa2b4eb2dcf29770 From 62a14c55a46c97928a5a170a4872fcf1b66dd71a Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Wed, 16 Dec 2020 23:25:06 +0000 Subject: [PATCH 15/58] Add BuildRequires: make https://fedoraproject.org/wiki/Changes/Remove_make_from_BuildRoot --- alsa-utils.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/alsa-utils.spec b/alsa-utils.spec index 17850b0..6c217b2 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -54,6 +54,7 @@ Architecture (ALSA) framework. %package alsabat Summary: Advanced Linux Sound Architecture (ALSA) - Basic Audio Tester BuildRequires: fftw-devel +BuildRequires: make %description alsabat This package contains tool for basic audio testing using Advanced Linux Sound From cdd4619adc0d759875bab7f119c7cde49ede0e54 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Tue, 26 Jan 2021 00:01:09 +0000 Subject: [PATCH 16/58] - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- alsa-utils.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index 6c217b2..2d9468e 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -5,7 +5,7 @@ Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -192,6 +192,9 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Tue Jan 26 2021 Fedora Release Engineering - 1.2.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + * Thu Oct 15 2020 Jaroslav Kysela - 1.2.4-1 * Updated to 1.2.4 From 7e12cf7d4807fe79ef6c5879b4e8649901a926bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 2 Mar 2021 16:14:11 +0100 Subject: [PATCH 17/58] Rebuilt for updated systemd-rpm-macros See https://pagure.io/fesco/issue/2583. --- alsa-utils.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index 2d9468e..0d3f3f6 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -5,7 +5,7 @@ Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2+ URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -192,6 +192,10 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Tue Mar 02 2021 Zbigniew Jędrzejewski-Szmek - 1.2.4-3 +- Rebuilt for updated systemd-rpm-macros + See https://pagure.io/fesco/issue/2583. + * Tue Jan 26 2021 Fedora Release Engineering - 1.2.4-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild From d95509ce2c08eab140c9c377f5714003f40822a2 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 24 May 2021 21:06:03 +0200 Subject: [PATCH 18/58] Drop StandardOutput=syslog from alsa-restore.service Link: https://bugzilla.redhat.com/show_bug.cgi?id=1937450 --- alsa-restore.service | 1 - 1 file changed, 1 deletion(-) diff --git a/alsa-restore.service b/alsa-restore.service index 4a32e11..c97411f 100644 --- a/alsa-restore.service +++ b/alsa-restore.service @@ -12,4 +12,3 @@ Type=oneshot RemainAfterExit=true ExecStart=-/sbin/alsactl -E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf --initfile=/lib/alsa/init/00main restore ExecStop=/sbin/alsactl -E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf store -StandardOutput=syslog From 51bdb272fc19207e6e86deccf8c62d010d16a8bf Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 28 May 2021 13:51:40 +0200 Subject: [PATCH 19/58] updated to 1.2.5 --- alsa-utils.spec | 7 +++++-- sources | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index 0d3f3f6..4119c36 100644 --- a/alsa-utils.spec +++ b/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: 3%{?dist} +Release: 1%{?dist} License: GPLv2+ URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -192,6 +192,9 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Fri May 28 2021 Jaroslav Kysela - 1.2.5-1 +* Updated to 1.2.5 + * Tue Mar 02 2021 Zbigniew Jędrzejewski-Szmek - 1.2.4-3 - Rebuilt for updated systemd-rpm-macros See https://pagure.io/fesco/issue/2583. diff --git a/sources b/sources index 34a0d2e..ba34275 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (alsa-utils-1.2.4.tar.bz2) = 13080abda55269513b3751044dac292d695e273073a62d74ed4a32c68f448a2b015fe16604650821a6398b6ef6a7b6008cb9f0b7fb7f4ee1fa2b4eb2dcf29770 +SHA512 (alsa-utils-1.2.5.tar.bz2) = 0e319e553c9c209a46f5c83c50007bd82acf1c9cf78649978b3ab6fbb4349f51c1c7c6a975a8c24d25ba07ad5325e74d2c34dc5c89180998a0f63d1326fde8b1 From 7c9baba24da1c2bec52ca4225f64b007b3e8b98e Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 31 May 2021 12:56:19 +0200 Subject: [PATCH 20/58] alsactl requires alsa-ucm configuration files now --- alsa-utils.spec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index 4119c36..1de4126 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -5,7 +5,7 @@ Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -30,6 +30,7 @@ Requires(preun): systemd Requires(postun): systemd # use latest alsa-lib - the executables in this package requires latest API Requires: alsa-lib%{?_isa} >= %{baseversion} +Requires: alsa-ucm >= %{baseversion} %description This package contains command line utilities for the Advanced Linux Sound @@ -37,7 +38,6 @@ Architecture (ALSA). %package -n alsa-ucm-utils Summary: Advanced Linux Sound Architecture (ALSA) - Use Case Manager -Requires: alsa-ucm >= %{baseversion} %description -n alsa-ucm-utils This package contains Use Case Manager tools for Advanced Linux Sound @@ -192,7 +192,7 @@ fi %systemd_postun_with_restart alsa-state.service %changelog -* Fri May 28 2021 Jaroslav Kysela - 1.2.5-1 +* Mon May 31 2021 Jaroslav Kysela - 1.2.5-2 * Updated to 1.2.5 * Tue Mar 02 2021 Zbigniew Jędrzejewski-Szmek - 1.2.4-3 From db4558654aaea00e1618a05fae830cf0aae52c31 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 3 Jun 2021 13:10:07 +0200 Subject: [PATCH 21/58] fixes for 1.2.5 Signed-off-by: Jaroslav Kysela --- alsa-utils-git.patch | 84 ++++++++++++++++++++++++++++++++++++++++++++ alsa-utils.spec | 5 ++- 2 files changed, 88 insertions(+), 1 deletion(-) diff --git a/alsa-utils-git.patch b/alsa-utils-git.patch index e69de29..9851a38 100644 --- a/alsa-utils-git.patch +++ b/alsa-utils-git.patch @@ -0,0 +1,84 @@ +From 78212445de4c8e07873cbc7dff2abcacd031f151 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 1 Jun 2021 17:47:42 +0200 +Subject: [PATCH 1/2] alsactl: fix the nested iteration + +There may be nested iterations for hw: card names. +Handle this card name in snd_card_iterator_sinit(). + +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 +--- + 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 + + +From 3d7a6facd9e1f962eef6c4ba3aa4cdc22477a6ac Mon Sep 17 00:00:00 2001 +From: Chao Song +Date: Mon, 31 May 2021 10:29:57 +0800 +Subject: [PATCH 2/2] 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, + + /* 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, + } + + 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.30.2 + diff --git a/alsa-utils.spec b/alsa-utils.spec index 1de4126..8de3bd5 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -5,7 +5,7 @@ Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2+ URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -192,6 +192,9 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Thu Jun 3 2021 Jaroslav Kysela - 1.2.5-3 +* Fixes for 1.2.5 (alsactl) + * Mon May 31 2021 Jaroslav Kysela - 1.2.5-2 * Updated to 1.2.5 From 2f018e242db8a1ffc2990058eea31c54431dac52 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 14 Jun 2021 14:16:37 +0200 Subject: [PATCH 22/58] updated to 1.2.5.1 --- alsa-utils-git.patch | 84 -------------------------------------------- alsa-utils.spec | 7 ++-- sources | 2 +- 3 files changed, 6 insertions(+), 87 deletions(-) diff --git a/alsa-utils-git.patch b/alsa-utils-git.patch index 9851a38..e69de29 100644 --- a/alsa-utils-git.patch +++ b/alsa-utils-git.patch @@ -1,84 +0,0 @@ -From 78212445de4c8e07873cbc7dff2abcacd031f151 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 1 Jun 2021 17:47:42 +0200 -Subject: [PATCH 1/2] alsactl: fix the nested iteration - -There may be nested iterations for hw: card names. -Handle this card name in snd_card_iterator_sinit(). - -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 ---- - 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 - - -From 3d7a6facd9e1f962eef6c4ba3aa4cdc22477a6ac Mon Sep 17 00:00:00 2001 -From: Chao Song -Date: Mon, 31 May 2021 10:29:57 +0800 -Subject: [PATCH 2/2] 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, - - /* 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, - } - - 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.30.2 - diff --git a/alsa-utils.spec b/alsa-utils.spec index 8de3bd5..deb0fea 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -1,11 +1,11 @@ -%define baseversion 1.2.5 +%define baseversion 1.2.5.1 #define fixversion .2 %global _hardened_build 1 Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 3%{?dist} +Release: 1%{?dist} License: GPLv2+ URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -192,6 +192,9 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Mon Jun 14 2021 Jaroslav Kysela - 1.2.5.1-1 +* Updated to 1.2.5.1 + * Thu Jun 3 2021 Jaroslav Kysela - 1.2.5-3 * Fixes for 1.2.5 (alsactl) diff --git a/sources b/sources index ba34275..e113470 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (alsa-utils-1.2.5.tar.bz2) = 0e319e553c9c209a46f5c83c50007bd82acf1c9cf78649978b3ab6fbb4349f51c1c7c6a975a8c24d25ba07ad5325e74d2c34dc5c89180998a0f63d1326fde8b1 +SHA512 (alsa-utils-1.2.5.1.tar.bz2) = bbafeb9189ec5802965c4e69cf6e7cd4c132ffb77b57f164d6585649890f96edd052c72697171fd629b39e12f78648fea634468df34c1a80255227ca397907bf From 0690a510cfc28842a4c763bd393b25a0ec38e372 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 21 Jul 2021 12:33:21 +0000 Subject: [PATCH 23/58] - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild Signed-off-by: Fedora Release Engineering From e51733b089c1fb4178d19af90393613b215e34d8 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 21 Jul 2021 17:28:46 +0000 Subject: [PATCH 24/58] - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- alsa-utils.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index deb0fea..44daccf 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -5,7 +5,7 @@ Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -192,6 +192,9 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Wed Jul 21 2021 Fedora Release Engineering - 1.2.5.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + * Mon Jun 14 2021 Jaroslav Kysela - 1.2.5.1-1 * Updated to 1.2.5.1 From c5ed6b97d8afb55a80567822847db630ab794c7f Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 6 Dec 2021 13:31:49 +0100 Subject: [PATCH 25/58] updated to 1.2.6 --- alsa-utils.spec | 7 +++++-- sources | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index 44daccf..0fbae58 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -1,11 +1,11 @@ -%define baseversion 1.2.5.1 +%define baseversion 1.2.6 #define fixversion .2 %global _hardened_build 1 Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 2%{?dist} +Release: 1%{?dist} License: GPLv2+ URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -192,6 +192,9 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Mon Dec 6 2021 Jaroslav Kysela - 1.2.6-1 +* Updated to 1.2.6 + * Wed Jul 21 2021 Fedora Release Engineering - 1.2.5.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild diff --git a/sources b/sources index e113470..d84d8e2 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (alsa-utils-1.2.5.1.tar.bz2) = bbafeb9189ec5802965c4e69cf6e7cd4c132ffb77b57f164d6585649890f96edd052c72697171fd629b39e12f78648fea634468df34c1a80255227ca397907bf +SHA512 (alsa-utils-1.2.6.tar.bz2) = 6842f0f4c2f7cc5ac3ba94736ee259d9988b5d3e0d2b522f858d712e16938d2845fa9ef64f4aa60222b8ef6738e053f9113a5ea24a197f2c0d6c4dbd70030f5e From 5ae71dd87beb529094fc81af01176b3904fb060b Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 19 Jan 2022 21:09:50 +0000 Subject: [PATCH 26/58] - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- alsa-utils.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index 0fbae58..7940bd6 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -5,7 +5,7 @@ Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -192,6 +192,9 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Wed Jan 19 2022 Fedora Release Engineering - 1.2.6-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + * Mon Dec 6 2021 Jaroslav Kysela - 1.2.6-1 * Updated to 1.2.6 From 7d224376e6cfb41f4a82e9245d68c999b346cf7c Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 31 May 2022 18:30:12 +0200 Subject: [PATCH 27/58] update to 1.2.7 Signed-off-by: Jaroslav Kysela --- alsa-utils.spec | 12 +++++++++--- sources | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index 7940bd6..a401024 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -1,11 +1,11 @@ -%define baseversion 1.2.6 +%define baseversion 1.2.7 #define fixversion .2 %global _hardened_build 1 Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 2%{?dist} +Release: 1%{?dist} License: GPLv2+ URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -104,8 +104,10 @@ install -p -m 644 %{SOURCE11} %{buildroot}/etc/alsa # Create /var/lib/alsa tree mkdir -p -m 755 %{buildroot}%{_sharedstatedir}/alsa +find %{buildroot} -name "*.la" -exec rm {} \; + %files -f %{name}.lang -%doc COPYING ChangeLog README.md TODO +%doc COPYING ChangeLog README.md TODO alsamixer/alsamixer.rc.example %config /etc/alsa/* %{_prefix}/lib/udev/rules.d/* %{_unitdir}/* @@ -163,6 +165,7 @@ mkdir -p -m 755 %{buildroot}%{_sharedstatedir}/alsa %files -n alsa-topology-utils %{_bindir}/alsatplg %{_mandir}/man1/alsatplg.1.gz +%{_libdir}/alsa-topology/libalsatplg_module_* %files alsabat %{_bindir}/alsabat @@ -192,6 +195,9 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Tue May 31 2022 Jaroslav Kysela - 1.2.7-1 +* Updated to 1.2.7 + * Wed Jan 19 2022 Fedora Release Engineering - 1.2.6-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild diff --git a/sources b/sources index d84d8e2..2003699 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (alsa-utils-1.2.6.tar.bz2) = 6842f0f4c2f7cc5ac3ba94736ee259d9988b5d3e0d2b522f858d712e16938d2845fa9ef64f4aa60222b8ef6738e053f9113a5ea24a197f2c0d6c4dbd70030f5e +SHA512 (alsa-utils-1.2.7.tar.bz2) = 1be8f617315193e6033653ac96a14bd1c3272cd9d8f3776cdb1357f35f5353652acd5975cfc5bd16278cd496f5bf409bb60432818a526282edad9a4c718a97c9 From 12e78e55bbf1ac8eccc8075cd29f8b640c1bc5fd Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 20 Jul 2022 20:41:35 +0000 Subject: [PATCH 28/58] Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- alsa-utils.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index a401024..5b0c8be 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -5,7 +5,7 @@ Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -195,6 +195,9 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Wed Jul 20 2022 Fedora Release Engineering - 1.2.7-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + * Tue May 31 2022 Jaroslav Kysela - 1.2.7-1 * Updated to 1.2.7 From f893b96bd52051148b9a415eabd5aebce84934ea Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 24 Oct 2022 10:57:02 +0200 Subject: [PATCH 29/58] update to 1.2.8 Signed-off-by: Jaroslav Kysela --- alsa-utils.spec | 7 +++++-- sources | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index 5b0c8be..bd8712c 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -1,11 +1,11 @@ -%define baseversion 1.2.7 +%define baseversion 1.2.8 #define fixversion .2 %global _hardened_build 1 Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 2%{?dist} +Release: 1%{?dist} License: GPLv2+ URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -195,6 +195,9 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Mon Oct 24 2022 Jaroslav Kysela - 1.2.8-1 +* Updated to 1.2.8 + * Wed Jul 20 2022 Fedora Release Engineering - 1.2.7-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild diff --git a/sources b/sources index 2003699..f250321 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (alsa-utils-1.2.7.tar.bz2) = 1be8f617315193e6033653ac96a14bd1c3272cd9d8f3776cdb1357f35f5353652acd5975cfc5bd16278cd496f5bf409bb60432818a526282edad9a4c718a97c9 +SHA512 (alsa-utils-1.2.8.tar.bz2) = 882e6f67467596ed273bf554fcce87d8ef287806bbdabd6c103de4980981f9e2102fb3800c6e8628ee8e86ffb165c1c92f9370c8145f28a6cb7cca563942330b From 04ecda8dbcdd41bcb0673dda80beb0b03210a84d Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 18 Jan 2023 21:38:24 +0000 Subject: [PATCH 30/58] Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- alsa-utils.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index bd8712c..ea8f14e 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -5,7 +5,7 @@ Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -195,6 +195,9 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Wed Jan 18 2023 Fedora Release Engineering - 1.2.8-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + * Mon Oct 24 2022 Jaroslav Kysela - 1.2.8-1 * Updated to 1.2.8 From 91d2bb1e33730db410804229fc04884e4565db3b Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 4 May 2023 10:11:27 +0200 Subject: [PATCH 31/58] update to 1.2.9 Signed-off-by: Jaroslav Kysela --- alsa-utils.spec | 7 +++++-- sources | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index ea8f14e..4fdf776 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -1,11 +1,11 @@ -%define baseversion 1.2.8 +%define baseversion 1.2.9 #define fixversion .2 %global _hardened_build 1 Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 2%{?dist} +Release: 1%{?dist} License: GPLv2+ URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -195,6 +195,9 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Thu May 4 2023 Jaroslav Kysela - 1.2.9-1 +* Updated to 1.2.9 + * Wed Jan 18 2023 Fedora Release Engineering - 1.2.8-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild diff --git a/sources b/sources index f250321..9abc33a 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (alsa-utils-1.2.8.tar.bz2) = 882e6f67467596ed273bf554fcce87d8ef287806bbdabd6c103de4980981f9e2102fb3800c6e8628ee8e86ffb165c1c92f9370c8145f28a6cb7cca563942330b +SHA512 (alsa-utils-1.2.9.tar.bz2) = f46e13fd57ed05ee38d3fa655e57b14335ecf0664dbe03275808383d87d28df153a81151e2e9d8786625f09929c567c89e145508a706a70eeb91ac1b11fb2fd4 From f0e629bce82ec3178edf364bb0b571945d8c4917 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 16 May 2023 17:54:03 +0200 Subject: [PATCH 32/58] add nhlt-dmic-info Signed-off-by: Jaroslav Kysela --- alsa-utils-git.patch | 554 +++++++++++++++++++++++++++++++++++++++++++ alsa-utils.spec | 7 +- 2 files changed, 560 insertions(+), 1 deletion(-) diff --git a/alsa-utils-git.patch b/alsa-utils-git.patch index e69de29..b6afcff 100644 --- a/alsa-utils-git.patch +++ b/alsa-utils-git.patch @@ -0,0 +1,554 @@ +From ee3965f6fac6c8b003acb097191125070708cccb Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Tue, 16 May 2023 15:38:24 +0200 +Subject: [PATCH] nhlt: add nhlt-dmic-info utility + +The microphone arrays for Intel platforms are described in the +ACPI NHLT table. This table is available in sysfs. Parse this +information and use a more common format (json) for output. This +information is usable for the further DSP processing. + +Signed-off-by: Jaroslav Kysela +--- + .gitignore | 1 + + Makefile.am | 3 + + configure.ac | 13 +- + nhlt/Makefile.am | 6 + + nhlt/nhlt-dmic-info.1 | 37 ++++ + nhlt/nhlt-dmic-info.c | 425 ++++++++++++++++++++++++++++++++++++++++++ + 6 files changed, 484 insertions(+), 1 deletion(-) + create mode 100644 nhlt/Makefile.am + create mode 100644 nhlt/nhlt-dmic-info.1 + create mode 100644 nhlt/nhlt-dmic-info.c + +diff --git a/Makefile.am b/Makefile.am +index 20dcfc8..b961506 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -31,6 +31,9 @@ endif + if HAVE_TOPOLOGY + SUBDIRS += topology + endif ++if NHLT ++SUBDIRS += nhlt ++endif + + EXTRA_DIST= README.md TODO gitcompile + AUTOMAKE_OPTIONS=foreign +diff --git a/configure.ac b/configure.ac +index e079e24..c91817a 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -189,6 +189,16 @@ AC_ARG_ENABLE(alsaloop, + esac],[alsaloop=true]) + AM_CONDITIONAL(ALSALOOP, test x$alsaloop = xtrue) + ++dnl Disable nhlt ++AC_ARG_ENABLE(nhlt, ++ AS_HELP_STRING([--disable-nhlt], [Disable nhlt packaging]), ++ [case "${enableval}" in ++ yes) nhlt=true ;; ++ no) nhlt=false ;; ++ *) AC_MSG_ERROR(bad value ${enableval} for --enable-nhlt) ;; ++ esac],[nhlt=true]) ++AM_CONDITIONAL(NHLT, test x$nhlt = xtrue) ++ + xmlto_available="" + AC_ARG_ENABLE(xmlto, + AS_HELP_STRING([--disable-xmlto], [Disable man page creation via xmlto]), +@@ -475,4 +485,5 @@ AC_OUTPUT(Makefile alsactl/Makefile alsactl/init/Makefile \ + seq/aplaymidi/Makefile seq/aseqdump/Makefile seq/aseqnet/Makefile \ + speaker-test/Makefile speaker-test/samples/Makefile \ + alsaloop/Makefile alsa-info/Makefile \ +- axfer/Makefile axfer/test/Makefile) ++ axfer/Makefile axfer/test/Makefile \ ++ nhlt/Makefile) +diff --git a/nhlt/Makefile.am b/nhlt/Makefile.am +new file mode 100644 +index 0000000..5aadda7 +--- /dev/null ++++ b/nhlt/Makefile.am +@@ -0,0 +1,6 @@ ++AM_CPPFLAGS = -I$(top_srcdir)/include ++ ++bin_PROGRAMS = nhlt-dmic-info ++nhlt_dmic_info_SOURCES = nhlt-dmic-info.c ++man_MANS = nhlt-dmic-info.1 ++EXTRA_DIST = nhlt-dmic-info.1 +diff --git a/nhlt/nhlt-dmic-info.1 b/nhlt/nhlt-dmic-info.1 +new file mode 100644 +index 0000000..22fdc5a +--- /dev/null ++++ b/nhlt/nhlt-dmic-info.1 +@@ -0,0 +1,37 @@ ++.TH NHLT-DMIC-INFO 1 "16 May 2023" ++.SH NAME ++nhlt-dmic-info \- dump microphone array information from ACPI NHLT table ++.SH SYNOPSIS ++\fBnhlt-dmic-info\fP [\fI\-option\fP] ++.SH DESCRIPTION ++ ++\fB\fBnhlt-dmic-info\fP\fP dumps microphone array information from ACPI NHLT ++table in JSON format. ++ ++.SH OPTIONS ++ ++.TP ++\fI\-h\fP | \fI\-\-help\fP ++ ++Prints the help information. ++ ++.TP ++\fI\-f \fP | \fI\-\-file=\fP ++ ++Input file with the binary ACPI NHLT table (default is \fB/sys/firmware/acpi/tables/NHLT\fR). ++ ++.TP ++\fI\-o \fP | \fI\-\-output=\fP ++ ++JSON output file (default is stdout: \fB\-\fR). ++ ++.SH EXAMPLES ++.nf ++\fBnhlt-dmic-info \-f nhlt.bin \-o dmic.json\fR ++ ++.ne ++.SH BUGS ++None known. ++.SH AUTHOR ++\fBnhlt-dmic-info\fP is by Jaroslav Kysela . ++This document is by Jaroslav Kysela . +diff --git a/nhlt/nhlt-dmic-info.c b/nhlt/nhlt-dmic-info.c +new file mode 100644 +index 0000000..44a7255 +--- /dev/null ++++ b/nhlt/nhlt-dmic-info.c +@@ -0,0 +1,425 @@ ++/* ++ * Extract microphone configuration from the ACPI NHLT table ++ * ++ * Specification: ++ * https://01.org/sites/default/files/595976_intel_sst_nhlt.pdf ++ * ++ * Author: Jaroslav Kysela ++ * ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++int debug = 0; ++ ++/* ++ * Dump dmic parameters in json ++ */ ++ ++#define ACPI_HDR_SIZE (4 + 4 + 1 + 1 + 6 + 8 + 4 + 4 + 4) ++#define NHLT_EP_HDR_SIZE (4 + 1 + 1 + 2 + 2 + 2 + 4 + 1 + 1 + 1) ++#define VENDOR_MIC_CFG_SIZE (1 + 1 + 2 + 2 + 2 + 1 + 1 + 2 + 2 + 2 + 2 + 2 + 2) ++ ++static const char *microphone_type(u_int8_t type) ++{ ++ switch (type) { ++ case 0: return "omnidirectional"; ++ case 1: return "subcardoid"; ++ case 2: return "cardoid"; ++ case 3: return "supercardoid"; ++ case 4: return "hypercardoid"; ++ case 5: return "8shaped"; ++ case 7: return "vendor"; ++ } ++ return "unknown"; ++} ++ ++static const char *microphone_location(u_int8_t location) ++{ ++ switch (location) { ++ case 0: return "laptop-top-panel"; ++ case 1: return "laptop-bottom-panel"; ++ case 2: return "laptop-left-panel"; ++ case 3: return "laptop-right-panel"; ++ case 4: return "laptop-front-panel"; ++ case 5: return "laptop-rear-panel"; ++ } ++ return "unknown"; ++} ++ ++ ++static inline u_int8_t get_u8(u_int8_t *base, u_int32_t off) ++{ ++ return *(base + off); ++} ++ ++static inline int32_t get_s16le(u_int8_t *base, u_int32_t off) ++{ ++ u_int32_t v = *(base + off + 0) | ++ (*(base + off + 1) << 8); ++ if (v & 0x8000) ++ return -((int32_t)0x10000 - (int32_t)v); ++ return v; ++} ++ ++static inline u_int32_t get_u32le(u_int8_t *base, u_int32_t off) ++{ ++ return *(base + off + 0) | ++ (*(base + off + 1) << 8) | ++ (*(base + off + 2) << 16) | ++ (*(base + off + 3) << 24); ++} ++ ++static int nhlt_dmic_config(FILE *out, uint8_t *dmic, uint8_t mic) ++{ ++ int32_t angle_begin, angle_end; ++ ++ if (mic > 0) ++ fprintf(out, ",\n"); ++ fprintf(out, "\t\t{\n"); ++ fprintf(out, "\t\t\t\"channel\":%i,\n", mic); ++ fprintf(out, "\t\t\t\"type\":\"%s\",\n", microphone_type(get_u8(dmic, 0))); ++ fprintf(out, "\t\t\t\"location\":\"%s\"", microphone_location(get_u8(dmic, 1))); ++ if (get_s16le(dmic, 2) != 0) ++ fprintf(out, ",\n\t\t\t\"speaker-distance\":%i", get_s16le(dmic, 2)); ++ if (get_s16le(dmic, 4) != 0) ++ fprintf(out, ",\n\t\t\t\"horizontal-offset\":%i", get_s16le(dmic, 4)); ++ if (get_s16le(dmic, 6) != 0) ++ fprintf(out, ",\n\t\t\t\"vertical-offset\":%i", get_s16le(dmic, 6)); ++ if (get_u8(dmic, 8) != 0) ++ fprintf(out, ",\n\t\t\t\"freq-low-band\":%i", get_u8(dmic, 8) * 5); ++ if (get_u8(dmic, 9) != 0) ++ fprintf(out, ",\n\t\t\t\"freq-high-band\":%i", get_u8(dmic, 9) * 500); ++ if (get_s16le(dmic, 10) != 0) ++ fprintf(out, ",\n\t\t\t\"direction-angle\":%i", get_s16le(dmic, 10)); ++ if (get_s16le(dmic, 12) != 0) ++ fprintf(out, ",\n\t\t\t\"elevation-angle\":%i", get_s16le(dmic, 12)); ++ angle_begin = get_s16le(dmic, 14); ++ angle_end = get_s16le(dmic, 16); ++ if (!((angle_begin == 180 && angle_end == -180) || ++ (angle_begin == -180 && angle_end == 180))) { ++ fprintf(out, ",\n\t\t\t\"vertical-angle-begin\":%i,\n", angle_begin); ++ fprintf(out, "\t\t\t\"vertical-angle-end\":%i", angle_end); ++ } ++ angle_begin = get_s16le(dmic, 18); ++ angle_end = get_s16le(dmic, 20); ++ if (!((angle_begin == 180 && angle_end == -180) || ++ (angle_begin == -180 && angle_end == 180))) { ++ fprintf(out, ",\n\t\t\t\"horizontal-angle-begin\":%i,\n", angle_begin); ++ fprintf(out, "\t\t\t\"horizontal-angle-end\":%i", angle_end); ++ } ++ fprintf(out, "\n\t\t}"); ++ return 0; ++} ++ ++static int nhlt_dmic_ep_to_json(FILE *out, uint8_t *ep, u_int32_t ep_size) ++{ ++ u_int32_t off, specific_cfg_size; ++ u_int8_t config_type, array_type, mic, num_mics; ++ int res; ++ ++ off = NHLT_EP_HDR_SIZE; ++ specific_cfg_size = get_u32le(ep, off); ++ if (off + specific_cfg_size > ep_size) ++ goto oob; ++ off += 4; ++ config_type = get_u8(ep, off + 1); ++ if (config_type != 1) /* mic array */ ++ return 0; ++ array_type = get_u8(ep, off + 2); ++ if ((array_type & 0x0f) != 0x0f) { ++ fprintf(stderr, "Unsupported ArrayType %02x\n", array_type & 0x0f); ++ return -EINVAL; ++ } ++ num_mics = get_u8(ep, off + 3); ++ fprintf(out, "{\n"); ++ fprintf(out, "\t\"mics-data-version\":1,\n"); ++ fprintf(out, "\t\"mics-data-source\":\"acpi-nhlt\""); ++ for (mic = 0; mic < num_mics; mic++) { ++ if (off - NHLT_EP_HDR_SIZE + VENDOR_MIC_CFG_SIZE > specific_cfg_size) { ++ fprintf(out, "\n}\n"); ++ goto oob; ++ } ++ if (mic == 0) ++ fprintf(out, ",\n\t\"mics\":[\n"); ++ res = nhlt_dmic_config(out, ep + off + 4, mic); ++ if (res < 0) ++ return res; ++ off += VENDOR_MIC_CFG_SIZE; ++ } ++ if (num_mics > 0) ++ fprintf(out, "\n\t]\n"); ++ fprintf(out, "}\n"); ++ return num_mics; ++oob: ++ fprintf(stderr, "Data (out-of-bounds) error\n"); ++ return -EINVAL; ++} ++ ++static int nhlt_table_to_json(FILE *out, u_int8_t *nhlt, u_int32_t size) ++{ ++ u_int32_t _size, off, ep_size; ++ u_int8_t sum = 0, ep, ep_count, link_type, dmics = 0; ++ int res; ++ ++ _size = get_u32le(nhlt, 4); ++ if (_size != size) { ++ fprintf(stderr, "Table size mismatch (%08x != %08x)\n", _size, (u_int32_t)size); ++ return -EINVAL; ++ } ++ for (off = 0; off < size; off++) ++ sum += get_u8(nhlt, off); ++ if (sum != 0) { ++ fprintf(stderr, "Checksum error (%02x)\n", sum); ++ return -EINVAL; ++ } ++ /* skip header */ ++ off = ACPI_HDR_SIZE; ++ ep_count = get_u8(nhlt, off++); ++ for (ep = 0; ep < ep_count; ep++) { ++ if (off + 17 > size) ++ goto oob; ++ ep_size = get_u32le(nhlt, off); ++ if (off + ep_size > size) ++ goto oob; ++ link_type = get_u8(nhlt, off + 4); ++ res = 0; ++ if (link_type == 2) { /* PDM */ ++ res = nhlt_dmic_ep_to_json(out, nhlt + off, ep_size); ++ if (res > 0) ++ dmics++; ++ } ++ if (res < 0) ++ return res; ++ off += ep_size; ++ } ++ if (dmics == 0) { ++ fprintf(stderr, "No dmic endpoint found\n"); ++ return -EINVAL; ++ } ++ return 0; ++oob: ++ fprintf(stderr, "Data (out-of-bounds) error\n"); ++ return -EINVAL; ++} ++ ++static int nhlt_to_json(FILE *out, const char *nhlt_file) ++{ ++ struct stat st; ++ u_int8_t *buf; ++ int _errno, fd, res; ++ size_t pos, size; ++ ssize_t ret; ++ ++ if (stat(nhlt_file, &st)) ++ return -errno; ++ size = st.st_size; ++ if (size < 45) ++ return -EINVAL; ++ buf = malloc(size); ++ if (buf == NULL) ++ return -ENOMEM; ++ fd = open(nhlt_file, O_RDONLY); ++ if (fd < 0) { ++ _errno = errno; ++ fprintf(stderr, "Unable to open file '%s': %s\n", nhlt_file, strerror(errno)); ++ return _errno; ++ } ++ pos = 0; ++ while (pos < size) { ++ ret = read(fd, buf + pos, size - pos); ++ if (ret <= 0) { ++ fprintf(stderr, "Short read\n"); ++ close(fd); ++ free(buf); ++ return -EIO; ++ } ++ pos += ret; ++ } ++ close(fd); ++ res = nhlt_table_to_json(out, buf, size); ++ free(buf); ++ return res; ++} ++ ++/* ++ * ++ */ ++ ++#define PROG "nhlt-dmic-info" ++#define VERSION "1" ++ ++#define NHLT_FILE "/sys/firmware/acpi/tables/NHLT" ++ ++#define TITLE 0x0100 ++#define HEADER 0x0200 ++#define FILEARG 0x0400 ++ ++#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) ++ ++struct arg { ++ int sarg; ++ char *larg; ++ char *comment; ++}; ++ ++static struct arg args[] = { ++{ TITLE, NULL, "Usage: nhtl-dmic-json " }, ++{ HEADER, NULL, "global options:" }, ++{ 'h', "help", "this help" }, ++{ 'v', "version", "print version of this program" }, ++{ FILEARG | 'f', "file", "NHLT file (default " NHLT_FILE ")" }, ++{ FILEARG | 'o', "output", "output file" }, ++{ 0, NULL, NULL } ++}; ++ ++static void help(void) ++{ ++ struct arg *n = args, *a; ++ char *larg, sa[4], buf[32]; ++ int sarg; ++ ++ sa[0] = '-'; ++ sa[2] = ','; ++ sa[3] = '\0'; ++ while (n->comment) { ++ a = n; ++ n++; ++ sarg = a->sarg; ++ if (sarg & (HEADER|TITLE)) { ++ printf("%s%s\n", (sarg & HEADER) != 0 ? "\n" : "", ++ a->comment); ++ continue; ++ } ++ buf[0] = '\0'; ++ larg = a->larg; ++ sa[1] = a->sarg; ++ sprintf(buf, "%s%s%s", sa[1] ? sa : "", ++ larg ? "--" : "", larg ? larg : ""); ++ if (sarg & FILEARG) ++ strcat(buf, " #"); ++ printf(" %-15s %s\n", buf, a->comment); ++ } ++} ++ ++int main(int argc, char *argv[]) ++{ ++ char *nhlt_file = NHLT_FILE; ++ char *output_file = "-"; ++ int i, j, k, res; ++ struct arg *a; ++ struct option *o, *long_option; ++ char *short_option; ++ FILE *output = NULL; ++ ++ long_option = calloc(ARRAY_SIZE(args), sizeof(struct option)); ++ if (long_option == NULL) ++ exit(EXIT_FAILURE); ++ short_option = malloc(128); ++ if (short_option == NULL) { ++ free(long_option); ++ exit(EXIT_FAILURE); ++ } ++ for (i = j = k = 0; i < ARRAY_SIZE(args); i++) { ++ a = &args[i]; ++ if ((a->sarg & 0xff) == 0) ++ continue; ++ o = &long_option[j]; ++ o->name = a->larg; ++ o->has_arg = (a->sarg & FILEARG) != 0; ++ o->flag = NULL; ++ o->val = a->sarg & 0xff; ++ j++; ++ short_option[k++] = o->val; ++ if (o->has_arg) ++ short_option[k++] = ':'; ++ } ++ short_option[k] = '\0'; ++ while (1) { ++ int c; ++ ++ if ((c = getopt_long(argc, argv, short_option, long_option, ++ NULL)) < 0) ++ break; ++ switch (c) { ++ case 'h': ++ help(); ++ res = EXIT_SUCCESS; ++ goto out; ++ case 'f': ++ nhlt_file = optarg; ++ break; ++ case 'o': ++ output_file = optarg; ++ break; ++ case 'd': ++ debug = 1; ++ break; ++ case 'v': ++ printf(PROG " version " VERSION "\n"); ++ res = EXIT_SUCCESS; ++ goto out; ++ case '?': // error msg already printed ++ help(); ++ res = EXIT_FAILURE; ++ goto out; ++ default: // should never happen ++ fprintf(stderr, ++ "Invalid option '%c' (%d) not handled??\n", c, c); ++ } ++ } ++ free(short_option); ++ short_option = NULL; ++ free(long_option); ++ long_option = NULL; ++ ++ if (strcmp(output_file, "-") == 0) { ++ output = stdout; ++ } else { ++ output = fopen(output_file, "w+"); ++ if (output == NULL) { ++ fprintf(stderr, "Unable to create output file \"%s\": %s\n", ++ output_file, strerror(-errno)); ++ res = EXIT_FAILURE; ++ goto out; ++ } ++ } ++ ++ if (argc - optind > 0) ++ fprintf(stderr, PROG ": Ignoring extra parameters\n"); ++ ++ res = 0; ++ if (nhlt_to_json(output, nhlt_file)) ++ res = EXIT_FAILURE; ++ ++out: ++ if (output) ++ fclose(output); ++ free(short_option); ++ free(long_option); ++ return res; ++} +-- +2.39.2 + diff --git a/alsa-utils.spec b/alsa-utils.spec index 4fdf776..27fbe64 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -5,7 +5,7 @@ Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -128,6 +128,7 @@ find %{buildroot} -name "*.la" -exec rm {} \; %{_bindir}/axfer %{_bindir}/iecset %{_bindir}/speaker-test +%{_bindir}/nhlt-dmic-info %{_sbindir}/* %exclude %{_sbindir}/alsabat-test.sh %{_datadir}/alsa/ @@ -152,6 +153,7 @@ find %{buildroot} -name "*.la" -exec rm {} \; %{_mandir}/man1/speaker-test.1.gz %{_mandir}/man1/aconnect.1.gz %{_mandir}/man1/alsa-info.sh.1.gz +%{_mandir}/man1/nhlt-dmic-info.1.gz %dir /etc/alsa/ %dir %{alsacfgdir}/ @@ -195,6 +197,9 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Tue May 16 2023 Jaroslav Kysela - 1.2.9-2 +* Add nhlt-dmic-info utility + * Thu May 4 2023 Jaroslav Kysela - 1.2.9-1 * Updated to 1.2.9 From 491d99741bfced9294a37c67033a67e9266249af Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 16 May 2023 18:05:46 +0200 Subject: [PATCH 33/58] fix build (autoreconf) Signed-off-by: Jaroslav Kysela --- alsa-utils.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/alsa-utils.spec b/alsa-utils.spec index 27fbe64..d4e32c5 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -65,6 +65,7 @@ Architecture (ALSA) framework and Fast Fourier Transform library. %patch1 -p1 -b .alsa-git %build +autoreconf -vif %configure CFLAGS="$RPM_OPT_FLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" --disable-alsaconf \ --with-udev-rules-dir=%{_prefix}/lib/udev/rules.d \ --with-systemdsystemunitdir=%{_unitdir} From b88d4e972a422512bbd4aa92cc8a1735aa44ff8e Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 16 May 2023 18:17:31 +0200 Subject: [PATCH 34/58] fix build (autoreconf) #2 Signed-off-by: Jaroslav Kysela --- alsa-utils.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index d4e32c5..81e94cf 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -17,7 +17,8 @@ Source11: alsactl.conf Source20: alsa-restore.service Source22: alsa-state.service -BuildRequires: gcc +BuildRequires: gcc +BuildRequires: autoconf automake libtool BuildRequires: alsa-lib-devel >= %{baseversion} BuildRequires: libsamplerate-devel BuildRequires: ncurses-devel From f966ddd17b209a363cb06c227aba2779ecc13401 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 6 Jun 2023 20:11:37 +0200 Subject: [PATCH 35/58] update SPDX license Signed-off-by: Jaroslav Kysela --- alsa-utils.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index 81e94cf..51dff4d 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -5,8 +5,8 @@ Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 2%{?dist} -License: GPLv2+ +Release: 3%{?dist} +License: GPL-2.0-or-later URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 Patch1: alsa-utils-git.patch @@ -199,6 +199,9 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Tue Jun 6 2023 Jaroslav Kysela - 1.2.9-3 +* SPDX license + * Tue May 16 2023 Jaroslav Kysela - 1.2.9-2 * Add nhlt-dmic-info utility From 8a5252591e4c2f7930da5ac90cb02d014215abf6 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 19 Jul 2023 13:10:24 +0000 Subject: [PATCH 36/58] Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- alsa-utils.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index 51dff4d..a0c037f 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -5,7 +5,7 @@ Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 3%{?dist} +Release: 4%{?dist} License: GPL-2.0-or-later URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -199,6 +199,9 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Wed Jul 19 2023 Fedora Release Engineering - 1.2.9-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + * Tue Jun 6 2023 Jaroslav Kysela - 1.2.9-3 * SPDX license From ad627191eb8f888733a76cdab69b162702afc687 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 1 Sep 2023 18:30:45 +0200 Subject: [PATCH 37/58] update to 1.2.10 Signed-off-by: Jaroslav Kysela --- alsa-utils-git.patch | 554 ------------------------------------------- alsa-utils.spec | 9 +- sources | 2 +- 3 files changed, 7 insertions(+), 558 deletions(-) diff --git a/alsa-utils-git.patch b/alsa-utils-git.patch index b6afcff..e69de29 100644 --- a/alsa-utils-git.patch +++ b/alsa-utils-git.patch @@ -1,554 +0,0 @@ -From ee3965f6fac6c8b003acb097191125070708cccb Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Tue, 16 May 2023 15:38:24 +0200 -Subject: [PATCH] nhlt: add nhlt-dmic-info utility - -The microphone arrays for Intel platforms are described in the -ACPI NHLT table. This table is available in sysfs. Parse this -information and use a more common format (json) for output. This -information is usable for the further DSP processing. - -Signed-off-by: Jaroslav Kysela ---- - .gitignore | 1 + - Makefile.am | 3 + - configure.ac | 13 +- - nhlt/Makefile.am | 6 + - nhlt/nhlt-dmic-info.1 | 37 ++++ - nhlt/nhlt-dmic-info.c | 425 ++++++++++++++++++++++++++++++++++++++++++ - 6 files changed, 484 insertions(+), 1 deletion(-) - create mode 100644 nhlt/Makefile.am - create mode 100644 nhlt/nhlt-dmic-info.1 - create mode 100644 nhlt/nhlt-dmic-info.c - -diff --git a/Makefile.am b/Makefile.am -index 20dcfc8..b961506 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -31,6 +31,9 @@ endif - if HAVE_TOPOLOGY - SUBDIRS += topology - endif -+if NHLT -+SUBDIRS += nhlt -+endif - - EXTRA_DIST= README.md TODO gitcompile - AUTOMAKE_OPTIONS=foreign -diff --git a/configure.ac b/configure.ac -index e079e24..c91817a 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -189,6 +189,16 @@ AC_ARG_ENABLE(alsaloop, - esac],[alsaloop=true]) - AM_CONDITIONAL(ALSALOOP, test x$alsaloop = xtrue) - -+dnl Disable nhlt -+AC_ARG_ENABLE(nhlt, -+ AS_HELP_STRING([--disable-nhlt], [Disable nhlt packaging]), -+ [case "${enableval}" in -+ yes) nhlt=true ;; -+ no) nhlt=false ;; -+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-nhlt) ;; -+ esac],[nhlt=true]) -+AM_CONDITIONAL(NHLT, test x$nhlt = xtrue) -+ - xmlto_available="" - AC_ARG_ENABLE(xmlto, - AS_HELP_STRING([--disable-xmlto], [Disable man page creation via xmlto]), -@@ -475,4 +485,5 @@ AC_OUTPUT(Makefile alsactl/Makefile alsactl/init/Makefile \ - seq/aplaymidi/Makefile seq/aseqdump/Makefile seq/aseqnet/Makefile \ - speaker-test/Makefile speaker-test/samples/Makefile \ - alsaloop/Makefile alsa-info/Makefile \ -- axfer/Makefile axfer/test/Makefile) -+ axfer/Makefile axfer/test/Makefile \ -+ nhlt/Makefile) -diff --git a/nhlt/Makefile.am b/nhlt/Makefile.am -new file mode 100644 -index 0000000..5aadda7 ---- /dev/null -+++ b/nhlt/Makefile.am -@@ -0,0 +1,6 @@ -+AM_CPPFLAGS = -I$(top_srcdir)/include -+ -+bin_PROGRAMS = nhlt-dmic-info -+nhlt_dmic_info_SOURCES = nhlt-dmic-info.c -+man_MANS = nhlt-dmic-info.1 -+EXTRA_DIST = nhlt-dmic-info.1 -diff --git a/nhlt/nhlt-dmic-info.1 b/nhlt/nhlt-dmic-info.1 -new file mode 100644 -index 0000000..22fdc5a ---- /dev/null -+++ b/nhlt/nhlt-dmic-info.1 -@@ -0,0 +1,37 @@ -+.TH NHLT-DMIC-INFO 1 "16 May 2023" -+.SH NAME -+nhlt-dmic-info \- dump microphone array information from ACPI NHLT table -+.SH SYNOPSIS -+\fBnhlt-dmic-info\fP [\fI\-option\fP] -+.SH DESCRIPTION -+ -+\fB\fBnhlt-dmic-info\fP\fP dumps microphone array information from ACPI NHLT -+table in JSON format. -+ -+.SH OPTIONS -+ -+.TP -+\fI\-h\fP | \fI\-\-help\fP -+ -+Prints the help information. -+ -+.TP -+\fI\-f \fP | \fI\-\-file=\fP -+ -+Input file with the binary ACPI NHLT table (default is \fB/sys/firmware/acpi/tables/NHLT\fR). -+ -+.TP -+\fI\-o \fP | \fI\-\-output=\fP -+ -+JSON output file (default is stdout: \fB\-\fR). -+ -+.SH EXAMPLES -+.nf -+\fBnhlt-dmic-info \-f nhlt.bin \-o dmic.json\fR -+ -+.ne -+.SH BUGS -+None known. -+.SH AUTHOR -+\fBnhlt-dmic-info\fP is by Jaroslav Kysela . -+This document is by Jaroslav Kysela . -diff --git a/nhlt/nhlt-dmic-info.c b/nhlt/nhlt-dmic-info.c -new file mode 100644 -index 0000000..44a7255 ---- /dev/null -+++ b/nhlt/nhlt-dmic-info.c -@@ -0,0 +1,425 @@ -+/* -+ * Extract microphone configuration from the ACPI NHLT table -+ * -+ * Specification: -+ * https://01.org/sites/default/files/595976_intel_sst_nhlt.pdf -+ * -+ * Author: Jaroslav Kysela -+ * -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ * -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+int debug = 0; -+ -+/* -+ * Dump dmic parameters in json -+ */ -+ -+#define ACPI_HDR_SIZE (4 + 4 + 1 + 1 + 6 + 8 + 4 + 4 + 4) -+#define NHLT_EP_HDR_SIZE (4 + 1 + 1 + 2 + 2 + 2 + 4 + 1 + 1 + 1) -+#define VENDOR_MIC_CFG_SIZE (1 + 1 + 2 + 2 + 2 + 1 + 1 + 2 + 2 + 2 + 2 + 2 + 2) -+ -+static const char *microphone_type(u_int8_t type) -+{ -+ switch (type) { -+ case 0: return "omnidirectional"; -+ case 1: return "subcardoid"; -+ case 2: return "cardoid"; -+ case 3: return "supercardoid"; -+ case 4: return "hypercardoid"; -+ case 5: return "8shaped"; -+ case 7: return "vendor"; -+ } -+ return "unknown"; -+} -+ -+static const char *microphone_location(u_int8_t location) -+{ -+ switch (location) { -+ case 0: return "laptop-top-panel"; -+ case 1: return "laptop-bottom-panel"; -+ case 2: return "laptop-left-panel"; -+ case 3: return "laptop-right-panel"; -+ case 4: return "laptop-front-panel"; -+ case 5: return "laptop-rear-panel"; -+ } -+ return "unknown"; -+} -+ -+ -+static inline u_int8_t get_u8(u_int8_t *base, u_int32_t off) -+{ -+ return *(base + off); -+} -+ -+static inline int32_t get_s16le(u_int8_t *base, u_int32_t off) -+{ -+ u_int32_t v = *(base + off + 0) | -+ (*(base + off + 1) << 8); -+ if (v & 0x8000) -+ return -((int32_t)0x10000 - (int32_t)v); -+ return v; -+} -+ -+static inline u_int32_t get_u32le(u_int8_t *base, u_int32_t off) -+{ -+ return *(base + off + 0) | -+ (*(base + off + 1) << 8) | -+ (*(base + off + 2) << 16) | -+ (*(base + off + 3) << 24); -+} -+ -+static int nhlt_dmic_config(FILE *out, uint8_t *dmic, uint8_t mic) -+{ -+ int32_t angle_begin, angle_end; -+ -+ if (mic > 0) -+ fprintf(out, ",\n"); -+ fprintf(out, "\t\t{\n"); -+ fprintf(out, "\t\t\t\"channel\":%i,\n", mic); -+ fprintf(out, "\t\t\t\"type\":\"%s\",\n", microphone_type(get_u8(dmic, 0))); -+ fprintf(out, "\t\t\t\"location\":\"%s\"", microphone_location(get_u8(dmic, 1))); -+ if (get_s16le(dmic, 2) != 0) -+ fprintf(out, ",\n\t\t\t\"speaker-distance\":%i", get_s16le(dmic, 2)); -+ if (get_s16le(dmic, 4) != 0) -+ fprintf(out, ",\n\t\t\t\"horizontal-offset\":%i", get_s16le(dmic, 4)); -+ if (get_s16le(dmic, 6) != 0) -+ fprintf(out, ",\n\t\t\t\"vertical-offset\":%i", get_s16le(dmic, 6)); -+ if (get_u8(dmic, 8) != 0) -+ fprintf(out, ",\n\t\t\t\"freq-low-band\":%i", get_u8(dmic, 8) * 5); -+ if (get_u8(dmic, 9) != 0) -+ fprintf(out, ",\n\t\t\t\"freq-high-band\":%i", get_u8(dmic, 9) * 500); -+ if (get_s16le(dmic, 10) != 0) -+ fprintf(out, ",\n\t\t\t\"direction-angle\":%i", get_s16le(dmic, 10)); -+ if (get_s16le(dmic, 12) != 0) -+ fprintf(out, ",\n\t\t\t\"elevation-angle\":%i", get_s16le(dmic, 12)); -+ angle_begin = get_s16le(dmic, 14); -+ angle_end = get_s16le(dmic, 16); -+ if (!((angle_begin == 180 && angle_end == -180) || -+ (angle_begin == -180 && angle_end == 180))) { -+ fprintf(out, ",\n\t\t\t\"vertical-angle-begin\":%i,\n", angle_begin); -+ fprintf(out, "\t\t\t\"vertical-angle-end\":%i", angle_end); -+ } -+ angle_begin = get_s16le(dmic, 18); -+ angle_end = get_s16le(dmic, 20); -+ if (!((angle_begin == 180 && angle_end == -180) || -+ (angle_begin == -180 && angle_end == 180))) { -+ fprintf(out, ",\n\t\t\t\"horizontal-angle-begin\":%i,\n", angle_begin); -+ fprintf(out, "\t\t\t\"horizontal-angle-end\":%i", angle_end); -+ } -+ fprintf(out, "\n\t\t}"); -+ return 0; -+} -+ -+static int nhlt_dmic_ep_to_json(FILE *out, uint8_t *ep, u_int32_t ep_size) -+{ -+ u_int32_t off, specific_cfg_size; -+ u_int8_t config_type, array_type, mic, num_mics; -+ int res; -+ -+ off = NHLT_EP_HDR_SIZE; -+ specific_cfg_size = get_u32le(ep, off); -+ if (off + specific_cfg_size > ep_size) -+ goto oob; -+ off += 4; -+ config_type = get_u8(ep, off + 1); -+ if (config_type != 1) /* mic array */ -+ return 0; -+ array_type = get_u8(ep, off + 2); -+ if ((array_type & 0x0f) != 0x0f) { -+ fprintf(stderr, "Unsupported ArrayType %02x\n", array_type & 0x0f); -+ return -EINVAL; -+ } -+ num_mics = get_u8(ep, off + 3); -+ fprintf(out, "{\n"); -+ fprintf(out, "\t\"mics-data-version\":1,\n"); -+ fprintf(out, "\t\"mics-data-source\":\"acpi-nhlt\""); -+ for (mic = 0; mic < num_mics; mic++) { -+ if (off - NHLT_EP_HDR_SIZE + VENDOR_MIC_CFG_SIZE > specific_cfg_size) { -+ fprintf(out, "\n}\n"); -+ goto oob; -+ } -+ if (mic == 0) -+ fprintf(out, ",\n\t\"mics\":[\n"); -+ res = nhlt_dmic_config(out, ep + off + 4, mic); -+ if (res < 0) -+ return res; -+ off += VENDOR_MIC_CFG_SIZE; -+ } -+ if (num_mics > 0) -+ fprintf(out, "\n\t]\n"); -+ fprintf(out, "}\n"); -+ return num_mics; -+oob: -+ fprintf(stderr, "Data (out-of-bounds) error\n"); -+ return -EINVAL; -+} -+ -+static int nhlt_table_to_json(FILE *out, u_int8_t *nhlt, u_int32_t size) -+{ -+ u_int32_t _size, off, ep_size; -+ u_int8_t sum = 0, ep, ep_count, link_type, dmics = 0; -+ int res; -+ -+ _size = get_u32le(nhlt, 4); -+ if (_size != size) { -+ fprintf(stderr, "Table size mismatch (%08x != %08x)\n", _size, (u_int32_t)size); -+ return -EINVAL; -+ } -+ for (off = 0; off < size; off++) -+ sum += get_u8(nhlt, off); -+ if (sum != 0) { -+ fprintf(stderr, "Checksum error (%02x)\n", sum); -+ return -EINVAL; -+ } -+ /* skip header */ -+ off = ACPI_HDR_SIZE; -+ ep_count = get_u8(nhlt, off++); -+ for (ep = 0; ep < ep_count; ep++) { -+ if (off + 17 > size) -+ goto oob; -+ ep_size = get_u32le(nhlt, off); -+ if (off + ep_size > size) -+ goto oob; -+ link_type = get_u8(nhlt, off + 4); -+ res = 0; -+ if (link_type == 2) { /* PDM */ -+ res = nhlt_dmic_ep_to_json(out, nhlt + off, ep_size); -+ if (res > 0) -+ dmics++; -+ } -+ if (res < 0) -+ return res; -+ off += ep_size; -+ } -+ if (dmics == 0) { -+ fprintf(stderr, "No dmic endpoint found\n"); -+ return -EINVAL; -+ } -+ return 0; -+oob: -+ fprintf(stderr, "Data (out-of-bounds) error\n"); -+ return -EINVAL; -+} -+ -+static int nhlt_to_json(FILE *out, const char *nhlt_file) -+{ -+ struct stat st; -+ u_int8_t *buf; -+ int _errno, fd, res; -+ size_t pos, size; -+ ssize_t ret; -+ -+ if (stat(nhlt_file, &st)) -+ return -errno; -+ size = st.st_size; -+ if (size < 45) -+ return -EINVAL; -+ buf = malloc(size); -+ if (buf == NULL) -+ return -ENOMEM; -+ fd = open(nhlt_file, O_RDONLY); -+ if (fd < 0) { -+ _errno = errno; -+ fprintf(stderr, "Unable to open file '%s': %s\n", nhlt_file, strerror(errno)); -+ return _errno; -+ } -+ pos = 0; -+ while (pos < size) { -+ ret = read(fd, buf + pos, size - pos); -+ if (ret <= 0) { -+ fprintf(stderr, "Short read\n"); -+ close(fd); -+ free(buf); -+ return -EIO; -+ } -+ pos += ret; -+ } -+ close(fd); -+ res = nhlt_table_to_json(out, buf, size); -+ free(buf); -+ return res; -+} -+ -+/* -+ * -+ */ -+ -+#define PROG "nhlt-dmic-info" -+#define VERSION "1" -+ -+#define NHLT_FILE "/sys/firmware/acpi/tables/NHLT" -+ -+#define TITLE 0x0100 -+#define HEADER 0x0200 -+#define FILEARG 0x0400 -+ -+#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) -+ -+struct arg { -+ int sarg; -+ char *larg; -+ char *comment; -+}; -+ -+static struct arg args[] = { -+{ TITLE, NULL, "Usage: nhtl-dmic-json " }, -+{ HEADER, NULL, "global options:" }, -+{ 'h', "help", "this help" }, -+{ 'v', "version", "print version of this program" }, -+{ FILEARG | 'f', "file", "NHLT file (default " NHLT_FILE ")" }, -+{ FILEARG | 'o', "output", "output file" }, -+{ 0, NULL, NULL } -+}; -+ -+static void help(void) -+{ -+ struct arg *n = args, *a; -+ char *larg, sa[4], buf[32]; -+ int sarg; -+ -+ sa[0] = '-'; -+ sa[2] = ','; -+ sa[3] = '\0'; -+ while (n->comment) { -+ a = n; -+ n++; -+ sarg = a->sarg; -+ if (sarg & (HEADER|TITLE)) { -+ printf("%s%s\n", (sarg & HEADER) != 0 ? "\n" : "", -+ a->comment); -+ continue; -+ } -+ buf[0] = '\0'; -+ larg = a->larg; -+ sa[1] = a->sarg; -+ sprintf(buf, "%s%s%s", sa[1] ? sa : "", -+ larg ? "--" : "", larg ? larg : ""); -+ if (sarg & FILEARG) -+ strcat(buf, " #"); -+ printf(" %-15s %s\n", buf, a->comment); -+ } -+} -+ -+int main(int argc, char *argv[]) -+{ -+ char *nhlt_file = NHLT_FILE; -+ char *output_file = "-"; -+ int i, j, k, res; -+ struct arg *a; -+ struct option *o, *long_option; -+ char *short_option; -+ FILE *output = NULL; -+ -+ long_option = calloc(ARRAY_SIZE(args), sizeof(struct option)); -+ if (long_option == NULL) -+ exit(EXIT_FAILURE); -+ short_option = malloc(128); -+ if (short_option == NULL) { -+ free(long_option); -+ exit(EXIT_FAILURE); -+ } -+ for (i = j = k = 0; i < ARRAY_SIZE(args); i++) { -+ a = &args[i]; -+ if ((a->sarg & 0xff) == 0) -+ continue; -+ o = &long_option[j]; -+ o->name = a->larg; -+ o->has_arg = (a->sarg & FILEARG) != 0; -+ o->flag = NULL; -+ o->val = a->sarg & 0xff; -+ j++; -+ short_option[k++] = o->val; -+ if (o->has_arg) -+ short_option[k++] = ':'; -+ } -+ short_option[k] = '\0'; -+ while (1) { -+ int c; -+ -+ if ((c = getopt_long(argc, argv, short_option, long_option, -+ NULL)) < 0) -+ break; -+ switch (c) { -+ case 'h': -+ help(); -+ res = EXIT_SUCCESS; -+ goto out; -+ case 'f': -+ nhlt_file = optarg; -+ break; -+ case 'o': -+ output_file = optarg; -+ break; -+ case 'd': -+ debug = 1; -+ break; -+ case 'v': -+ printf(PROG " version " VERSION "\n"); -+ res = EXIT_SUCCESS; -+ goto out; -+ case '?': // error msg already printed -+ help(); -+ res = EXIT_FAILURE; -+ goto out; -+ default: // should never happen -+ fprintf(stderr, -+ "Invalid option '%c' (%d) not handled??\n", c, c); -+ } -+ } -+ free(short_option); -+ short_option = NULL; -+ free(long_option); -+ long_option = NULL; -+ -+ if (strcmp(output_file, "-") == 0) { -+ output = stdout; -+ } else { -+ output = fopen(output_file, "w+"); -+ if (output == NULL) { -+ fprintf(stderr, "Unable to create output file \"%s\": %s\n", -+ output_file, strerror(-errno)); -+ res = EXIT_FAILURE; -+ goto out; -+ } -+ } -+ -+ if (argc - optind > 0) -+ fprintf(stderr, PROG ": Ignoring extra parameters\n"); -+ -+ res = 0; -+ if (nhlt_to_json(output, nhlt_file)) -+ res = EXIT_FAILURE; -+ -+out: -+ if (output) -+ fclose(output); -+ free(short_option); -+ free(long_option); -+ return res; -+} --- -2.39.2 - diff --git a/alsa-utils.spec b/alsa-utils.spec index a0c037f..f6d414e 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -1,11 +1,11 @@ -%define baseversion 1.2.9 +%define baseversion 1.2.10 #define fixversion .2 %global _hardened_build 1 Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 4%{?dist} +Release: 1%{?dist} License: GPL-2.0-or-later URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -63,7 +63,7 @@ Architecture (ALSA) framework and Fast Fourier Transform library. %prep %setup -q -n %{name}-%{version} -%patch1 -p1 -b .alsa-git +%patch -P 1 -p1 -b .alsa-git %build autoreconf -vif @@ -199,6 +199,9 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Fri Sep 1 2023 Jaroslav Kysela - 1.2.10-1 +* Updated to 1.2.10 + * Wed Jul 19 2023 Fedora Release Engineering - 1.2.9-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild diff --git a/sources b/sources index 9abc33a..b52d368 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (alsa-utils-1.2.9.tar.bz2) = f46e13fd57ed05ee38d3fa655e57b14335ecf0664dbe03275808383d87d28df153a81151e2e9d8786625f09929c567c89e145508a706a70eeb91ac1b11fb2fd4 +SHA512 (alsa-utils-1.2.10.tar.bz2) = 22adedf6d491d7768d24f054262a9c12bc952049db8374e104c0477ebf84266dcbeb0a2a3a1765b89958073d341f64dedbae63e3cae66f4983a0424e5cb3243f From 1556eeb427b4afaea7611707457569aea4b61331 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 19 Jan 2024 12:45:47 +0000 Subject: [PATCH 38/58] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- alsa-utils.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index f6d414e..96c6f0d 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -5,7 +5,7 @@ Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 1%{?dist} +Release: 2%{?dist} License: GPL-2.0-or-later URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -199,6 +199,9 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Fri Jan 19 2024 Fedora Release Engineering - 1.2.10-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Fri Sep 1 2023 Jaroslav Kysela - 1.2.10-1 * Updated to 1.2.10 From 7e840cf34eca5eaf9eb6d577a89523507f9f121e Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Mon, 22 Jan 2024 22:56:59 +0000 Subject: [PATCH 39/58] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- alsa-utils.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index 96c6f0d..2490dfa 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -5,7 +5,7 @@ Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 2%{?dist} +Release: 3%{?dist} License: GPL-2.0-or-later URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -199,6 +199,9 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Mon Jan 22 2024 Fedora Release Engineering - 1.2.10-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Fri Jan 19 2024 Fedora Release Engineering - 1.2.10-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild From 3c01a4c1f0c99d9332e3e36e0476268018d75746 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 29 Jan 2024 14:37:35 +0100 Subject: [PATCH 40/58] update to 1.2.11 Signed-off-by: Jaroslav Kysela --- alsa-utils.spec | 5 ++++- sources | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index 2490dfa..34adf62 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -5,7 +5,7 @@ Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 3%{?dist} +Release: 1%{?dist} License: GPL-2.0-or-later URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -199,6 +199,9 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Mon Jan 29 2024 Jaroslav Kysela - 1.2.11-1 +* Updated to 1.2.11 + * Mon Jan 22 2024 Fedora Release Engineering - 1.2.10-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild diff --git a/sources b/sources index b52d368..cc35bdb 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (alsa-utils-1.2.10.tar.bz2) = 22adedf6d491d7768d24f054262a9c12bc952049db8374e104c0477ebf84266dcbeb0a2a3a1765b89958073d341f64dedbae63e3cae66f4983a0424e5cb3243f +SHA512 (alsa-utils-1.2.11.tar.bz2) = 5ce76807b53357584bfb4ace5acfdac4db9168ffaf5cdd1e499738eec046c36112bf84a99970f66368063a9baf73bad93af2d439630572f3eba5c9321071172d From 855d495e272eb8dfcea2b29035ddaf98e97bc724 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 29 Jan 2024 14:39:26 +0100 Subject: [PATCH 41/58] fix baseversion to 1.2.11 Signed-off-by: Jaroslav Kysela --- alsa-utils.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index 34adf62..5228bf5 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -1,4 +1,4 @@ -%define baseversion 1.2.10 +%define baseversion 1.2.11 #define fixversion .2 %global _hardened_build 1 From 57be7e615a34ad2cf436a90b7cd8c637dd5bd7f0 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 10 Jun 2024 14:24:48 +0200 Subject: [PATCH 42/58] updated to 1.2.12 Signed-off-by: Jaroslav Kysela --- alsa-utils.spec | 9 ++++++--- sources | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index 5228bf5..7bd3436 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -1,4 +1,4 @@ -%define baseversion 1.2.11 +%define baseversion 1.2.12 #define fixversion .2 %global _hardened_build 1 @@ -9,7 +9,7 @@ Release: 1%{?dist} License: GPL-2.0-or-later URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 -Patch1: alsa-utils-git.patch +#Patch1: alsa-utils-git.patch Source4: alsaunmute Source5: alsaunmute.1 Source10: alsa.rules @@ -63,7 +63,7 @@ Architecture (ALSA) framework and Fast Fourier Transform library. %prep %setup -q -n %{name}-%{version} -%patch -P 1 -p1 -b .alsa-git +#patch -P 1 -p1 -b .alsa-git %build autoreconf -vif @@ -199,6 +199,9 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Mon Jun 10 2024 Jaroslav Kysela - 1.2.12-1 +* Updated to 1.2.12 + * Mon Jan 29 2024 Jaroslav Kysela - 1.2.11-1 * Updated to 1.2.11 diff --git a/sources b/sources index cc35bdb..7b77ab3 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (alsa-utils-1.2.11.tar.bz2) = 5ce76807b53357584bfb4ace5acfdac4db9168ffaf5cdd1e499738eec046c36112bf84a99970f66368063a9baf73bad93af2d439630572f3eba5c9321071172d +SHA512 (alsa-utils-1.2.12.tar.bz2) = 6631f9f8e32fbb1f7b06af086cdfb8349c2d70188c4509ab46fa105024fbde9985985d9cc738c7b5a743cacaaeae7a7006f8ef92f66a50762f7df5d714bf548b From af2b8fab733f72a8f0358be0f7ccdde2311f60e9 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 11 Jun 2024 10:54:05 +0200 Subject: [PATCH 43/58] add missing aseqsend utility to file list Signed-off-by: Jaroslav Kysela --- alsa-utils.spec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index 7bd3436..bfbd63d 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -127,6 +127,7 @@ find %{buildroot} -name "*.la" -exec rm {} \; %{_bindir}/arecordmidi %{_bindir}/aseqdump %{_bindir}/aseqnet +%{_bindir}/aseqsend %{_bindir}/axfer %{_bindir}/iecset %{_bindir}/speaker-test @@ -148,6 +149,7 @@ find %{buildroot} -name "*.la" -exec rm {} \; %{_mandir}/man1/arecordmidi.1.gz %{_mandir}/man1/aseqdump.1.gz %{_mandir}/man1/aseqnet.1.gz +%{_mandir}/man1/aseqsend.1.gz %{_mandir}/man1/axfer.1.gz %{_mandir}/man1/axfer-list.1.gz %{_mandir}/man1/axfer-transfer.1.gz @@ -199,7 +201,7 @@ fi %systemd_postun_with_restart alsa-state.service %changelog -* Mon Jun 10 2024 Jaroslav Kysela - 1.2.12-1 +* Tue Jun 11 2024 Jaroslav Kysela - 1.2.12-1 * Updated to 1.2.12 * Mon Jan 29 2024 Jaroslav Kysela - 1.2.11-1 From df95d97fceaf0630376b44b8828c43a2b6d8a1af Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 17 Jul 2024 16:53:31 +0000 Subject: [PATCH 44/58] Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild --- alsa-utils.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index bfbd63d..2f2b923 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -5,7 +5,7 @@ Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 1%{?dist} +Release: 2%{?dist} License: GPL-2.0-or-later URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -201,6 +201,9 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Wed Jul 17 2024 Fedora Release Engineering - 1.2.12-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + * Tue Jun 11 2024 Jaroslav Kysela - 1.2.12-1 * Updated to 1.2.12 From 76b6ba63bc1925f8246a8e4d06f44322363ec62f Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 12 Nov 2024 13:49:19 +0100 Subject: [PATCH 45/58] update to 1.2.13 Signed-off-by: Jaroslav Kysela --- alsa-utils.spec | 21 ++++++++++++++------- alsa.rules | 8 -------- sources | 2 +- 3 files changed, 15 insertions(+), 16 deletions(-) delete mode 100644 alsa.rules diff --git a/alsa-utils.spec b/alsa-utils.spec index 2f2b923..f75f846 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -1,18 +1,17 @@ -%define baseversion 1.2.12 +%define baseversion 1.2.13 #define fixversion .2 %global _hardened_build 1 Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 2%{?dist} +Release: 1%{?dist} License: GPL-2.0-or-later URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 #Patch1: alsa-utils-git.patch Source4: alsaunmute Source5: alsaunmute.1 -Source10: alsa.rules Source11: alsactl.conf Source20: alsa-restore.service Source22: alsa-state.service @@ -69,7 +68,9 @@ Architecture (ALSA) framework and Fast Fourier Transform library. autoreconf -vif %configure CFLAGS="$RPM_OPT_FLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" --disable-alsaconf \ --with-udev-rules-dir=%{_prefix}/lib/udev/rules.d \ - --with-systemdsystemunitdir=%{_unitdir} + --with-systemdsystemunitdir=%{_unitdir} \ + --with-alsactl-udev-args="-E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf --initfile=/lib/alsa/init/00main" \ + --with-alsactl-udev-extra-test="" make %{?_smp_mflags} cp %{SOURCE4} . @@ -79,9 +80,8 @@ cp %{SOURCE4} . make install DESTDIR=%{buildroot} %find_lang %{name} -# Install ALSA udev rules +# Install ALSA udev rules and services mkdir -p %{buildroot}/%{_prefix}/lib/udev/rules.d -install -p -m 644 %{SOURCE10} %{buildroot}/%{_prefix}/lib/udev/rules.d/90-alsa-restore.rules mkdir -p %{buildroot}/%{_unitdir} install -p -m 644 %{SOURCE20} %{buildroot}/%{_unitdir}/alsa-restore.service install -p -m 644 %{SOURCE22} %{buildroot}/%{_unitdir}/alsa-state.service @@ -113,7 +113,7 @@ find %{buildroot} -name "*.la" -exec rm {} \; %config /etc/alsa/* %{_prefix}/lib/udev/rules.d/* %{_unitdir}/* -%{_unitdir}/sound.target.wants/* +#{_unitdir}/sound.target.wants/* %{alsacfgdir}/init/* %{_bindir}/aconnect %{_bindir}/alsaloop @@ -123,8 +123,10 @@ find %{buildroot} -name "*.la" -exec rm {} \; %{_bindir}/amixer %{_bindir}/aplay %{_bindir}/aplaymidi +%{_bindir}/aplaymidi2 %{_bindir}/arecord %{_bindir}/arecordmidi +%{_bindir}/arecordmidi2 %{_bindir}/aseqdump %{_bindir}/aseqnet %{_bindir}/aseqsend @@ -145,8 +147,10 @@ find %{buildroot} -name "*.la" -exec rm {} \; %{_mandir}/man1/amixer.1.gz %{_mandir}/man1/aplay.1.gz %{_mandir}/man1/aplaymidi.1.gz +%{_mandir}/man1/aplaymidi2.1.gz %{_mandir}/man1/arecord.1.gz %{_mandir}/man1/arecordmidi.1.gz +%{_mandir}/man1/arecordmidi2.1.gz %{_mandir}/man1/aseqdump.1.gz %{_mandir}/man1/aseqnet.1.gz %{_mandir}/man1/aseqsend.1.gz @@ -201,6 +205,9 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Tue Nov 12 2024 Jaroslav Kysela - 1.2.13-1 +* Updated to 1.2.13 + * Wed Jul 17 2024 Fedora Release Engineering - 1.2.12-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild diff --git a/alsa.rules b/alsa.rules deleted file mode 100644 index 6a4a0c3..0000000 --- a/alsa.rules +++ /dev/null @@ -1,8 +0,0 @@ -ACTION=="add", SUBSYSTEM=="sound", KERNEL=="controlC*", KERNELS!="card*", GOTO="alsa_restore_go" -GOTO="alsa_restore_end" - -LABEL="alsa_restore_go" -TEST!="/etc/alsa/state-daemon.conf", RUN+="/sbin/alsactl -E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf --initfile=/lib/alsa/init/00main restore /dev/$name" -TEST=="/etc/alsa/state-daemon.conf", RUN+="/sbin/alsactl -E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf --initfile=/lib/alsa/init/00main nrestore /dev/$name" - -LABEL="alsa_restore_end" diff --git a/sources b/sources index 7b77ab3..96a6018 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (alsa-utils-1.2.12.tar.bz2) = 6631f9f8e32fbb1f7b06af086cdfb8349c2d70188c4509ab46fa105024fbde9985985d9cc738c7b5a743cacaaeae7a7006f8ef92f66a50762f7df5d714bf548b +SHA512 (alsa-utils-1.2.13.tar.bz2) = 0e2fb5b6e497b977badba2ebe2bddfc819654d24001622e0299e4034210caeeea2f3c2c2d1d260a48caefb6584e0b989fdb7036c6012108c8c38d89b3cb04c78 From 65c6a14b105168059fc20dc61248d616371d88fe Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 14 Nov 2024 09:49:39 +0100 Subject: [PATCH 46/58] fix 90-alsa-restore.rules.in Signed-off-by: Jaroslav Kysela --- alsa-git.patch | 40 ++++++++++++++++++++++++++++++++++++++++ alsa-utils.spec | 7 ++++--- 2 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 alsa-git.patch diff --git a/alsa-git.patch b/alsa-git.patch new file mode 100644 index 0000000..7dcbf59 --- /dev/null +++ b/alsa-git.patch @@ -0,0 +1,40 @@ +From f90124c73edd050b24961197a4abcf17e53b41a8 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 14 Nov 2024 09:38:49 +0100 +Subject: [PATCH] alsactl: 90-alsa-restore.rules - fix alsa_restore_go/std + +Fix the label mismatch which was introduced in the transition from the +temporary test rules. + +Closes: https://github.com/alsa-project/alsa-utils/issues/280 +Fixes: 8116639 ("alsactl: 90-alsa-restore.rules - add support for AMD ACP digital microphone") +Signed-off-by: Jaroslav Kysela +--- + alsactl/90-alsa-restore.rules.in | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/alsactl/90-alsa-restore.rules.in b/alsactl/90-alsa-restore.rules.in +index 85f0b15..dae2ed8 100644 +--- a/alsactl/90-alsa-restore.rules.in ++++ b/alsactl/90-alsa-restore.rules.in +@@ -3,6 +3,8 @@ + ACTION=="add", SUBSYSTEM=="sound", KERNEL=="controlC*", KERNELS!="card*",@extratest@ GOTO="alsa_restore_go" + GOTO="alsa_restore_end" + ++LABEL="alsa_restore_go" ++ + ENV{ALSA_CARD_NUMBER}="$attr{device/number}" + + # mark HDA analog card; HDMI/DP card does not have capture devices +@@ -21,7 +23,7 @@ TEST!="/run/udev/alsa-hda-analog-card", GOTO="alsa_restore_std" + IMPORT{program}="/usr/bin/cat /run/udev/alsa-hda-analog-card" + ENV{ALSA_CARD_HDA_ANALOG}!="", ENV{ALSA_CARD_NUMBER}="$env{ALSA_CARD_HDA_ANALOG}" + +-LABEL="alsa_restore_go" ++LABEL="alsa_restore_std" + TEST!="@daemonswitch@", RUN+="@sbindir@/alsactl@args@ restore $env{ALSA_CARD_NUMBER}" + TEST=="@daemonswitch@", RUN+="@sbindir@/alsactl@args@ nrestore $env{ALSA_CARD_NUMBER}" + +-- +2.47.0 + diff --git a/alsa-utils.spec b/alsa-utils.spec index f75f846..9256941 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -5,7 +5,7 @@ Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 1%{?dist} +Release: 2%{?dist} License: GPL-2.0-or-later URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -15,6 +15,7 @@ Source5: alsaunmute.1 Source11: alsactl.conf Source20: alsa-restore.service Source22: alsa-state.service +Patch1: alsa-git.patch BuildRequires: gcc BuildRequires: autoconf automake libtool @@ -62,7 +63,7 @@ Architecture (ALSA) framework and Fast Fourier Transform library. %prep %setup -q -n %{name}-%{version} -#patch -P 1 -p1 -b .alsa-git +%patch -P1 -p1 -b .alsa-git %build autoreconf -vif @@ -205,7 +206,7 @@ fi %systemd_postun_with_restart alsa-state.service %changelog -* Tue Nov 12 2024 Jaroslav Kysela - 1.2.13-1 +* Thu Nov 14 2024 Jaroslav Kysela - 1.2.13-2 * Updated to 1.2.13 * Wed Jul 17 2024 Fedora Release Engineering - 1.2.12-2 From 6b0bfe65021dbfdc1b5d47bfe53165377f60e356 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 16 Jan 2025 10:55:10 +0000 Subject: [PATCH 47/58] Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild --- alsa-utils.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index 9256941..67416c8 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -5,7 +5,7 @@ Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 2%{?dist} +Release: 3%{?dist} License: GPL-2.0-or-later URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -206,6 +206,9 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Thu Jan 16 2025 Fedora Release Engineering - 1.2.13-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + * Thu Nov 14 2024 Jaroslav Kysela - 1.2.13-2 * Updated to 1.2.13 From 8af5b81ac1092118c5a9ba2b9cab6f3a446a2f5e Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 14 Apr 2025 14:58:51 +0200 Subject: [PATCH 48/58] update to 1.2.14 Signed-off-by: Jaroslav Kysela --- alsa-git.patch | 40 ---------------------------------------- alsa-utils.spec | 9 ++++++--- sources | 2 +- 3 files changed, 7 insertions(+), 44 deletions(-) delete mode 100644 alsa-git.patch diff --git a/alsa-git.patch b/alsa-git.patch deleted file mode 100644 index 7dcbf59..0000000 --- a/alsa-git.patch +++ /dev/null @@ -1,40 +0,0 @@ -From f90124c73edd050b24961197a4abcf17e53b41a8 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Thu, 14 Nov 2024 09:38:49 +0100 -Subject: [PATCH] alsactl: 90-alsa-restore.rules - fix alsa_restore_go/std - -Fix the label mismatch which was introduced in the transition from the -temporary test rules. - -Closes: https://github.com/alsa-project/alsa-utils/issues/280 -Fixes: 8116639 ("alsactl: 90-alsa-restore.rules - add support for AMD ACP digital microphone") -Signed-off-by: Jaroslav Kysela ---- - alsactl/90-alsa-restore.rules.in | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/alsactl/90-alsa-restore.rules.in b/alsactl/90-alsa-restore.rules.in -index 85f0b15..dae2ed8 100644 ---- a/alsactl/90-alsa-restore.rules.in -+++ b/alsactl/90-alsa-restore.rules.in -@@ -3,6 +3,8 @@ - ACTION=="add", SUBSYSTEM=="sound", KERNEL=="controlC*", KERNELS!="card*",@extratest@ GOTO="alsa_restore_go" - GOTO="alsa_restore_end" - -+LABEL="alsa_restore_go" -+ - ENV{ALSA_CARD_NUMBER}="$attr{device/number}" - - # mark HDA analog card; HDMI/DP card does not have capture devices -@@ -21,7 +23,7 @@ TEST!="/run/udev/alsa-hda-analog-card", GOTO="alsa_restore_std" - IMPORT{program}="/usr/bin/cat /run/udev/alsa-hda-analog-card" - ENV{ALSA_CARD_HDA_ANALOG}!="", ENV{ALSA_CARD_NUMBER}="$env{ALSA_CARD_HDA_ANALOG}" - --LABEL="alsa_restore_go" -+LABEL="alsa_restore_std" - TEST!="@daemonswitch@", RUN+="@sbindir@/alsactl@args@ restore $env{ALSA_CARD_NUMBER}" - TEST=="@daemonswitch@", RUN+="@sbindir@/alsactl@args@ nrestore $env{ALSA_CARD_NUMBER}" - --- -2.47.0 - diff --git a/alsa-utils.spec b/alsa-utils.spec index 67416c8..3091a0e 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -1,11 +1,11 @@ -%define baseversion 1.2.13 +%define baseversion 1.2.14 #define fixversion .2 %global _hardened_build 1 Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 3%{?dist} +Release: 1%{?dist} License: GPL-2.0-or-later URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -15,7 +15,7 @@ Source5: alsaunmute.1 Source11: alsactl.conf Source20: alsa-restore.service Source22: alsa-state.service -Patch1: alsa-git.patch +#Patch1: alsa-git.patch BuildRequires: gcc BuildRequires: autoconf automake libtool @@ -206,6 +206,9 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Mon Apr 14 2025 Jaroslav Kysela - 1.2.14-1 +* Updated to 1.2.14 + * Thu Jan 16 2025 Fedora Release Engineering - 1.2.13-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild diff --git a/sources b/sources index 96a6018..1182a6f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (alsa-utils-1.2.13.tar.bz2) = 0e2fb5b6e497b977badba2ebe2bddfc819654d24001622e0299e4034210caeeea2f3c2c2d1d260a48caefb6584e0b989fdb7036c6012108c8c38d89b3cb04c78 +SHA512 (alsa-utils-1.2.14.tar.bz2) = dd470a2f5210822cc4d3ded094b84721a07904df5c32dd329e0cb4c052d39e3e6d7ddb511cde2d23b3f6824c71fba9dbdca369355d5c03b234e989dbbb9b7a95 From b4926c6a5404b1146448f7379da90f85e944f8a0 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 14 Apr 2025 15:37:16 +0200 Subject: [PATCH 49/58] alsa-info.sh.1.gz -> alsa-info.sh.8.gz --- alsa-utils.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index 3091a0e..13adf5f 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -161,7 +161,7 @@ find %{buildroot} -name "*.la" -exec rm {} \; %{_mandir}/man1/iecset.1.gz %{_mandir}/man1/speaker-test.1.gz %{_mandir}/man1/aconnect.1.gz -%{_mandir}/man1/alsa-info.sh.1.gz +%{_mandir}/man1/alsa-info.sh.8.gz %{_mandir}/man1/nhlt-dmic-info.1.gz %dir /etc/alsa/ From c6dfe02d6fa7e9472fd96d9e21e77d904963e66e Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 14 Apr 2025 15:47:47 +0200 Subject: [PATCH 50/58] alsa-info.sh.1.gz -> alsa-info.sh.8.gz (man1 -> man8) --- alsa-utils.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index 13adf5f..4f7383e 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -161,7 +161,7 @@ find %{buildroot} -name "*.la" -exec rm {} \; %{_mandir}/man1/iecset.1.gz %{_mandir}/man1/speaker-test.1.gz %{_mandir}/man1/aconnect.1.gz -%{_mandir}/man1/alsa-info.sh.8.gz +%{_mandir}/man8/alsa-info.sh.8.gz %{_mandir}/man1/nhlt-dmic-info.1.gz %dir /etc/alsa/ From b81158d8ee5d1613eab7ba56ca76743471ec4e5e Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 23 Jul 2025 16:55:31 +0000 Subject: [PATCH 51/58] Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild --- alsa-utils.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index 4f7383e..6a3778f 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -5,7 +5,7 @@ Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 1%{?dist} +Release: 2%{?dist} License: GPL-2.0-or-later URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -206,6 +206,9 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Wed Jul 23 2025 Fedora Release Engineering - 1.2.14-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + * Mon Apr 14 2025 Jaroslav Kysela - 1.2.14-1 * Updated to 1.2.14 From 234977f2a869a4e7018ae9c8e2f9931d7980512e Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 8 Dec 2025 09:52:04 +0100 Subject: [PATCH 52/58] update to 1.2.15 Signed-off-by: Jaroslav Kysela --- alsa-utils.spec | 7 +++++-- sources | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index 6a3778f..63e9d2f 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -1,11 +1,11 @@ -%define baseversion 1.2.14 +%define baseversion 1.2.15 #define fixversion .2 %global _hardened_build 1 Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 2%{?dist} +Release: 1%{?dist} License: GPL-2.0-or-later URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -206,6 +206,9 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Mon Dec 8 2025 Jaroslav Kysela - 1.2.15-1 +* Updated to 1.2.15 + * Wed Jul 23 2025 Fedora Release Engineering - 1.2.14-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild diff --git a/sources b/sources index 1182a6f..00b108e 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (alsa-utils-1.2.14.tar.bz2) = dd470a2f5210822cc4d3ded094b84721a07904df5c32dd329e0cb4c052d39e3e6d7ddb511cde2d23b3f6824c71fba9dbdca369355d5c03b234e989dbbb9b7a95 +SHA512 (alsa-utils-1.2.15.tar.bz2) = 34b275d8a3c56e59a9f9e440ee6859d70d5d69a992a80593b6bcdd0eb8ac8ee93878f4e63381eb310af82f287ed1b6f7593d2a03ab7acb487c98511355d11d82 From d2872e5bc61890a05d38f27231bc0995fb38c08c Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 8 Dec 2025 12:42:18 +0100 Subject: [PATCH 53/58] cleanup files section Signed-off-by: Jaroslav Kysela --- alsa-utils.spec | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index 63e9d2f..6b5c058 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -5,7 +5,7 @@ Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 1%{?dist} +Release: 2%{?dist} License: GPL-2.0-or-later URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -117,9 +117,11 @@ find %{buildroot} -name "*.la" -exec rm {} \; #{_unitdir}/sound.target.wants/* %{alsacfgdir}/init/* %{_bindir}/aconnect +%{_sbindir}/alsactl %{_bindir}/alsaloop %{_bindir}/alsamixer %{_bindir}/alsaunmute +%{_sbindir}/alsa-info.sh %{_bindir}/amidi %{_bindir}/amixer %{_bindir}/aplay @@ -133,10 +135,8 @@ find %{buildroot} -name "*.la" -exec rm {} \; %{_bindir}/aseqsend %{_bindir}/axfer %{_bindir}/iecset -%{_bindir}/speaker-test %{_bindir}/nhlt-dmic-info -%{_sbindir}/* -%exclude %{_sbindir}/alsabat-test.sh +%{_bindir}/speaker-test %{_datadir}/alsa/ %{_datadir}/sounds/* %{_mandir}/man7/* @@ -206,7 +206,7 @@ fi %systemd_postun_with_restart alsa-state.service %changelog -* Mon Dec 8 2025 Jaroslav Kysela - 1.2.15-1 +* Mon Dec 8 2025 Jaroslav Kysela - 1.2.15-2 * Updated to 1.2.15 * Wed Jul 23 2025 Fedora Release Engineering - 1.2.14-2 From 712def8d0778b7bfe78e9eeab0c41ed2fcbdbef4 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 19 Dec 2025 12:06:59 +0100 Subject: [PATCH 54/58] update to 1.2.15.1 Signed-off-by: Jaroslav Kysela --- alsa-utils.spec | 16 ++++++++++++---- sources | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index 6b5c058..e5b3277 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -1,21 +1,24 @@ %define baseversion 1.2.15 -#define fixversion .2 +%define fixversion .1 %global _hardened_build 1 +%global utils_patch 0 + Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 2%{?dist} +Release: 1%{?dist} License: GPL-2.0-or-later URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 -#Patch1: alsa-utils-git.patch Source4: alsaunmute Source5: alsaunmute.1 Source11: alsactl.conf Source20: alsa-restore.service Source22: alsa-state.service -#Patch1: alsa-git.patch +%if %{utils_patch} +Patch1: alsa-git.patch +%endif BuildRequires: gcc BuildRequires: autoconf automake libtool @@ -63,7 +66,9 @@ Architecture (ALSA) framework and Fast Fourier Transform library. %prep %setup -q -n %{name}-%{version} +%if %{utils_patch} %patch -P1 -p1 -b .alsa-git +%endif %build autoreconf -vif @@ -206,6 +211,9 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Fri Dec 19 2025 Jaroslav Kysela - 1.2.15.1-1 +* Updated to 1.2.15.1 + * Mon Dec 8 2025 Jaroslav Kysela - 1.2.15-2 * Updated to 1.2.15 diff --git a/sources b/sources index 00b108e..dbe6504 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (alsa-utils-1.2.15.tar.bz2) = 34b275d8a3c56e59a9f9e440ee6859d70d5d69a992a80593b6bcdd0eb8ac8ee93878f4e63381eb310af82f287ed1b6f7593d2a03ab7acb487c98511355d11d82 +SHA512 (alsa-utils-1.2.15.1.tar.bz2) = f961c6f85244a6f10708f7e352e1eaa05fc898ec9e0d26e792efe4d2934568a455836035b311376dd03568f6c3607fad8702c5958c5874304d7afd6b8d5906e0 From 6832b4487fc690ee9e81d3fea0c8350e03f8dda0 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 1 Jan 2026 18:05:33 +0100 Subject: [PATCH 55/58] Apply fix to alsactl (card detection issue) Signed-off-by: Jaroslav Kysela --- alsa-git.patch | 35 +++++++++++++++++++++++++++++++++++ alsa-utils.spec | 7 +++++-- 2 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 alsa-git.patch diff --git a/alsa-git.patch b/alsa-git.patch new file mode 100644 index 0000000..1025925 --- /dev/null +++ b/alsa-git.patch @@ -0,0 +1,35 @@ +From 120568fbb5b2ea5d4359c8e37f6d47d712e14698 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 1 Jan 2026 17:51:25 +0100 +Subject: [PATCH] alsactl: add missing call to clean card specific config files + +The card specific configuration files created at runtime must +be removed before UCM fixed boot sequence in the standard +restore operation. + +Fixes: https://github.com/alsa-project/alsa-lib/issues/492 +Signed-off-by: Jaroslav Kysela +--- + alsactl/state.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/alsactl/state.c b/alsactl/state.c +index 2942f3f..7c6e6d1 100644 +--- a/alsactl/state.c ++++ b/alsactl/state.c +@@ -1790,6 +1790,12 @@ int load_state(const char *cfgdir, const char *file, + finalerr = lock_fd; + continue; + } ++ err = snd_card_clean_cfgdir(cfgdir, iter.card); ++ if (err < 0) { ++ initfailed(iter.card, "cfgdir", err); ++ finalerr = err; ++ continue; ++ } + /* error is ignored */ + err = init_ucm(initflags | FLAG_UCM_FBOOT, iter.card); + /* return code 1 and 2 -> postpone initialization */ +-- +2.52.0 + diff --git a/alsa-utils.spec b/alsa-utils.spec index e5b3277..f84a811 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -2,12 +2,12 @@ %define fixversion .1 %global _hardened_build 1 -%global utils_patch 0 +%global utils_patch 1 Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 1%{?dist} +Release: 2%{?dist} License: GPL-2.0-or-later URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -211,6 +211,9 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Thu Jan 1 2026 Jaroslav Kysela - 1.2.15.1-2 +* Apply fix to alsactl (card detection issue) + * Fri Dec 19 2025 Jaroslav Kysela - 1.2.15.1-1 * Updated to 1.2.15.1 From af596e344c9d37e24bf218753b87a6191c967a23 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 1 Jan 2026 18:44:59 +0100 Subject: [PATCH 56/58] Apply fix to alsactl (card detection issue) #2 Signed-off-by: Jaroslav Kysela --- alsa-git.patch | 158 +++++++++++++++++++++++++++++++++++++++++++++++- alsa-utils.spec | 4 +- 2 files changed, 159 insertions(+), 3 deletions(-) diff --git a/alsa-git.patch b/alsa-git.patch index 1025925..7e361f1 100644 --- a/alsa-git.patch +++ b/alsa-git.patch @@ -1,7 +1,8 @@ From 120568fbb5b2ea5d4359c8e37f6d47d712e14698 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 1 Jan 2026 17:51:25 +0100 -Subject: [PATCH] alsactl: add missing call to clean card specific config files +Subject: [PATCH 1/2] alsactl: add missing call to clean card specific config + files The card specific configuration files created at runtime must be removed before UCM fixed boot sequence in the standard @@ -33,3 +34,158 @@ index 2942f3f..7c6e6d1 100644 -- 2.52.0 + +From 254528c42706524ff82378cf740d07b472cba2cc Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 1 Jan 2026 18:39:38 +0100 +Subject: [PATCH 2/2] alsactl: fix sequence to clean card specific config files + for UCM + +For UCM, card-specific config files should be removed only when the fixed +boot flag is set or if the card is not the primary card in a given card +group. + +Signed-off-by: Jaroslav Kysela +--- + alsactl/alsactl.h | 2 +- + alsactl/init_parse.c | 2 +- + alsactl/init_ucm.c | 25 ++++++++++++++++++++----- + alsactl/state.c | 16 +++++++++------- + 4 files changed, 31 insertions(+), 14 deletions(-) + +diff --git a/alsactl/alsactl.h b/alsactl/alsactl.h +index 2aefb89..9f17284 100644 +--- a/alsactl/alsactl.h ++++ b/alsactl/alsactl.h +@@ -68,7 +68,7 @@ int snd_card_iterator_error(struct snd_card_iterator *iter); + + int load_configuration(const char *file, snd_config_t **top, int *open_failed); + int init(const char *cfgdir, const char *file, int flags, const char *cardname); +-int init_ucm(int flags, int cardno); ++int init_ucm(const char *cfgdir, int flags, int cardno); + bool validate_boot_time(long long boot_time, long long current_time, long long synctime); + int read_boot_params(snd_ctl_t *handle, long long *boot_time, long long *sync_time, long long *restore_time, long long *primary_card); + int write_boot_params(snd_ctl_t *handle, long long boot_time, long long sync_time, long long restore_time, long long primary_card); +diff --git a/alsactl/init_parse.c b/alsactl/init_parse.c +index a34cb0e..a437392 100644 +--- a/alsactl/init_parse.c ++++ b/alsactl/init_parse.c +@@ -1761,7 +1761,7 @@ int init(const char *cfgdir, const char *filename, int flags, const char *cardna + lasterr = err; + continue; + } +- err = init_ucm(flags, iter.card); ++ err = init_ucm(cfgdir, flags, iter.card); + if (err == 0 || card_state_is_okay(err)) + continue; + err = init_space(&space, iter.card); +diff --git a/alsactl/init_ucm.c b/alsactl/init_ucm.c +index 60967c4..c168427 100644 +--- a/alsactl/init_ucm.c ++++ b/alsactl/init_ucm.c +@@ -137,11 +137,17 @@ static int reopen_ucm_manager(snd_use_case_mgr_t **uc_mgr, int cardno, int flags + * Helper: Execute boot sequences + * Returns: 0 on success, negative on error + */ +-static int execute_boot_sequences(snd_use_case_mgr_t *uc_mgr, int flags, bool fixed_boot) ++static int execute_boot_sequences(const char *cfgdir, snd_use_case_mgr_t *uc_mgr, ++ int cardno, int flags, bool fixed_boot) + { + int err = 0; + + if (fixed_boot) { ++ err = snd_card_clean_cfgdir(cfgdir, cardno); ++ if (err < 0) { ++ dbg("ucm clean cfgdir: %d", err); ++ return err; ++ } + err = snd_use_case_set(uc_mgr, "_fboot", NULL); + dbg("ucm _fboot: %d", err); + if (err == -ENOENT && (flags & FLAG_UCM_BOOT) != 0) { +@@ -170,7 +176,7 @@ static int execute_boot_sequences(snd_use_case_mgr_t *uc_mgr, int flags, bool fi + * Handle also card groups. + * Returns: 0 = success, 1 = skip this card (e.g. linked or in-sync), negative on error + */ +-int init_ucm(int flags, int cardno) ++int init_ucm(const char *cfgdir, int flags, int cardno) + { + snd_use_case_mgr_t *uc_mgr; + char id[64]; +@@ -268,7 +274,7 @@ int init_ucm(int flags, int cardno) + } + + _execute_boot: +- if (flags & FLAG_UCM_FBOOT) ++ if (fixed_boot) + restored = true; + + if (boot_card_group) { +@@ -277,7 +283,7 @@ _execute_boot: + goto _error; + } + +- err = execute_boot_sequences(uc_mgr, flags, fixed_boot); ++ err = execute_boot_sequences(cfgdir, uc_mgr, cardno, flags, fixed_boot); + if (err < 0) + goto _error; + +@@ -286,6 +292,15 @@ _execute_boot: + _error: + snd_use_case_mgr_close(uc_mgr); + _fin: ++ if (fixed_boot && primary_card >= 0 && primary_card != cardno) { ++ /* remove card specific configuration files for other cards in group */ ++ int clean_err = snd_card_clean_cfgdir(cfgdir, cardno); ++ if (clean_err < 0) { ++ dbg("ucm clean cfgdir: %d", clean_err); ++ if (err >= 0) ++ err = clean_err; ++ } ++ } + if (lock_fd >= 0) + group_state_unlock(lock_fd, groupfile); + if (ctl) +@@ -298,7 +313,7 @@ _fin: + + #else + +-int init_ucm(int flags, int cardno) ++int init_ucm(const char *cfgdir, int flags, int cardno) + { + return -ENXIO; + } +diff --git a/alsactl/state.c b/alsactl/state.c +index 7c6e6d1..79bd309 100644 +--- a/alsactl/state.c ++++ b/alsactl/state.c +@@ -1790,18 +1790,20 @@ int load_state(const char *cfgdir, const char *file, + finalerr = lock_fd; + continue; + } +- err = snd_card_clean_cfgdir(cfgdir, iter.card); +- if (err < 0) { +- initfailed(iter.card, "cfgdir", err); +- finalerr = err; +- continue; +- } + /* error is ignored */ +- err = init_ucm(initflags | FLAG_UCM_FBOOT, iter.card); ++ err = init_ucm(cfgdir, initflags | FLAG_UCM_FBOOT, iter.card); + /* return code 1 and 2 -> postpone initialization */ + if (card_state_is_okay(err)) { + export_card_state_set(iter.card, err); + goto unlock_card; ++ } else if (err < 0) { ++ /* no UCM - remove card specific configuration */ ++ err = snd_card_clean_cfgdir(cfgdir, iter.card); ++ if (err < 0) { ++ initfailed(iter.card, "cfgdir", err); ++ finalerr = err; ++ continue; ++ } + } + /* do a check if controls matches state file */ + if (do_init && set_controls(iter.card, config, 0)) { +-- +2.52.0 + diff --git a/alsa-utils.spec b/alsa-utils.spec index f84a811..c873252 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -7,7 +7,7 @@ Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 2%{?dist} +Release: 3%{?dist} License: GPL-2.0-or-later URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -211,7 +211,7 @@ fi %systemd_postun_with_restart alsa-state.service %changelog -* Thu Jan 1 2026 Jaroslav Kysela - 1.2.15.1-2 +* Thu Jan 1 2026 Jaroslav Kysela - 1.2.15.1-3 * Apply fix to alsactl (card detection issue) * Fri Dec 19 2025 Jaroslav Kysela - 1.2.15.1-1 From e5f06f10f794a8616ed192e477be714f3e0e3e6d Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 8 Jan 2026 15:51:18 +0100 Subject: [PATCH 57/58] update to 1.2.15.2 Signed-off-by: Jaroslav Kysela --- alsa-git.patch | 191 ------------------------------------------------ alsa-utils.spec | 9 ++- sources | 2 +- 3 files changed, 7 insertions(+), 195 deletions(-) delete mode 100644 alsa-git.patch diff --git a/alsa-git.patch b/alsa-git.patch deleted file mode 100644 index 7e361f1..0000000 --- a/alsa-git.patch +++ /dev/null @@ -1,191 +0,0 @@ -From 120568fbb5b2ea5d4359c8e37f6d47d712e14698 Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Thu, 1 Jan 2026 17:51:25 +0100 -Subject: [PATCH 1/2] alsactl: add missing call to clean card specific config - files - -The card specific configuration files created at runtime must -be removed before UCM fixed boot sequence in the standard -restore operation. - -Fixes: https://github.com/alsa-project/alsa-lib/issues/492 -Signed-off-by: Jaroslav Kysela ---- - alsactl/state.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/alsactl/state.c b/alsactl/state.c -index 2942f3f..7c6e6d1 100644 ---- a/alsactl/state.c -+++ b/alsactl/state.c -@@ -1790,6 +1790,12 @@ int load_state(const char *cfgdir, const char *file, - finalerr = lock_fd; - continue; - } -+ err = snd_card_clean_cfgdir(cfgdir, iter.card); -+ if (err < 0) { -+ initfailed(iter.card, "cfgdir", err); -+ finalerr = err; -+ continue; -+ } - /* error is ignored */ - err = init_ucm(initflags | FLAG_UCM_FBOOT, iter.card); - /* return code 1 and 2 -> postpone initialization */ --- -2.52.0 - - -From 254528c42706524ff82378cf740d07b472cba2cc Mon Sep 17 00:00:00 2001 -From: Jaroslav Kysela -Date: Thu, 1 Jan 2026 18:39:38 +0100 -Subject: [PATCH 2/2] alsactl: fix sequence to clean card specific config files - for UCM - -For UCM, card-specific config files should be removed only when the fixed -boot flag is set or if the card is not the primary card in a given card -group. - -Signed-off-by: Jaroslav Kysela ---- - alsactl/alsactl.h | 2 +- - alsactl/init_parse.c | 2 +- - alsactl/init_ucm.c | 25 ++++++++++++++++++++----- - alsactl/state.c | 16 +++++++++------- - 4 files changed, 31 insertions(+), 14 deletions(-) - -diff --git a/alsactl/alsactl.h b/alsactl/alsactl.h -index 2aefb89..9f17284 100644 ---- a/alsactl/alsactl.h -+++ b/alsactl/alsactl.h -@@ -68,7 +68,7 @@ int snd_card_iterator_error(struct snd_card_iterator *iter); - - int load_configuration(const char *file, snd_config_t **top, int *open_failed); - int init(const char *cfgdir, const char *file, int flags, const char *cardname); --int init_ucm(int flags, int cardno); -+int init_ucm(const char *cfgdir, int flags, int cardno); - bool validate_boot_time(long long boot_time, long long current_time, long long synctime); - int read_boot_params(snd_ctl_t *handle, long long *boot_time, long long *sync_time, long long *restore_time, long long *primary_card); - int write_boot_params(snd_ctl_t *handle, long long boot_time, long long sync_time, long long restore_time, long long primary_card); -diff --git a/alsactl/init_parse.c b/alsactl/init_parse.c -index a34cb0e..a437392 100644 ---- a/alsactl/init_parse.c -+++ b/alsactl/init_parse.c -@@ -1761,7 +1761,7 @@ int init(const char *cfgdir, const char *filename, int flags, const char *cardna - lasterr = err; - continue; - } -- err = init_ucm(flags, iter.card); -+ err = init_ucm(cfgdir, flags, iter.card); - if (err == 0 || card_state_is_okay(err)) - continue; - err = init_space(&space, iter.card); -diff --git a/alsactl/init_ucm.c b/alsactl/init_ucm.c -index 60967c4..c168427 100644 ---- a/alsactl/init_ucm.c -+++ b/alsactl/init_ucm.c -@@ -137,11 +137,17 @@ static int reopen_ucm_manager(snd_use_case_mgr_t **uc_mgr, int cardno, int flags - * Helper: Execute boot sequences - * Returns: 0 on success, negative on error - */ --static int execute_boot_sequences(snd_use_case_mgr_t *uc_mgr, int flags, bool fixed_boot) -+static int execute_boot_sequences(const char *cfgdir, snd_use_case_mgr_t *uc_mgr, -+ int cardno, int flags, bool fixed_boot) - { - int err = 0; - - if (fixed_boot) { -+ err = snd_card_clean_cfgdir(cfgdir, cardno); -+ if (err < 0) { -+ dbg("ucm clean cfgdir: %d", err); -+ return err; -+ } - err = snd_use_case_set(uc_mgr, "_fboot", NULL); - dbg("ucm _fboot: %d", err); - if (err == -ENOENT && (flags & FLAG_UCM_BOOT) != 0) { -@@ -170,7 +176,7 @@ static int execute_boot_sequences(snd_use_case_mgr_t *uc_mgr, int flags, bool fi - * Handle also card groups. - * Returns: 0 = success, 1 = skip this card (e.g. linked or in-sync), negative on error - */ --int init_ucm(int flags, int cardno) -+int init_ucm(const char *cfgdir, int flags, int cardno) - { - snd_use_case_mgr_t *uc_mgr; - char id[64]; -@@ -268,7 +274,7 @@ int init_ucm(int flags, int cardno) - } - - _execute_boot: -- if (flags & FLAG_UCM_FBOOT) -+ if (fixed_boot) - restored = true; - - if (boot_card_group) { -@@ -277,7 +283,7 @@ _execute_boot: - goto _error; - } - -- err = execute_boot_sequences(uc_mgr, flags, fixed_boot); -+ err = execute_boot_sequences(cfgdir, uc_mgr, cardno, flags, fixed_boot); - if (err < 0) - goto _error; - -@@ -286,6 +292,15 @@ _execute_boot: - _error: - snd_use_case_mgr_close(uc_mgr); - _fin: -+ if (fixed_boot && primary_card >= 0 && primary_card != cardno) { -+ /* remove card specific configuration files for other cards in group */ -+ int clean_err = snd_card_clean_cfgdir(cfgdir, cardno); -+ if (clean_err < 0) { -+ dbg("ucm clean cfgdir: %d", clean_err); -+ if (err >= 0) -+ err = clean_err; -+ } -+ } - if (lock_fd >= 0) - group_state_unlock(lock_fd, groupfile); - if (ctl) -@@ -298,7 +313,7 @@ _fin: - - #else - --int init_ucm(int flags, int cardno) -+int init_ucm(const char *cfgdir, int flags, int cardno) - { - return -ENXIO; - } -diff --git a/alsactl/state.c b/alsactl/state.c -index 7c6e6d1..79bd309 100644 ---- a/alsactl/state.c -+++ b/alsactl/state.c -@@ -1790,18 +1790,20 @@ int load_state(const char *cfgdir, const char *file, - finalerr = lock_fd; - continue; - } -- err = snd_card_clean_cfgdir(cfgdir, iter.card); -- if (err < 0) { -- initfailed(iter.card, "cfgdir", err); -- finalerr = err; -- continue; -- } - /* error is ignored */ -- err = init_ucm(initflags | FLAG_UCM_FBOOT, iter.card); -+ err = init_ucm(cfgdir, initflags | FLAG_UCM_FBOOT, iter.card); - /* return code 1 and 2 -> postpone initialization */ - if (card_state_is_okay(err)) { - export_card_state_set(iter.card, err); - goto unlock_card; -+ } else if (err < 0) { -+ /* no UCM - remove card specific configuration */ -+ err = snd_card_clean_cfgdir(cfgdir, iter.card); -+ if (err < 0) { -+ initfailed(iter.card, "cfgdir", err); -+ finalerr = err; -+ continue; -+ } - } - /* do a check if controls matches state file */ - if (do_init && set_controls(iter.card, config, 0)) { --- -2.52.0 - diff --git a/alsa-utils.spec b/alsa-utils.spec index c873252..6a4f794 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -1,13 +1,13 @@ %define baseversion 1.2.15 -%define fixversion .1 +%define fixversion .2 %global _hardened_build 1 -%global utils_patch 1 +%global utils_patch 0 Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 3%{?dist} +Release: 1%{?dist} License: GPL-2.0-or-later URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -211,6 +211,9 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Thu Jan 8 2026 Jaroslav Kysela - 1.2.15.2-1 +* Updated to 1.2.15.2 + * Thu Jan 1 2026 Jaroslav Kysela - 1.2.15.1-3 * Apply fix to alsactl (card detection issue) diff --git a/sources b/sources index dbe6504..ad5e1c4 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (alsa-utils-1.2.15.1.tar.bz2) = f961c6f85244a6f10708f7e352e1eaa05fc898ec9e0d26e792efe4d2934568a455836035b311376dd03568f6c3607fad8702c5958c5874304d7afd6b8d5906e0 +SHA512 (alsa-utils-1.2.15.2.tar.bz2) = 13ca15a63bcbf81a4643ef03e391200d7523335bc300e290756089c4cfeccb9773cf6b77f9fcf4b80e6aa2e8c5e33a2c86c9173f1feb480aedf5ecda0f7c47cd From 8b5135ae232114d9c4904d92daa239a84c626161 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 16 Jan 2026 03:37:01 +0000 Subject: [PATCH 58/58] Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild --- alsa-utils.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/alsa-utils.spec b/alsa-utils.spec index 6a4f794..9699a63 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -7,7 +7,7 @@ Summary: Advanced Linux Sound Architecture (ALSA) utilities Name: alsa-utils Version: %{baseversion}%{?fixversion} -Release: 1%{?dist} +Release: 2%{?dist} License: GPL-2.0-or-later URL: http://www.alsa-project.org/ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 @@ -211,6 +211,9 @@ fi %systemd_postun_with_restart alsa-state.service %changelog +* Fri Jan 16 2026 Fedora Release Engineering - 1.2.15.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild + * Thu Jan 8 2026 Jaroslav Kysela - 1.2.15.2-1 * Updated to 1.2.15.2