mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2026-02-12 04:27:45 -05:00
ucm: add ValueGlobals section to the top configuration file
BootCardGroup and BootCardSyncTime variables should not be listed by default in _identifiers. Handle them differently using ValueGlobals section. Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
5ed27d8e89
commit
66dfd40e8f
5 changed files with 27 additions and 9 deletions
|
|
@ -1144,7 +1144,7 @@ static int boot_wait(snd_use_case_mgr_t *uc_mgr, int *_primary_card)
|
||||||
if (_primary_card)
|
if (_primary_card)
|
||||||
*_primary_card = -1;
|
*_primary_card = -1;
|
||||||
|
|
||||||
err = get_value1(uc_mgr, &boot_card_sync_time, &uc_mgr->value_list, "BootCardSyncTime");
|
err = get_value1(uc_mgr, &boot_card_sync_time, &uc_mgr->global_value_list, "BootCardSyncTime");
|
||||||
if (err == 0 && boot_card_sync_time != NULL) {
|
if (err == 0 && boot_card_sync_time != NULL) {
|
||||||
long sync_time;
|
long sync_time;
|
||||||
if (safe_strtol(boot_card_sync_time, &sync_time) == 0 && sync_time > 0 && sync_time <= 240) {
|
if (safe_strtol(boot_card_sync_time, &sync_time) == 0 && sync_time > 0 && sync_time <= 240) {
|
||||||
|
|
@ -1764,6 +1764,7 @@ int snd_use_case_mgr_open(snd_use_case_mgr_t **uc_mgr,
|
||||||
INIT_LIST_HEAD(&mgr->boot_list);
|
INIT_LIST_HEAD(&mgr->boot_list);
|
||||||
INIT_LIST_HEAD(&mgr->default_list);
|
INIT_LIST_HEAD(&mgr->default_list);
|
||||||
INIT_LIST_HEAD(&mgr->value_list);
|
INIT_LIST_HEAD(&mgr->value_list);
|
||||||
|
INIT_LIST_HEAD(&mgr->global_value_list);
|
||||||
INIT_LIST_HEAD(&mgr->active_modifiers);
|
INIT_LIST_HEAD(&mgr->active_modifiers);
|
||||||
INIT_LIST_HEAD(&mgr->active_devices);
|
INIT_LIST_HEAD(&mgr->active_devices);
|
||||||
INIT_LIST_HEAD(&mgr->ctl_list);
|
INIT_LIST_HEAD(&mgr->ctl_list);
|
||||||
|
|
@ -2542,6 +2543,10 @@ static int get_value(snd_use_case_mgr_t *uc_mgr,
|
||||||
if (err >= 0 || err != -ENOENT)
|
if (err >= 0 || err != -ENOENT)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
err = get_value1(uc_mgr, value, &uc_mgr->global_value_list, identifier);
|
||||||
|
if (err >= 0 || err != -ENOENT)
|
||||||
|
return err;
|
||||||
|
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3161,17 +3161,17 @@ static int parse_master_file(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg)
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
/* parse ValueDefaults first */
|
/* parse ValueGlobals first */
|
||||||
err = snd_config_search(cfg, "ValueDefaults", &n);
|
err = snd_config_search(cfg, "ValueGlobals", &n);
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
err = parse_value(uc_mgr, &uc_mgr->value_list, n);
|
err = parse_value(uc_mgr, &uc_mgr->global_value_list, n);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
snd_error(UCM, "failed to parse ValueDefaults");
|
snd_error(UCM, "failed to parse ValueGlobals");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = uc_mgr_check_value(&uc_mgr->value_list, "BootCardGroup");
|
err = uc_mgr_check_value(&uc_mgr->global_value_list, "BootCardGroup");
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
uc_mgr->card_group = true;
|
uc_mgr->card_group = true;
|
||||||
/* if we are in boot, skip the main parsing loop */
|
/* if we are in boot, skip the main parsing loop */
|
||||||
|
|
@ -3231,9 +3231,18 @@ static int parse_master_file(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg)
|
||||||
|
|
||||||
/* ValueDefaults is now parsed at the top of this function */
|
/* ValueDefaults is now parsed at the top of this function */
|
||||||
if (strcmp(id, "ValueDefaults") == 0) {
|
if (strcmp(id, "ValueDefaults") == 0) {
|
||||||
|
err = parse_value(uc_mgr, &uc_mgr->value_list, n);
|
||||||
|
if (err < 0) {
|
||||||
|
snd_error(UCM, "failed to parse ValueDefaults");
|
||||||
|
return err;
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ValueGlobals is parsed at the top of this function */
|
||||||
|
if (strcmp(id, "ValueGlobals") == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
/* alsa-lib configuration */
|
/* alsa-lib configuration */
|
||||||
if (uc_mgr->conf_format > 3 && strcmp(id, "LibraryConfig") == 0) {
|
if (uc_mgr->conf_format > 3 && strcmp(id, "LibraryConfig") == 0) {
|
||||||
err = parse_libconfig(uc_mgr, n);
|
err = parse_libconfig(uc_mgr, n);
|
||||||
|
|
|
||||||
|
|
@ -464,7 +464,7 @@ boot).
|
||||||
|
|
||||||
#### Boot Synchronization (Syntax 8+)
|
#### Boot Synchronization (Syntax 8+)
|
||||||
|
|
||||||
The *BootCardGroup* value in *ValueDefaults* allows multiple sound cards to coordinate
|
The *BootCardGroup* value in *ValueGlobals* allows multiple sound cards to coordinate
|
||||||
their boot sequences. This value is detected at boot (alsactl/udev/systemd) time. Boot
|
their boot sequences. This value is detected at boot (alsactl/udev/systemd) time. Boot
|
||||||
tools can provide boot synchronization information through a control element named
|
tools can provide boot synchronization information through a control element named
|
||||||
'Boot' with 64-bit integer type. When present, the UCM library uses this control element
|
'Boot' with 64-bit integer type. When present, the UCM library uses this control element
|
||||||
|
|
@ -477,7 +477,7 @@ The 'Boot' control element contains:
|
||||||
|
|
||||||
The UCM open call waits until the boot timeout has passed or until restore state
|
The UCM open call waits until the boot timeout has passed or until restore state
|
||||||
is notified through the synchronization Boot element. The timeout defaults to 30 seconds
|
is notified through the synchronization Boot element. The timeout defaults to 30 seconds
|
||||||
and can be customized using 'BootCardSyncTime' in 'ValueDefaults' (maximum 240 seconds).
|
and can be customized using 'BootCardSyncTime' in 'ValueGlobals' (maximum 240 seconds).
|
||||||
|
|
||||||
If the 'Boot' control element is not present, no boot synchronization is performed.
|
If the 'Boot' control element is not present, no boot synchronization is performed.
|
||||||
|
|
||||||
|
|
@ -488,7 +488,7 @@ cards appropriately.
|
||||||
Example configuration:
|
Example configuration:
|
||||||
|
|
||||||
~~~{.html}
|
~~~{.html}
|
||||||
ValueDefaults {
|
ValueGlobals {
|
||||||
BootCardGroup "amd-acp"
|
BootCardGroup "amd-acp"
|
||||||
BootCardSyncTime 10 # seconds
|
BootCardSyncTime 10 # seconds
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -262,6 +262,9 @@ struct snd_use_case_mgr {
|
||||||
/* default settings - value list */
|
/* default settings - value list */
|
||||||
struct list_head value_list;
|
struct list_head value_list;
|
||||||
|
|
||||||
|
/* global value list */
|
||||||
|
struct list_head global_value_list;
|
||||||
|
|
||||||
/* current status */
|
/* current status */
|
||||||
struct use_case_verb *active_verb;
|
struct use_case_verb *active_verb;
|
||||||
struct list_head active_devices;
|
struct list_head active_devices;
|
||||||
|
|
|
||||||
|
|
@ -807,6 +807,7 @@ void uc_mgr_free_verb(snd_use_case_mgr_t *uc_mgr)
|
||||||
uc_mgr_free_sequence(&uc_mgr->boot_list);
|
uc_mgr_free_sequence(&uc_mgr->boot_list);
|
||||||
uc_mgr_free_sequence(&uc_mgr->default_list);
|
uc_mgr_free_sequence(&uc_mgr->default_list);
|
||||||
uc_mgr_free_value(&uc_mgr->value_list);
|
uc_mgr_free_value(&uc_mgr->value_list);
|
||||||
|
uc_mgr_free_value(&uc_mgr->global_value_list);
|
||||||
uc_mgr_free_value(&uc_mgr->variable_list);
|
uc_mgr_free_value(&uc_mgr->variable_list);
|
||||||
free(uc_mgr->comment);
|
free(uc_mgr->comment);
|
||||||
free(uc_mgr->conf_dir_name);
|
free(uc_mgr->conf_dir_name);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue