diff -Nru alsa-utils-1.2.2/debian/changelog alsa-utils-1.2.2/debian/changelog --- alsa-utils-1.2.2/debian/changelog 2020-03-05 00:46:27.000000000 +0800 +++ alsa-utils-1.2.2/debian/changelog 2020-10-14 16:08:05.000000000 +0800 @@ -1,3 +1,19 @@ +alsa-utils (1.2.2-1ubuntu2) focal; urgency=medium + + * d/p/0001-alsactl-init-iterate-through-all-cards-for-the-initi.patch + * d/p/0002-alsactl-add-initial-support-for-UCM-init.patch + * d/p/0003-alsactl-redirect-alsa-lib-errors.patch + * d/p/0004-alsactl-add-D-argument-to-execute-also-the-UCM-defau.patch + * d/p/0005-alsactl-use-the-right-priority-for-syslog-messages.patch + * d/p/0006-alsactl-allow-to-compile-alsactl-without-UCM-support.patch + * d/p/0007-alsactl-ucm-rename-_once-command-to-_boot-command.patch + * d/p/0008-alsaucm-remove-custom-rules-alsactl-is-UCM-aware-now.patch + Make alsactl support _boot section defined in the ucm, then the + mixer values defined in the _boot section for Dell soundwire audio + machines could be executed at the first booting. (LP: #1899745) + + -- Hui Wang Wed, 14 Oct 2020 16:02:47 +0800 + alsa-utils (1.2.2-1ubuntu1) focal; urgency=medium * Resynchronize on Debian diff -Nru alsa-utils-1.2.2/debian/patches/0001-alsactl-init-iterate-through-all-cards-for-the-initi.patch alsa-utils-1.2.2/debian/patches/0001-alsactl-init-iterate-through-all-cards-for-the-initi.patch --- alsa-utils-1.2.2/debian/patches/0001-alsactl-init-iterate-through-all-cards-for-the-initi.patch 1970-01-01 08:00:00.000000000 +0800 +++ alsa-utils-1.2.2/debian/patches/0001-alsactl-init-iterate-through-all-cards-for-the-initi.patch 2020-10-14 16:02:08.000000000 +0800 @@ -0,0 +1,50 @@ +From 0f8eb1677ff2975ac622db35c3667901d4f351fa Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 14 May 2020 18:14:31 +0200 +Subject: [PATCH 1/8] alsactl: init - iterate through all cards for the initial + settings + +The generic initialization code returns error code 99 (-99). Take +all those codes equal or above (bellow) this value as non-fatal. + +Signed-off-by: Jaroslav Kysela +(cherry picked from commit 598488c4af555c31c234ea2e88e52cb39a2c045a) +Signed-off-by: Hui Wang +--- + alsactl/init_parse.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/alsactl/init_parse.c b/alsactl/init_parse.c +index c048fd3..12bffa5 100644 +--- a/alsactl/init_parse.c ++++ b/alsactl/init_parse.c +@@ -1745,7 +1745,7 @@ static int parse(struct space *space, const char *filename) + int init(const char *filename, const char *cardname) + { + struct space *space; +- int err = 0, card, first; ++ int err = 0, lasterr = 0, card, first; + + sysfs_init(); + if (!cardname) { +@@ -1767,11 +1767,17 @@ int init(const char *filename, const char *cardname) + space->rootdir = new_root_dir(filename); + if (space->rootdir != NULL) + err = parse(space, filename); ++ if (err <= -99) { /* non-fatal errors */ ++ if (lasterr == 0) ++ lasterr = err; ++ err = 0; ++ } + free_space(space); + } + if (err < 0) + break; + } ++ err = lasterr; + } else { + card = snd_card_get_index(cardname); + if (card < 0) { +-- +2.25.1 + diff -Nru alsa-utils-1.2.2/debian/patches/0002-alsactl-add-initial-support-for-UCM-init.patch alsa-utils-1.2.2/debian/patches/0002-alsactl-add-initial-support-for-UCM-init.patch --- alsa-utils-1.2.2/debian/patches/0002-alsactl-add-initial-support-for-UCM-init.patch 1970-01-01 08:00:00.000000000 +0800 +++ alsa-utils-1.2.2/debian/patches/0002-alsactl-add-initial-support-for-UCM-init.patch 2020-10-14 16:02:08.000000000 +0800 @@ -0,0 +1,116 @@ +From 13ea068eb744f17288900fce180a9ccd4e910c6b Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 14 May 2020 17:12:08 +0200 +Subject: [PATCH 2/8] alsactl: add initial support for UCM init + +Signed-off-by: Jaroslav Kysela +(cherry picked from commit 4bea8fe3a73cd2df8dcad1c8a14c35bab7b21073) +Signed-off-by: Hui Wang +--- + alsactl/Makefile.am | 4 ++-- + alsactl/alsactl.h | 1 + + alsactl/init_parse.c | 6 ++++++ + alsactl/init_ucm.c | 40 ++++++++++++++++++++++++++++++++++++++++ + 4 files changed, 49 insertions(+), 2 deletions(-) + create mode 100644 alsactl/init_ucm.c + +diff --git a/alsactl/Makefile.am b/alsactl/Makefile.am +index e9ab2eb..c1031ac 100644 +--- a/alsactl/Makefile.am ++++ b/alsactl/Makefile.am +@@ -9,8 +9,8 @@ EXTRA_DIST=alsactl.1 alsactl_init.xml + + AM_CFLAGS = -D_GNU_SOURCE + +-alsactl_SOURCES=alsactl.c state.c lock.c utils.c init_parse.c daemon.c \ +- monitor.c ++alsactl_SOURCES=alsactl.c state.c lock.c utils.c init_parse.c init_ucm.c \ ++ daemon.c monitor.c + + alsactl_CFLAGS=$(AM_CFLAGS) -D__USE_GNU \ + -DSYS_ASOUNDRC=\"$(ASOUND_STATE_DIR)/asound.state\" \ +diff --git a/alsactl/alsactl.h b/alsactl/alsactl.h +index 69b539c..6e96e78 100644 +--- a/alsactl/alsactl.h ++++ b/alsactl/alsactl.h +@@ -25,6 +25,7 @@ void dbg_(const char *fcn, long line, const char *fmt, ...); + #endif + + int init(const char *file, const char *cardname); ++int init_ucm(int cardno); + int state_lock(const char *file, int timeout); + int state_unlock(int fd, const char *file); + int save_state(const char *file, const char *cardname); +diff --git a/alsactl/init_parse.c b/alsactl/init_parse.c +index 12bffa5..f176a7a 100644 +--- a/alsactl/init_parse.c ++++ b/alsactl/init_parse.c +@@ -1762,6 +1762,9 @@ int init(const char *filename, const char *cardname) + break; + } + first = 0; ++ err = init_ucm(card); ++ if (err == 0) ++ continue; + err = init_space(&space, card); + if (err == 0) { + space->rootdir = new_root_dir(filename); +@@ -1784,6 +1787,9 @@ int init(const char *filename, const char *cardname) + error("Cannot find soundcard '%s'...", cardname); + goto error; + } ++ err = init_ucm(card); ++ if (err == 0) ++ return 0; + memset(&space, 0, sizeof(space)); + err = init_space(&space, card); + if (err == 0) { +diff --git a/alsactl/init_ucm.c b/alsactl/init_ucm.c +new file mode 100644 +index 0000000..833a1f9 +--- /dev/null ++++ b/alsactl/init_ucm.c +@@ -0,0 +1,40 @@ ++/* ++ * Advanced Linux Sound Architecture Control Program - UCM Initialization ++ * Copyright (c) by 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 ++ ++/* ++ * Keep it as simple as possible. Execute commands from the SectionOnce only. ++ */ ++int init_ucm(int cardno) ++{ ++ snd_use_case_mgr_t *uc_mgr; ++ char id[32]; ++ int err; ++ ++ snprintf(id, sizeof(id), "hw:%d", cardno); ++ err = snd_use_case_mgr_open(&uc_mgr, id); ++ if (err < 0) ++ return err; ++ err = snd_use_case_set(uc_mgr, "_once", NULL); ++ snd_use_case_mgr_close(uc_mgr); ++ return err; ++} +-- +2.25.1 + diff -Nru alsa-utils-1.2.2/debian/patches/0003-alsactl-redirect-alsa-lib-errors.patch alsa-utils-1.2.2/debian/patches/0003-alsactl-redirect-alsa-lib-errors.patch --- alsa-utils-1.2.2/debian/patches/0003-alsactl-redirect-alsa-lib-errors.patch 1970-01-01 08:00:00.000000000 +0800 +++ alsa-utils-1.2.2/debian/patches/0003-alsactl-redirect-alsa-lib-errors.patch 2020-10-14 16:02:08.000000000 +0800 @@ -0,0 +1,66 @@ +From 8c733bfaadd1e04b97b836d7ea824080ba5269ad Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 14 May 2020 19:09:45 +0200 +Subject: [PATCH 3/8] alsactl: redirect alsa-lib errors + +Signed-off-by: Jaroslav Kysela +(cherry picked from commit 8fb4016a175f5e83c6ec363528c9ba6332a262ef) +Signed-off-by: Hui Wang +--- + alsactl/alsactl.c | 2 ++ + alsactl/alsactl.h | 1 + + alsactl/utils.c | 16 ++++++++++++++++ + 3 files changed, 19 insertions(+) + +diff --git a/alsactl/alsactl.c b/alsactl/alsactl.c +index dfb1db7..168430e 100644 +--- a/alsactl/alsactl.c ++++ b/alsactl/alsactl.c +@@ -354,6 +354,8 @@ int main(int argc, char *argv[]) + syslog(LOG_INFO, "alsactl " SND_UTIL_VERSION_STR " daemon started"); + } + ++ snd_lib_error_set_handler(error_handler); ++ + if (!strcmp(cmd, "init")) { + res = init(initfile, cardname); + snd_config_update_free_global(); +diff --git a/alsactl/alsactl.h b/alsactl/alsactl.h +index 6e96e78..853a701 100644 +--- a/alsactl/alsactl.h ++++ b/alsactl/alsactl.h +@@ -11,6 +11,7 @@ void info_(const char *fcn, long line, const char *fmt, ...); + void error_(const char *fcn, long line, const char *fmt, ...); + void cerror_(const char *fcn, long line, int cond, const char *fmt, ...); + void dbg_(const char *fcn, long line, const char *fmt, ...); ++void error_handler(const char *file, int line, const char *function, int err, const char *fmt, ...); + + #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) + #define info(...) do { info_(__func__, __LINE__, __VA_ARGS__); } while (0) +diff --git a/alsactl/utils.c b/alsactl/utils.c +index a8c3a84..fb59e0e 100644 +--- a/alsactl/utils.c ++++ b/alsactl/utils.c +@@ -177,3 +177,19 @@ void dbg_(const char *fcn, long line, const char *fmt, ...) + } + va_end(ap); + } ++ ++void error_handler(const char *file, int line, const char *function, int err, const char *fmt, ...) ++{ ++ char buf[2048]; ++ va_list arg; ++ ++ va_start(arg, fmt); ++ vsnprintf(buf, sizeof(buf), fmt, arg); ++ va_end(arg); ++ if (use_syslog) ++ syslog(LOG_ERR, "alsa-lib %s:%i:(%s) %s%s%s\n", file, line, function, ++ buf, err ? ": " : "", err ? snd_strerror(err) : ""); ++ else ++ fprintf(stderr, "alsa-lib %s:%i:(%s) %s%s%s\n", file, line, function, ++ buf, err ? ": " : "", err ? snd_strerror(err) : ""); ++} +-- +2.25.1 + diff -Nru alsa-utils-1.2.2/debian/patches/0004-alsactl-add-D-argument-to-execute-also-the-UCM-defau.patch alsa-utils-1.2.2/debian/patches/0004-alsactl-add-D-argument-to-execute-also-the-UCM-defau.patch --- alsa-utils-1.2.2/debian/patches/0004-alsactl-add-D-argument-to-execute-also-the-UCM-defau.patch 1970-01-01 08:00:00.000000000 +0800 +++ alsa-utils-1.2.2/debian/patches/0004-alsactl-add-D-argument-to-execute-also-the-UCM-defau.patch 2020-10-14 16:02:08.000000000 +0800 @@ -0,0 +1,217 @@ +From 516cfb74741a188806b5531a870fea8f389a6b18 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 14 May 2020 19:34:18 +0200 +Subject: [PATCH 4/8] alsactl: add -D argument to execute also the UCM defaults + section + +Signed-off-by: Jaroslav Kysela +(cherry picked from commit b68e854d287e93602c3511fa501c2a4824d3b865) +Signed-off-by: Hui Wang +--- + alsactl/alsactl.1 | 5 +++++ + alsactl/alsactl.c | 9 +++++++-- + alsactl/alsactl.h | 10 ++++++---- + alsactl/init_parse.c | 6 +++--- + alsactl/init_ucm.c | 12 +++++++++++- + alsactl/state.c | 10 +++++----- + 6 files changed, 37 insertions(+), 15 deletions(-) + +diff --git a/alsactl/alsactl.1 b/alsactl/alsactl.1 +index c515fdd..8423b82 100644 +--- a/alsactl/alsactl.1 ++++ b/alsactl/alsactl.1 +@@ -142,6 +142,11 @@ Set the process priority (see 'man nice') + \fI\-c, \-\-sched-idle\fP + Set the process scheduling policy to idle (SCHED_IDLE). + ++.TP ++\fI\-D, \-\-ucm-defaults\fP ++Execute also the 'defaults' section from the UCM configuration. The standard ++behaviour is to execute only 'once' section. ++ + .SH FILES + \fI/var/lib/alsa/asound.state\fP (or whatever file you specify with the + \fB\-f\fP flag) is used to store current settings for your +diff --git a/alsactl/alsactl.c b/alsactl/alsactl.c +index 168430e..5d7b450 100644 +--- a/alsactl/alsactl.c ++++ b/alsactl/alsactl.c +@@ -96,6 +96,7 @@ static struct arg args[] = { + { 's', "syslog", "use syslog for messages" }, + { INTARG | 'n', "nice", "set the process priority (see 'man nice')" }, + { 'c', "sched-idle", "set the process scheduling policy to idle (SCHED_IDLE)" }, ++{ 'D', "ucm-defaults", "execute also the UCM 'defaults' section" }, + { HEADER, NULL, "Available commands:" }, + { CARDCMD, "store", "save current driver setup for one or each soundcards" }, + { EMPCMD, NULL, " to configuration file" }, +@@ -191,6 +192,7 @@ int main(int argc, char *argv[]) + int daemoncmd = 0; + int use_nice = NO_NICE; + int sched_idle = 0; ++ int initflags = 0; + struct arg *a; + struct option *o; + int i, j, k, res; +@@ -263,6 +265,9 @@ int main(int argc, char *argv[]) + case 'I': + init_fallback = 0; + break; ++ case 'D': ++ initflags |= FLAG_UCM_DEFAULTS; ++ break; + case 'r': + statefile = optarg; + break; +@@ -357,7 +362,7 @@ int main(int argc, char *argv[]) + snd_lib_error_set_handler(error_handler); + + if (!strcmp(cmd, "init")) { +- res = init(initfile, cardname); ++ res = init(initfile, initflags, cardname); + snd_config_update_free_global(); + } else if (!strcmp(cmd, "store")) { + res = save_state(cfgfile, cardname); +@@ -366,7 +371,7 @@ int main(int argc, char *argv[]) + !strcmp(cmd, "nrestore")) { + if (removestate) + remove(statefile); +- res = load_state(cfgfile, initfile, cardname, init_fallback); ++ res = load_state(cfgfile, initfile, initflags, cardname, init_fallback); + if (!strcmp(cmd, "rdaemon")) { + do_nice(use_nice, sched_idle); + res = state_daemon(cfgfile, cardname, period, pidfile); +diff --git a/alsactl/alsactl.h b/alsactl/alsactl.h +index 853a701..2352f4c 100644 +--- a/alsactl/alsactl.h ++++ b/alsactl/alsactl.h +@@ -25,13 +25,15 @@ void error_handler(const char *file, int line, const char *function, int err, co + #define dbg(args...) do { dbg_(__func__, __LINE__, ##args); } while (0) + #endif + +-int init(const char *file, const char *cardname); +-int init_ucm(int cardno); ++#define FLAG_UCM_DEFAULTS (1<<0) ++ ++int init(const char *file, int flags, const char *cardname); ++int init_ucm(int flags, int cardno); + int state_lock(const char *file, int timeout); + int state_unlock(int fd, const char *file); + int save_state(const char *file, const char *cardname); +-int load_state(const char *file, const char *initfile, const char *cardname, +- int do_init); ++int load_state(const char *file, const char *initfile, int initflags, ++ const char *cardname, int do_init); + int power(const char *argv[], int argc); + int monitor(const char *name); + int state_daemon(const char *file, const char *cardname, int period, +diff --git a/alsactl/init_parse.c b/alsactl/init_parse.c +index f176a7a..4ece067 100644 +--- a/alsactl/init_parse.c ++++ b/alsactl/init_parse.c +@@ -1742,7 +1742,7 @@ static int parse(struct space *space, const char *filename) + return err ? err : -abs(space->exit_code); + } + +-int init(const char *filename, const char *cardname) ++int init(const char *filename, int flags, const char *cardname) + { + struct space *space; + int err = 0, lasterr = 0, card, first; +@@ -1762,7 +1762,7 @@ int init(const char *filename, const char *cardname) + break; + } + first = 0; +- err = init_ucm(card); ++ err = init_ucm(flags, card); + if (err == 0) + continue; + err = init_space(&space, card); +@@ -1787,7 +1787,7 @@ int init(const char *filename, const char *cardname) + error("Cannot find soundcard '%s'...", cardname); + goto error; + } +- err = init_ucm(card); ++ err = init_ucm(flags, card); + if (err == 0) + return 0; + memset(&space, 0, sizeof(space)); +diff --git a/alsactl/init_ucm.c b/alsactl/init_ucm.c +index 833a1f9..9c05300 100644 +--- a/alsactl/init_ucm.c ++++ b/alsactl/init_ucm.c +@@ -19,12 +19,14 @@ + * + */ + ++#include ++#include "alsactl.h" + #include + + /* + * Keep it as simple as possible. Execute commands from the SectionOnce only. + */ +-int init_ucm(int cardno) ++int init_ucm(int flags, int cardno) + { + snd_use_case_mgr_t *uc_mgr; + char id[32]; +@@ -35,6 +37,14 @@ int init_ucm(int cardno) + if (err < 0) + return err; + err = snd_use_case_set(uc_mgr, "_once", NULL); ++ if (err < 0) ++ goto _error; ++ if ((flags & FLAG_UCM_DEFAULTS) != 0) { ++ err = snd_use_case_set(uc_mgr, "_defaults", NULL); ++ if (err < 0) ++ goto _error; ++ } ++_error: + snd_use_case_mgr_close(uc_mgr); + return err; + } +diff --git a/alsactl/state.c b/alsactl/state.c +index 22e0269..ea1d3bc 100644 +--- a/alsactl/state.c ++++ b/alsactl/state.c +@@ -1645,8 +1645,8 @@ out: + return err; + } + +-int load_state(const char *file, const char *initfile, const char *cardname, +- int do_init) ++int load_state(const char *file, const char *initfile, int initflags, ++ const char *cardname, int do_init) + { + int err, finalerr = 0; + snd_config_t *config; +@@ -1704,7 +1704,7 @@ single: + if (!do_init) + break; + sprintf(cardname1, "%i", card); +- err = init(initfile, cardname1); ++ err = init(initfile, initflags, cardname1); + if (err < 0) { + finalerr = err; + initfailed(card, "init", err); +@@ -1743,7 +1743,7 @@ single: + /* do a check if controls matches state file */ + if (do_init && set_controls(card, config, 0)) { + sprintf(cardname1, "%i", card); +- err = init(initfile, cardname1); ++ err = init(initfile, initflags, cardname1); + if (err < 0) { + initfailed(card, "init", err); + finalerr = err; +@@ -1766,7 +1766,7 @@ single: + } + /* do a check if controls matches state file */ + if (do_init && set_controls(cardno, config, 0)) { +- err = init(initfile, cardname); ++ err = init(initfile, initflags, cardname); + if (err < 0) { + initfailed(cardno, "init", err); + finalerr = err; +-- +2.25.1 + diff -Nru alsa-utils-1.2.2/debian/patches/0005-alsactl-use-the-right-priority-for-syslog-messages.patch alsa-utils-1.2.2/debian/patches/0005-alsactl-use-the-right-priority-for-syslog-messages.patch --- alsa-utils-1.2.2/debian/patches/0005-alsactl-use-the-right-priority-for-syslog-messages.patch 1970-01-01 08:00:00.000000000 +0800 +++ alsa-utils-1.2.2/debian/patches/0005-alsactl-use-the-right-priority-for-syslog-messages.patch 2020-10-14 16:02:08.000000000 +0800 @@ -0,0 +1,28 @@ +From 2b8bd3315237d4c63c983d02124bbe191a7ab92f Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 14 May 2020 19:41:40 +0200 +Subject: [PATCH 5/8] alsactl: use the right priority for syslog messages + +Signed-off-by: Jaroslav Kysela +(cherry picked from commit 0adca4cac7f02ec07cf7b2042110125eb1052b60) +Signed-off-by: Hui Wang +--- + alsactl/utils.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/alsactl/utils.c b/alsactl/utils.c +index fb59e0e..9d4166f 100644 +--- a/alsactl/utils.c ++++ b/alsactl/utils.c +@@ -111,7 +111,7 @@ static void syslog_(int prio, const char *fcn, long line, + buf[sizeof(buf)-1] = '\0'; + vsnprintf(buf + strlen(buf), sizeof(buf)-strlen(buf), fmt, ap); + buf[sizeof(buf)-1] = '\0'; +- syslog(LOG_INFO, "%s", buf); ++ syslog(prio, "%s", buf); + } + + void info_(const char *fcn, long line, const char *fmt, ...) +-- +2.25.1 + diff -Nru alsa-utils-1.2.2/debian/patches/0006-alsactl-allow-to-compile-alsactl-without-UCM-support.patch alsa-utils-1.2.2/debian/patches/0006-alsactl-allow-to-compile-alsactl-without-UCM-support.patch --- alsa-utils-1.2.2/debian/patches/0006-alsactl-allow-to-compile-alsactl-without-UCM-support.patch 1970-01-01 08:00:00.000000000 +0800 +++ alsa-utils-1.2.2/debian/patches/0006-alsactl-allow-to-compile-alsactl-without-UCM-support.patch 2020-10-14 16:02:08.000000000 +0800 @@ -0,0 +1,60 @@ +From dfbe27348f7d7a02deea8a209670e0fc64cf2b60 Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 14 May 2020 19:54:04 +0200 +Subject: [PATCH 6/8] alsactl: allow to compile alsactl without UCM support + +Signed-off-by: Jaroslav Kysela +(cherry picked from commit 570ea6c455d1fe82c597e4ef9d5edbf07d6723dd) +Signed-off-by: Hui Wang +--- + alsactl/alsactl.c | 2 ++ + alsactl/init_ucm.c | 13 +++++++++++++ + 2 files changed, 15 insertions(+) + +diff --git a/alsactl/alsactl.c b/alsactl/alsactl.c +index 5d7b450..e66e7d3 100644 +--- a/alsactl/alsactl.c ++++ b/alsactl/alsactl.c +@@ -96,7 +96,9 @@ static struct arg args[] = { + { 's', "syslog", "use syslog for messages" }, + { INTARG | 'n', "nice", "set the process priority (see 'man nice')" }, + { 'c', "sched-idle", "set the process scheduling policy to idle (SCHED_IDLE)" }, ++#ifdef HAVE_ALSA_USE_CASE_H + { 'D', "ucm-defaults", "execute also the UCM 'defaults' section" }, ++#endif + { HEADER, NULL, "Available commands:" }, + { CARDCMD, "store", "save current driver setup for one or each soundcards" }, + { EMPCMD, NULL, " to configuration file" }, +diff --git a/alsactl/init_ucm.c b/alsactl/init_ucm.c +index 9c05300..f6a43c5 100644 +--- a/alsactl/init_ucm.c ++++ b/alsactl/init_ucm.c +@@ -19,8 +19,12 @@ + * + */ + ++#include "aconfig.h" + #include + #include "alsactl.h" ++ ++#ifdef HAVE_ALSA_USE_CASE_H ++ + #include + + /* +@@ -48,3 +52,12 @@ _error: + snd_use_case_mgr_close(uc_mgr); + return err; + } ++ ++#else ++ ++int init_ucm(int flags, int cardno) ++{ ++ return 0; ++} ++ ++#endif +-- +2.25.1 + diff -Nru alsa-utils-1.2.2/debian/patches/0007-alsactl-ucm-rename-_once-command-to-_boot-command.patch alsa-utils-1.2.2/debian/patches/0007-alsactl-ucm-rename-_once-command-to-_boot-command.patch --- alsa-utils-1.2.2/debian/patches/0007-alsactl-ucm-rename-_once-command-to-_boot-command.patch 1970-01-01 08:00:00.000000000 +0800 +++ alsa-utils-1.2.2/debian/patches/0007-alsactl-ucm-rename-_once-command-to-_boot-command.patch 2020-10-14 16:02:08.000000000 +0800 @@ -0,0 +1,28 @@ +From 6a7cd0213093d4ee8cd601e9a6d0d782dbdd96ee Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Mon, 25 May 2020 19:21:25 +0200 +Subject: [PATCH 7/8] alsactl: ucm - rename _once command to _boot command + +Signed-off-by: Jaroslav Kysela +(backported from commit f8a2aad5bbdb0430c0b9cd1d4d8a3b81fa5e1df1) +Signed-off-by: Hui Wang +--- + alsactl/init_ucm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/alsactl/init_ucm.c b/alsactl/init_ucm.c +index f6a43c5..6468c9d 100644 +--- a/alsactl/init_ucm.c ++++ b/alsactl/init_ucm.c +@@ -40,7 +40,7 @@ int init_ucm(int flags, int cardno) + err = snd_use_case_mgr_open(&uc_mgr, id); + if (err < 0) + return err; +- err = snd_use_case_set(uc_mgr, "_once", NULL); ++ err = snd_use_case_set(uc_mgr, "_boot", NULL); + if (err < 0) + goto _error; + if ((flags & FLAG_UCM_DEFAULTS) != 0) { +-- +2.25.1 + diff -Nru alsa-utils-1.2.2/debian/patches/0008-alsaucm-remove-custom-rules-alsactl-is-UCM-aware-now.patch alsa-utils-1.2.2/debian/patches/0008-alsaucm-remove-custom-rules-alsactl-is-UCM-aware-now.patch --- alsa-utils-1.2.2/debian/patches/0008-alsaucm-remove-custom-rules-alsactl-is-UCM-aware-now.patch 1970-01-01 08:00:00.000000000 +0800 +++ alsa-utils-1.2.2/debian/patches/0008-alsaucm-remove-custom-rules-alsactl-is-UCM-aware-now.patch 2020-10-14 16:02:08.000000000 +0800 @@ -0,0 +1,55 @@ +From 7f2d0437362b7dcfc918e89172f2ac02d3a9f8cc Mon Sep 17 00:00:00 2001 +From: Jaroslav Kysela +Date: Thu, 28 May 2020 21:00:18 +0200 +Subject: [PATCH 8/8] alsaucm: remove custom rules, alsactl is UCM aware now + +Signed-off-by: Jaroslav Kysela +(cherry picked from commit d3d01ee7cf0de4a07e893f34ca49b5281f593530) +Signed-off-by: Hui Wang +--- + alsaucm/89-alsa-ucm.rules.in | 8 -------- + alsaucm/Makefile.am | 15 ++------------- + 2 files changed, 2 insertions(+), 21 deletions(-) + delete mode 100644 alsaucm/89-alsa-ucm.rules.in + +diff --git a/alsaucm/89-alsa-ucm.rules.in b/alsaucm/89-alsa-ucm.rules.in +deleted file mode 100644 +index 52a7616..0000000 +--- a/alsaucm/89-alsa-ucm.rules.in ++++ /dev/null +@@ -1,8 +0,0 @@ +-SUBSYSTEM!="sound", GOTO="ucm_end" +-ACTION!="change", GOTO="ucm_end" +-KERNEL!="card*", GOTO="ucm_end" +- +-ATTRS{id}=="PAZ00", RUN+="@bindir@/alsaucm -c PAZ00 set _verb HiFi" +-ATTRS{id}=="PAZ00", RUN+="@bindir@/alsaucm -c PAZ00 set _verb Record" +- +-LABEL="ucm_end" +diff --git a/alsaucm/Makefile.am b/alsaucm/Makefile.am +index ae02fc3..2010fc0 100644 +--- a/alsaucm/Makefile.am ++++ b/alsaucm/Makefile.am +@@ -15,17 +15,6 @@ AM_CPPFLAGS = \ + %.1: %.rst + rst2man $< > $@ + +-udevrules_DATA = \ +- 89-alsa-ucm.rules ++EXTRA_DIST = alsaucm.rst + +-edit = \ +- $(SED) -r -e 's,@bindir\@,$(bindir),g' \ +- -e 's,@mydatadir\@,$(mydatadir),g' \ +- < $< > $@ || rm $@ +- +-89-alsa-ucm.rules: 89-alsa-ucm.rules.in +- $(edit) +- +-EXTRA_DIST = alsaucm.rst 89-alsa-ucm.rules.in +- +-CLEANFILES = alsaucm.1 89-alsa-ucm.rules ++CLEANFILES = alsaucm.1 +-- +2.25.1 + diff -Nru alsa-utils-1.2.2/debian/patches/series alsa-utils-1.2.2/debian/patches/series --- alsa-utils-1.2.2/debian/patches/series 2020-03-05 00:44:43.000000000 +0800 +++ alsa-utils-1.2.2/debian/patches/series 2020-10-14 16:02:31.000000000 +0800 @@ -9,3 +9,12 @@ add_extra_volume_defaults.patch vmware_audio_volume.patch create_run_alsa.patch + +0001-alsactl-init-iterate-through-all-cards-for-the-initi.patch +0002-alsactl-add-initial-support-for-UCM-init.patch +0003-alsactl-redirect-alsa-lib-errors.patch +0004-alsactl-add-D-argument-to-execute-also-the-UCM-defau.patch +0005-alsactl-use-the-right-priority-for-syslog-messages.patch +0006-alsactl-allow-to-compile-alsactl-without-UCM-support.patch +0007-alsactl-ucm-rename-_once-command-to-_boot-command.patch +0008-alsaucm-remove-custom-rules-alsactl-is-UCM-aware-now.patch