mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-12-22 07:36:31 +01:00
alsactl: suppress no device 'errors' for UCM
This patch adds --ucm-nodev (or -X) option to get those
messages back. The code works only with library 1.2.6+.
By default, these messages are suppressed:
alsactl[xxx]: alsa-lib parser.c:242:(error_node) UCM is not supported for this HDA model (HDA Intel PCH...)
alsactl[xxx]: alsa-lib main.c:1405:(snd_use_case_mgr_open) error: failed to import hw:0 use case configuration -6
Fixes: https://github.com/alsa-project/alsa-utils/issues/111
Link: https://lore.kernel.org/alsa-devel/20211027144008.27002-1-tiwai@suse.de/
Link: 23198a72cd
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
5d4442b2cf
commit
af62c72e2d
3 changed files with 13 additions and 2 deletions
|
@ -102,6 +102,9 @@ static struct arg args[] = {
|
|||
#ifdef HAVE_ALSA_USE_CASE_H
|
||||
{ 'D', "ucm-defaults", "execute also the UCM 'defaults' section" },
|
||||
{ 'U', "no-ucm", "don't init with UCM" },
|
||||
#if SND_LIB_VER(1, 2, 5) < SND_LIB_VERSION
|
||||
{ 'X', "ucm-nodev", "show UCM no device errors" },
|
||||
#endif
|
||||
#endif
|
||||
{ HEADER, NULL, "Available commands:" },
|
||||
{ CARDCMD, "store", "save current driver setup for one or each soundcards" },
|
||||
|
@ -253,6 +256,9 @@ int main(int argc, char *argv[])
|
|||
struct option *long_option;
|
||||
char *short_option;
|
||||
|
||||
#if SND_LIB_VER(1, 2, 5) >= SND_LIB_VERSION
|
||||
initflags |= FLAG_UCM_NODEV;
|
||||
#endif
|
||||
long_option = calloc(ARRAY_SIZE(args), sizeof(struct option));
|
||||
if (long_option == NULL)
|
||||
exit(EXIT_FAILURE);
|
||||
|
@ -328,6 +334,9 @@ int main(int argc, char *argv[])
|
|||
case 'U':
|
||||
initflags |= FLAG_UCM_DISABLED;
|
||||
break;
|
||||
case 'X':
|
||||
initflags |= FLAG_UCM_NODEV;
|
||||
break;
|
||||
case 'r':
|
||||
statefile = optarg;
|
||||
break;
|
||||
|
|
|
@ -39,6 +39,7 @@ void error_handler(const char *file, int line, const char *function, int err, co
|
|||
#define FLAG_UCM_FBOOT (1<<1)
|
||||
#define FLAG_UCM_BOOT (1<<2)
|
||||
#define FLAG_UCM_DEFAULTS (1<<3)
|
||||
#define FLAG_UCM_NODEV (1<<4)
|
||||
|
||||
void snd_card_iterator_init(struct snd_card_iterator *iter, int cardno);
|
||||
int snd_card_iterator_sinit(struct snd_card_iterator *iter, const char *cardname);
|
||||
|
|
|
@ -34,13 +34,14 @@
|
|||
int init_ucm(int flags, int cardno)
|
||||
{
|
||||
snd_use_case_mgr_t *uc_mgr;
|
||||
char id[32];
|
||||
char id[32], *nodev;
|
||||
int err;
|
||||
|
||||
if (flags & FLAG_UCM_DISABLED)
|
||||
return -ENXIO;
|
||||
|
||||
snprintf(id, sizeof(id), "hw:%d", cardno);
|
||||
nodev = (flags & FLAG_UCM_NODEV) ? "" : "-";
|
||||
snprintf(id, sizeof(id), "%shw:%d", nodev, cardno);
|
||||
err = snd_use_case_mgr_open(&uc_mgr, id);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
|
Loading…
Reference in a new issue