Compare commits

..

30 commits

Author SHA1 Message Date
Fedora Release Engineering
8b5135ae23 Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild 2026-01-16 03:37:01 +00:00
Jaroslav Kysela
e5f06f10f7 update to 1.2.15.2
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2026-01-08 15:53:03 +01:00
Jaroslav Kysela
af596e344c Apply fix to alsactl (card detection issue) #2
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2026-01-01 18:44:59 +01:00
Jaroslav Kysela
6832b4487f Apply fix to alsactl (card detection issue)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2026-01-01 18:05:40 +01:00
Jaroslav Kysela
712def8d07 update to 1.2.15.1
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-12-19 12:12:52 +01:00
Jaroslav Kysela
d2872e5bc6 cleanup files section
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-12-08 12:42:18 +01:00
Jaroslav Kysela
234977f2a8 update to 1.2.15
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-12-08 09:52:04 +01:00
Fedora Release Engineering
b81158d8ee Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild 2025-07-23 16:55:31 +00:00
Jaroslav Kysela
c6dfe02d6f alsa-info.sh.1.gz -> alsa-info.sh.8.gz (man1 -> man8) 2025-04-14 15:47:47 +02:00
Jaroslav Kysela
b4926c6a54 alsa-info.sh.1.gz -> alsa-info.sh.8.gz 2025-04-14 15:37:16 +02:00
Jaroslav Kysela
8af5b81ac1 update to 1.2.14
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-04-14 15:01:46 +02:00
Fedora Release Engineering
6b0bfe6502 Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild 2025-01-16 10:55:10 +00:00
Jaroslav Kysela
65c6a14b10 fix 90-alsa-restore.rules.in
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-11-14 09:49:39 +01:00
Jaroslav Kysela
76b6ba63bc update to 1.2.13
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-11-12 13:49:19 +01:00
Fedora Release Engineering
df95d97fce Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild 2024-07-17 16:53:31 +00:00
Jaroslav Kysela
af2b8fab73 add missing aseqsend utility to file list
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-06-11 10:54:05 +02:00
Jaroslav Kysela
57be7e615a updated to 1.2.12
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-06-10 14:24:48 +02:00
Jaroslav Kysela
855d495e27 fix baseversion to 1.2.11
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-01-29 14:39:33 +01:00
Jaroslav Kysela
3c01a4c1f0 update to 1.2.11
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2024-01-29 14:37:35 +01:00
Fedora Release Engineering
7e840cf34e Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-22 22:56:59 +00:00
Fedora Release Engineering
1556eeb427 Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-19 12:45:47 +00:00
Jaroslav Kysela
ad627191eb update to 1.2.10
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-09-01 18:41:24 +02:00
Fedora Release Engineering
8a5252591e Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-07-19 13:10:24 +00:00
Jaroslav Kysela
f966ddd17b update SPDX license
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-06-06 20:11:37 +02:00
Jaroslav Kysela
b88d4e972a fix build (autoreconf) #2
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-05-16 18:17:31 +02:00
Jaroslav Kysela
491d99741b fix build (autoreconf)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-05-16 18:05:46 +02:00
Jaroslav Kysela
f0e629bce8 add nhlt-dmic-info
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-05-16 17:55:37 +02:00
Jaroslav Kysela
91d2bb1e33 update to 1.2.9
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2023-05-04 10:21:58 +02:00
Fedora Release Engineering
04ecda8dbc Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-01-18 21:38:24 +00:00
Jaroslav Kysela
f893b96bd5 update to 1.2.8
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2022-10-24 10:57:02 +02:00
4 changed files with 84 additions and 578 deletions

View file

