ucm: save the whole ctl info to the ctl_list structure

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2019-11-05 10:06:37 +01:00
parent 0dd89f3892
commit d8dfe4dac7
4 changed files with 47 additions and 37 deletions

View file

@ -1361,35 +1361,32 @@ static char *rval_conf_name(snd_use_case_mgr_t *uc_mgr)
static char *rval_card_id(snd_use_case_mgr_t *uc_mgr)
{
struct list_head *pos;
struct ctl_list *ctl_list = NULL;
list_for_each(pos, &uc_mgr->ctl_list) {
if (ctl_list) {
uc_error("multiple control device names were found!");
return NULL;
}
ctl_list = list_entry(pos, struct ctl_list, list);
}
struct ctl_list *ctl_list;
ctl_list = uc_mgr_get_one_ctl(uc_mgr);
if (ctl_list == NULL)
return NULL;
return strdup(ctl_list->ctl_id);
return strdup(snd_ctl_card_info_get_id(ctl_list->ctl_info));
}
static char *rval_card_name(snd_use_case_mgr_t *uc_mgr)
{
if (uc_mgr->card_short_name)
return strdup(uc_mgr->card_short_name);
return NULL;
struct ctl_list *ctl_list;
ctl_list = uc_mgr_get_one_ctl(uc_mgr);
if (ctl_list == NULL)
return NULL;
return strdup(snd_ctl_card_info_get_name(ctl_list->ctl_info));
}
static char *rval_card_longname(snd_use_case_mgr_t *uc_mgr)
{
if (uc_mgr->card_long_name[0])
return strdup(uc_mgr->card_long_name);
return NULL;
struct ctl_list *ctl_list;
ctl_list = uc_mgr_get_one_ctl(uc_mgr);
if (ctl_list == NULL)
return NULL;
return strdup(snd_ctl_card_info_get_longname(ctl_list->ctl_info));
}
static char *rval_env(snd_use_case_mgr_t *uc_mgr ATTRIBUTE_UNUSED, const char *id)