From f893b96bd52051148b9a415eabd5aebce84934ea Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 24 Oct 2022 10:57:02 +0200 Subject: [PATCH 01/30] 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 02/30] 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 03/30] 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 04/30] 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 05/30] 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 06/30] 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 07/30] 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 08/30] 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 09/30] 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 10/30] 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 11/30] 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 12/30] 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 13/30] 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 14/30] 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 15/30] 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 16/30] 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 17/30] 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 18/30] 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 19/30] 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 20/30] 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 21/30] 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 22/30] 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 23/30] 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 24/30] 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 25/30] 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 26/30] 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 27/30] 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 28/30] 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 29/30] 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 30/30] 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