Blame alsactl/init_ucm.c

Packit Service a9274b
/*
Packit Service a9274b
 *  Advanced Linux Sound Architecture Control Program - UCM Initialization
Packit Service a9274b
 *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>
Packit Service a9274b
 *
Packit Service a9274b
 *
Packit Service a9274b
 *   This program is free software; you can redistribute it and/or modify
Packit Service a9274b
 *   it under the terms of the GNU General Public License as published by
Packit Service a9274b
 *   the Free Software Foundation; either version 2 of the License, or
Packit Service a9274b
 *   (at your option) any later version.
Packit Service a9274b
 *
Packit Service a9274b
 *   This program is distributed in the hope that it will be useful,
Packit Service a9274b
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service a9274b
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Service a9274b
 *   GNU General Public License for more details.
Packit Service a9274b
 *
Packit Service a9274b
 *   You should have received a copy of the GNU General Public License
Packit Service a9274b
 *   along with this program; if not, write to the Free Software
Packit Service a9274b
 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
Packit Service a9274b
 *
Packit Service a9274b
 */
Packit Service a9274b
Packit Service a9274b
#include "aconfig.h"
Packit Service a9274b
#include <stddef.h>
Packit Service a9274b
#include "alsactl.h"
Packit Service a9274b
Packit Service a9274b
#ifdef HAVE_ALSA_USE_CASE_H
Packit Service a9274b
Packit Service a9274b
#include <alsa/use-case.h>
Packit Service a9274b
Packit Service a9274b
/*
Packit Service a9274b
 * Keep it as simple as possible. Execute commands from the SectionOnce only.
Packit Service a9274b
 */
Packit Service a9274b
int init_ucm(int flags, int cardno)
Packit Service a9274b
{
Packit Service a9274b
	snd_use_case_mgr_t *uc_mgr;
Packit Service a9274b
	char id[32];
Packit Service a9274b
	int err;
Packit Service a9274b
Packit Service a9274b
	snprintf(id, sizeof(id), "hw:%d", cardno);
Packit Service a9274b
	err = snd_use_case_mgr_open(&uc_mgr, id);
Packit Service a9274b
	if (err < 0)
Packit Service a9274b
		return err;
Packit Service a9274b
	err = snd_use_case_set(uc_mgr, "_boot", NULL);
Packit Service a9274b
	if (err < 0)
Packit Service a9274b
		goto _error;
Packit Service a9274b
	if ((flags & FLAG_UCM_DEFAULTS) != 0) {
Packit Service a9274b
		err = snd_use_case_set(uc_mgr, "_defaults", NULL);
Packit Service a9274b
		if (err < 0)
Packit Service a9274b
			goto _error;
Packit Service a9274b
	}
Packit Service a9274b
_error:
Packit Service a9274b
	snd_use_case_mgr_close(uc_mgr);
Packit Service a9274b
	return err;
Packit Service a9274b
}
Packit Service a9274b
Packit Service a9274b
#else
Packit Service a9274b
Packit Service a9274b
int init_ucm(int flags, int cardno)
Packit Service a9274b
{
Packit Service a9274b
	return 0;
Packit Service a9274b
}
Packit Service a9274b
Packit Service a9274b
#endif