@ -1,554 +0,0 @@
From ee3965f6fac6c8b003acb097191125070708cccb Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
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 <perex@perex.cz>
---
.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 <file>\fP | \fI\-\-file=<file>\fP
+
+Input file with the binary ACPI NHLT table (default is \fB/sys/firmware/acpi/tables/NHLT\fR).
+
+.TP
+\fI\-o <file>\fP | \fI\-\-output=<file>\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 <perex@perex.cz>.
+This document is by Jaroslav Kysela <perex@perex.cz>.
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 <perex@perex.cz>
+ *
+ *
+ * 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 <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <getopt.h>
+#include <sys/stat.h>
+#include <arpa/inet.h>
+
+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 <options>" },
+{ 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

View file

@ -1,23 +1,27 @@
%define baseversion 1.2.9
#define fixversion .2
%define baseversion 1.2.15
%define fixversion .2
%global _hardened_build 1
%global utils_patch 0
Summary: Advanced Linux Sound Architecture (ALSA) utilities
Name: alsa-utils
Version: %{baseversion}%{?fixversion}
Release: 2%{?dist}
License: GPLv2+
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
%if %{utils_patch}
Patch1: alsa-git.patch
%endif
BuildRequires: gcc
BuildRequires: gcc
BuildRequires: autoconf automake libtool
BuildRequires: alsa-lib-devel >= %{baseversion}
BuildRequires: libsamplerate-devel
BuildRequires: ncurses-devel
@ -62,12 +66,17 @@ Architecture (ALSA) framework and Fast Fourier Transform library.
%prep
%setup -q -n %{name}-%{version}
%patch1 -p1 -b .alsa-git
%if %{utils_patch}
%patch -P1 -p1 -b .alsa-git
%endif
%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}
--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} .
@ -77,9 +86,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
@ -111,26 +119,29 @@ 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
%{_sbindir}/alsactl
%{_bindir}/alsaloop
%{_bindir}/alsamixer
%{_bindir}/alsaunmute
%{_sbindir}/alsa-info.sh
%{_bindir}/amidi
%{_bindir}/amixer
%{_bindir}/aplay
%{_bindir}/aplaymidi
%{_bindir}/aplaymidi2
%{_bindir}/arecord
%{_bindir}/arecordmidi
%{_bindir}/arecordmidi2
%{_bindir}/aseqdump
%{_bindir}/aseqnet
%{_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/*
@ -142,17 +153,20 @@ 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
%{_mandir}/man1/axfer.1.gz
%{_mandir}/man1/axfer-list.1.gz
%{_mandir}/man1/axfer-transfer.1.gz
%{_mandir}/man1/iecset.1.gz
%{_mandir}/man1/speaker-test.1.gz
%{_mandir}/man1/aconnect.1.gz
%{_mandir}/man1/alsa-info.sh.1.gz
%{_mandir}/man8/alsa-info.sh.8.gz
%{_mandir}/man1/nhlt-dmic-info.1.gz
%dir /etc/alsa/
@ -197,12 +211,66 @@ fi
%systemd_postun_with_restart alsa-state.service
%changelog
* Fri Jan 16 2026 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.15.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild
* Thu Jan 8 2026 Jaroslav Kysela <perex@perex.cz> - 1.2.15.2-1
* Updated to 1.2.15.2
* Thu Jan 1 2026 Jaroslav Kysela <perex@perex.cz> - 1.2.15.1-3
* Apply fix to alsactl (card detection issue)
* Fri Dec 19 2025 Jaroslav Kysela <perex@perex.cz> - 1.2.15.1-1
* Updated to 1.2.15.1
* Mon Dec 8 2025 Jaroslav Kysela <perex@perex.cz> - 1.2.15-2
* Updated to 1.2.15
* Wed Jul 23 2025 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.14-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
* Mon Apr 14 2025 Jaroslav Kysela <perex@perex.cz> - 1.2.14-1
* Updated to 1.2.14
* Thu Jan 16 2025 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.13-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
* Thu Nov 14 2024 Jaroslav Kysela <perex@perex.cz> - 1.2.13-2
* Updated to 1.2.13
* Wed Jul 17 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.12-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
* Tue Jun 11 2024 Jaroslav Kysela <perex@perex.cz> - 1.2.12-1
* Updated to 1.2.12
* Mon Jan 29 2024 Jaroslav Kysela <perex@perex.cz> - 1.2.11-1
* Updated to 1.2.11
* Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.10-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Fri Jan 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.10-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Fri Sep 1 2023 Jaroslav Kysela <perex@perex.cz> - 1.2.10-1
* Updated to 1.2.10
* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.9-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Tue Jun 6 2023 Jaroslav Kysela <perex@perex.cz> - 1.2.9-3
* SPDX license
* Tue May 16 2023 Jaroslav Kysela <perex@perex.cz> - 1.2.9-2
* Add nhlt-dmic-info utility
* Thu May 4 2023 Jaroslav Kysela <perex@perex.cz> - 1.2.9-1
* Updated to 1.2.9
* Wed Jan 18 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.8-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Mon Oct 24 2022 Jaroslav Kysela <perex@perex.cz> - 1.2.8-1
* Updated to 1.2.8

View file

@ -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"

View file

@ -1 +1 @@
SHA512 (alsa-utils-1.2.9.tar.bz2) = f46e13fd57ed05ee38d3fa655e57b14335ecf0664dbe03275808383d87d28df153a81151e2e9d8786625f09929c567c89e145508a706a70eeb91ac1b11fb2fd4
SHA512 (alsa-utils-1.2.15.2.tar.bz2) = 13ca15a63bcbf81a4643ef03e391200d7523335bc300e290756089c4cfeccb9773cf6b77f9fcf4b80e6aa2e8c5e33a2c86c9173f1feb480aedf5ecda0f7c47cd