mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-31 22:25:35 -04:00
ucm: allow bind modifier to specific instances, other fixes
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
a16008023e
commit
37c7e2843f
5 changed files with 67 additions and 17 deletions
|
|
@ -467,14 +467,36 @@ static int is_modifier_supported(snd_use_case_mgr_t *uc_mgr,
|
|||
struct use_case_modifier *modifier)
|
||||
{
|
||||
struct dev_list *device;
|
||||
struct list_head *pos;
|
||||
struct use_case_device *adev;
|
||||
struct list_head *pos, *pos1;
|
||||
char *cpos;
|
||||
int dlen, len;
|
||||
|
||||
list_for_each(pos, &modifier->dev_list) {
|
||||
device = list_entry(pos, struct dev_list, list);
|
||||
if (find(&uc_mgr->active_devices,
|
||||
struct use_case_device, active_list, name, device->name))
|
||||
return 1;
|
||||
|
||||
cpos = strchr(device->name, '.');
|
||||
if (cpos) {
|
||||
if (find(&uc_mgr->active_devices,
|
||||
struct use_case_device, active_list,
|
||||
name, device->name))
|
||||
return 1;
|
||||
} else {
|
||||
dlen = strlen(device->name);
|
||||
list_for_each(pos1, &uc_mgr->active_devices) {
|
||||
adev = list_entry(pos1, struct use_case_device,
|
||||
active_list);
|
||||
cpos = strchr(adev->name, '.');
|
||||
if (cpos)
|
||||
len = cpos - adev->name;
|
||||
else
|
||||
len = strlen(adev->name);
|
||||
if (len != dlen)
|
||||
continue;
|
||||
if (memcmp(adev->name, device->name, len))
|
||||
continue;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -497,6 +519,7 @@ static struct use_case_modifier *
|
|||
modifier = list_entry(pos, struct use_case_modifier, list);
|
||||
|
||||
strncpy(name, modifier->name, sizeof(name));
|
||||
name[sizeof(name)-1] = '\0';
|
||||
cpos = strchr(name, '.');
|
||||
if (!cpos)
|
||||
continue;
|
||||
|
|
@ -1397,8 +1420,8 @@ int snd_use_case_set(snd_use_case_mgr_t *uc_mgr,
|
|||
const char *identifier,
|
||||
const char *value)
|
||||
{
|
||||
char *str, *str1;
|
||||
int err;
|
||||
char *str, *str1;
|
||||
int err;
|
||||
|
||||
pthread_mutex_lock(&uc_mgr->mutex);
|
||||
if (strcmp(identifier, "_verb") == 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue