mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2026-03-24 09:05:43 -04:00
ucm: replace uc_error with snd_error calls
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
11235095bf
commit
9ab488b86c
9 changed files with 319 additions and 296 deletions
101
src/ucm/main.c
101
src/ucm/main.c
|
|
@ -182,8 +182,9 @@ static int read_tlv_file(unsigned int **res,
|
||||||
}
|
}
|
||||||
sz = st.st_size;
|
sz = st.st_size;
|
||||||
if (sz > 16 * 1024 * 1024 || sz < 8 || sz % 4) {
|
if (sz > 16 * 1024 * 1024 || sz < 8 || sz % 4) {
|
||||||
uc_error("File size should be less than 16 MB "
|
snd_error(UCM, "File size should be less than 16 MB "
|
||||||
"and multiple of 4");
|
"and multiple of 4");
|
||||||
|
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
goto __fail;
|
goto __fail;
|
||||||
}
|
}
|
||||||
|
|
@ -201,7 +202,7 @@ static int read_tlv_file(unsigned int **res,
|
||||||
/* Check if the tlv file specifies valid size. */
|
/* Check if the tlv file specifies valid size. */
|
||||||
tlv = (struct snd_ctl_tlv *)(*res);
|
tlv = (struct snd_ctl_tlv *)(*res);
|
||||||
if (tlv->length + 2 * sizeof(unsigned int) != sz) {
|
if (tlv->length + 2 * sizeof(unsigned int) != sz) {
|
||||||
uc_error("Invalid tlv size: %d", tlv->length);
|
snd_error(UCM, "Invalid tlv size: %d", tlv->length);
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
free(*res);
|
free(*res);
|
||||||
*res = NULL;
|
*res = NULL;
|
||||||
|
|
@ -229,7 +230,7 @@ static int binary_file_parse(snd_ctl_elem_value_t *dst,
|
||||||
|
|
||||||
type = snd_ctl_elem_info_get_type(info);
|
type = snd_ctl_elem_info_get_type(info);
|
||||||
if (type != SND_CTL_ELEM_TYPE_BYTES) {
|
if (type != SND_CTL_ELEM_TYPE_BYTES) {
|
||||||
uc_error("only support byte type!");
|
snd_error(UCM, "only support byte type!");
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
goto __fail;
|
goto __fail;
|
||||||
}
|
}
|
||||||
|
|
@ -245,7 +246,7 @@ static int binary_file_parse(snd_ctl_elem_value_t *dst,
|
||||||
sz = st.st_size;
|
sz = st.st_size;
|
||||||
count = snd_ctl_elem_info_get_count(info);
|
count = snd_ctl_elem_info_get_count(info);
|
||||||
if (sz != count || sz > sizeof(dst->value.bytes)) {
|
if (sz != count || sz > sizeof(dst->value.bytes)) {
|
||||||
uc_error("invalid parameter size %d!", sz);
|
snd_error(UCM, "invalid parameter size %d!", sz);
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
goto __fail;
|
goto __fail;
|
||||||
}
|
}
|
||||||
|
|
@ -308,11 +309,11 @@ static const char *parse_uint(const char *p, const char *prefix, size_t len,
|
||||||
p += len;
|
p += len;
|
||||||
v = strtol(p, &end, 0);
|
v = strtol(p, &end, 0);
|
||||||
if (*end != '\0' && *end != ' ' && *end != ',') {
|
if (*end != '\0' && *end != ' ' && *end != ',') {
|
||||||
uc_error("unable to parse '%s'", prefix);
|
snd_error(UCM, "unable to parse '%s'", prefix);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if ((unsigned int)v < min || (unsigned int)v > max) {
|
if ((unsigned int)v < min || (unsigned int)v > max) {
|
||||||
uc_error("value '%s' out of range %u-%u %(%ld)", min, max, v);
|
snd_error(UCM, "value '%s' out of range %u-%u %(%ld)", min, max, v);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
*rval = v;
|
*rval = v;
|
||||||
|
|
@ -399,7 +400,7 @@ next:
|
||||||
*pos = p;
|
*pos = p;
|
||||||
return 0;
|
return 0;
|
||||||
er:
|
er:
|
||||||
uc_error("unknown syntax '%s'", p);
|
snd_error(UCM, "unknown syntax '%s'", p);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -428,7 +429,7 @@ static int execute_cset(snd_ctl_t *ctl, const char *cset, unsigned int type)
|
||||||
snd_ctl_elem_info_set_id(info2, id);
|
snd_ctl_elem_info_set_id(info2, id);
|
||||||
err = parse_cset_new_info(info2, pos, &pos);
|
err = parse_cset_new_info(info2, pos, &pos);
|
||||||
if (err < 0 || !*pos) {
|
if (err < 0 || !*pos) {
|
||||||
uc_error("undefined or wrong id config for cset-new", cset);
|
snd_error(UCM, "undefined or wrong id config for cset-new", cset);
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
goto __fail;
|
goto __fail;
|
||||||
}
|
}
|
||||||
|
|
@ -437,12 +438,12 @@ static int execute_cset(snd_ctl_t *ctl, const char *cset, unsigned int type)
|
||||||
}
|
}
|
||||||
if (!*pos) {
|
if (!*pos) {
|
||||||
if (type != SEQUENCE_ELEMENT_TYPE_CTL_REMOVE) {
|
if (type != SEQUENCE_ELEMENT_TYPE_CTL_REMOVE) {
|
||||||
uc_error("undefined value for cset >%s<", cset);
|
snd_error(UCM, "undefined value for cset >%s<", cset);
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
goto __fail;
|
goto __fail;
|
||||||
}
|
}
|
||||||
} else if (type == SEQUENCE_ELEMENT_TYPE_CTL_REMOVE) {
|
} else if (type == SEQUENCE_ELEMENT_TYPE_CTL_REMOVE) {
|
||||||
uc_error("extra value for ctl-remove >%s<", cset);
|
snd_error(UCM, "extra value for ctl-remove >%s<", cset);
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
goto __fail;
|
goto __fail;
|
||||||
}
|
}
|
||||||
|
|
@ -454,7 +455,7 @@ static int execute_cset(snd_ctl_t *ctl, const char *cset, unsigned int type)
|
||||||
if (err >= 0) {
|
if (err >= 0) {
|
||||||
err = snd_ctl_elem_remove(ctl, id);
|
err = snd_ctl_elem_remove(ctl, id);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("unable to remove control");
|
snd_error(UCM, "unable to remove control");
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
goto __fail;
|
goto __fail;
|
||||||
}
|
}
|
||||||
|
|
@ -463,7 +464,7 @@ static int execute_cset(snd_ctl_t *ctl, const char *cset, unsigned int type)
|
||||||
goto __ok;
|
goto __ok;
|
||||||
err = __snd_ctl_add_elem_set(ctl, info2, info2->owner, info2->count);
|
err = __snd_ctl_add_elem_set(ctl, info2, info2->owner, info2->count);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("unable to create new control");
|
snd_error(UCM, "unable to create new control");
|
||||||
goto __fail;
|
goto __fail;
|
||||||
}
|
}
|
||||||
/* new id copy */
|
/* new id copy */
|
||||||
|
|
@ -574,7 +575,7 @@ static int execute_sysw(const char *sysw)
|
||||||
free(s);
|
free(s);
|
||||||
if (ignore_error)
|
if (ignore_error)
|
||||||
return 0;
|
return 0;
|
||||||
uc_error("unable to open '%s' for write", path);
|
snd_error(UCM, "unable to open '%s' for write", path);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
wlen = write(fd, value, len);
|
wlen = write(fd, value, len);
|
||||||
|
|
@ -585,7 +586,7 @@ static int execute_sysw(const char *sysw)
|
||||||
goto __end;
|
goto __end;
|
||||||
|
|
||||||
if (wlen != (ssize_t)len) {
|
if (wlen != (ssize_t)len) {
|
||||||
uc_error("unable to write '%s' to '%s': %s", value, path, strerror(myerrno));
|
snd_error(UCM, "unable to write '%s' to '%s': %s", value, path, strerror(myerrno));
|
||||||
free(s);
|
free(s);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
@ -619,14 +620,14 @@ static int execute_cfgsave(snd_use_case_mgr_t *uc_mgr, const char *filename)
|
||||||
}
|
}
|
||||||
err = snd_config_search(config, root, &config);
|
err = snd_config_search(config, root, &config);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("Unable to find subtree '%s'", root);
|
snd_error(UCM, "Unable to find subtree '%s'", root);
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = snd_output_stdio_open(&out, file, "w+");
|
err = snd_output_stdio_open(&out, file, "w+");
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("unable to open file '%s': %s", file, snd_strerror(err));
|
snd_error(UCM, "unable to open file '%s': %s", file, snd_strerror(err));
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
if (!config || snd_config_is_empty(config)) {
|
if (!config || snd_config_is_empty(config)) {
|
||||||
|
|
@ -641,7 +642,7 @@ static int execute_cfgsave(snd_use_case_mgr_t *uc_mgr, const char *filename)
|
||||||
}
|
}
|
||||||
snd_output_close(out);
|
snd_output_close(out);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("unable to save configuration: %s", snd_strerror(err));
|
snd_error(UCM, "unable to save configuration: %s", snd_strerror(err));
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
_err:
|
_err:
|
||||||
|
|
@ -691,13 +692,13 @@ static int run_device_sequence(snd_use_case_mgr_t *uc_mgr, struct use_case_verb
|
||||||
snd_trace(UCM, "device sequence '%s/%s': %s", verb->name, name, uc_mgr_enable_str(enable));
|
snd_trace(UCM, "device sequence '%s/%s': %s", verb->name, name, uc_mgr_enable_str(enable));
|
||||||
|
|
||||||
if (verb == NULL) {
|
if (verb == NULL) {
|
||||||
uc_error("error: enadev2 / disdev2 must be executed inside the verb context");
|
snd_error(UCM, "error: enadev2 / disdev2 must be executed inside the verb context");
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
device = find_device(uc_mgr, verb, name, 0);
|
device = find_device(uc_mgr, verb, name, 0);
|
||||||
if (device == NULL) {
|
if (device == NULL) {
|
||||||
uc_error("error: unable to find device '%s'\n", name);
|
snd_error(UCM, "error: unable to find device '%s'\n", name);
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -717,7 +718,7 @@ static int run_device_all_sequence(snd_use_case_mgr_t *uc_mgr, struct use_case_v
|
||||||
snd_trace(UCM, "disable all devices sequence for '%s'", verb->name);
|
snd_trace(UCM, "disable all devices sequence for '%s'", verb->name);
|
||||||
|
|
||||||
if (verb == NULL) {
|
if (verb == NULL) {
|
||||||
uc_error("error: disdevall must be executed inside the verb context");
|
snd_error(UCM, "error: disdevall must be executed inside the verb context");
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -757,7 +758,7 @@ static int execute_sequence(snd_use_case_mgr_t *uc_mgr,
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
if (uc_mgr->sequence_hops > 100) {
|
if (uc_mgr->sequence_hops > 100) {
|
||||||
uc_error("error: too many inner sequences!");
|
snd_error(UCM, "error: too many inner sequences!");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
uc_mgr->sequence_hops++;
|
uc_mgr->sequence_hops++;
|
||||||
|
|
@ -781,7 +782,7 @@ static int execute_sequence(snd_use_case_mgr_t *uc_mgr,
|
||||||
* its parent's cdev stored by ucm manager.
|
* its parent's cdev stored by ucm manager.
|
||||||
*/
|
*/
|
||||||
if (uc_mgr->cdev == NULL) {
|
if (uc_mgr->cdev == NULL) {
|
||||||
uc_error("cdev is not defined!");
|
snd_error(UCM, "cdev is not defined!");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -797,7 +798,7 @@ static int execute_sequence(snd_use_case_mgr_t *uc_mgr,
|
||||||
value_list2,
|
value_list2,
|
||||||
value_list3);
|
value_list3);
|
||||||
if (err < 0 && err != -ENOENT) {
|
if (err < 0 && err != -ENOENT) {
|
||||||
uc_error("cdev is not defined!");
|
snd_error(UCM, "cdev is not defined!");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
err = get_value3(uc_mgr, &capture_ctl, "CaptureCTL",
|
err = get_value3(uc_mgr, &capture_ctl, "CaptureCTL",
|
||||||
|
|
@ -806,12 +807,12 @@ static int execute_sequence(snd_use_case_mgr_t *uc_mgr,
|
||||||
value_list3);
|
value_list3);
|
||||||
if (err < 0 && err != -ENOENT) {
|
if (err < 0 && err != -ENOENT) {
|
||||||
free(playback_ctl);
|
free(playback_ctl);
|
||||||
uc_error("cdev is not defined!");
|
snd_error(UCM, "cdev is not defined!");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
if (playback_ctl == NULL &&
|
if (playback_ctl == NULL &&
|
||||||
capture_ctl == NULL) {
|
capture_ctl == NULL) {
|
||||||
uc_error("cdev is not defined!");
|
snd_error(UCM, "cdev is not defined!");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if (playback_ctl != NULL &&
|
if (playback_ctl != NULL &&
|
||||||
|
|
@ -819,7 +820,7 @@ static int execute_sequence(snd_use_case_mgr_t *uc_mgr,
|
||||||
strcmp(playback_ctl, capture_ctl) != 0) {
|
strcmp(playback_ctl, capture_ctl) != 0) {
|
||||||
free(playback_ctl);
|
free(playback_ctl);
|
||||||
free(capture_ctl);
|
free(capture_ctl);
|
||||||
uc_error("cdev is not equal for playback and capture!");
|
snd_error(UCM, "cdev is not equal for playback and capture!");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if (playback_ctl != NULL) {
|
if (playback_ctl != NULL) {
|
||||||
|
|
@ -832,14 +833,14 @@ static int execute_sequence(snd_use_case_mgr_t *uc_mgr,
|
||||||
if (ctl == NULL) {
|
if (ctl == NULL) {
|
||||||
err = uc_mgr_open_ctl(uc_mgr, &ctl_list, cdev, 1);
|
err = uc_mgr_open_ctl(uc_mgr, &ctl_list, cdev, 1);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("unable to open ctl device '%s'", cdev);
|
snd_error(UCM, "unable to open ctl device '%s'", cdev);
|
||||||
goto __fail;
|
goto __fail;
|
||||||
}
|
}
|
||||||
ctl = ctl_list->ctl;
|
ctl = ctl_list->ctl;
|
||||||
}
|
}
|
||||||
err = execute_cset(ctl, s->data.cset, s->type);
|
err = execute_cset(ctl, s->data.cset, s->type);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("unable to execute cset '%s'", s->data.cset);
|
snd_error(UCM, "unable to execute cset '%s'", s->data.cset);
|
||||||
goto __fail;
|
goto __fail;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -858,7 +859,7 @@ static int execute_sequence(snd_use_case_mgr_t *uc_mgr,
|
||||||
ignore_error = s->data.exec[0] == '-';
|
ignore_error = s->data.exec[0] == '-';
|
||||||
err = uc_mgr_exec(s->data.exec + (ignore_error ? 1 : 0));
|
err = uc_mgr_exec(s->data.exec + (ignore_error ? 1 : 0));
|
||||||
if (ignore_error == false && err != 0) {
|
if (ignore_error == false && err != 0) {
|
||||||
uc_error("exec '%s' failed (exit code %d)", s->data.exec, err);
|
snd_error(UCM, "exec '%s' failed (exit code %d)", s->data.exec, err);
|
||||||
goto __fail;
|
goto __fail;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -873,7 +874,7 @@ shell_retry:
|
||||||
err = -EINTR;
|
err = -EINTR;
|
||||||
} if (WIFEXITED(err)) {
|
} if (WIFEXITED(err)) {
|
||||||
if (ignore_error == false && WEXITSTATUS(err) != 0) {
|
if (ignore_error == false && WEXITSTATUS(err) != 0) {
|
||||||
uc_error("command '%s' failed (exit code %d)", s->data.exec, WEXITSTATUS(err));
|
snd_error(UCM, "command '%s' failed (exit code %d)", s->data.exec, WEXITSTATUS(err));
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
goto __fail;
|
goto __fail;
|
||||||
}
|
}
|
||||||
|
|
@ -915,7 +916,7 @@ shell_retry:
|
||||||
goto __fail;
|
goto __fail;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
uc_error("unknown sequence command %i", s->type);
|
snd_error(UCM, "unknown sequence command %i", s->type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1031,7 +1032,7 @@ static int set_defaults(snd_use_case_mgr_t *uc_mgr, bool force)
|
||||||
err = execute_sequence(uc_mgr, NULL, &uc_mgr->default_list,
|
err = execute_sequence(uc_mgr, NULL, &uc_mgr->default_list,
|
||||||
&uc_mgr->value_list, NULL, NULL);
|
&uc_mgr->value_list, NULL, NULL);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("Unable to execute default sequence");
|
snd_error(UCM, "Unable to execute default sequence");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
uc_mgr->default_list_executed = 1;
|
uc_mgr->default_list_executed = 1;
|
||||||
|
|
@ -1499,7 +1500,7 @@ const char *parse_open_variables(snd_use_case_mgr_t *uc_mgr, const char *name)
|
||||||
|
|
||||||
err = snd_config_load_string(&cfg, args, 0);
|
err = snd_config_load_string(&cfg, args, 0);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: open arguments are not valid (%s)", args);
|
snd_error(UCM, "error: open arguments are not valid (%s)", args);
|
||||||
goto skip;
|
goto skip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1572,14 +1573,15 @@ int snd_use_case_mgr_open(snd_use_case_mgr_t **uc_mgr,
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
if (err == -ENXIO && mgr->suppress_nodev_errors)
|
if (err == -ENXIO && mgr->suppress_nodev_errors)
|
||||||
goto _err;
|
goto _err;
|
||||||
uc_error("error: failed to import %s use case configuration %d",
|
snd_error(UCM, "error: failed to import %s use case configuration %d",
|
||||||
card_name, err);
|
card_name, err);
|
||||||
|
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = check_empty_configuration(mgr);
|
err = check_empty_configuration(mgr);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: failed to import %s (empty configuration)", card_name);
|
snd_error(UCM, "error: failed to import %s (empty configuration)", card_name);
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1611,7 +1613,7 @@ int snd_use_case_mgr_reload(snd_use_case_mgr_t *uc_mgr)
|
||||||
/* reload all use cases */
|
/* reload all use cases */
|
||||||
err = import_master_config(uc_mgr);
|
err = import_master_config(uc_mgr);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: failed to reload use cases");
|
snd_error(UCM, "error: failed to reload use cases");
|
||||||
pthread_mutex_unlock(&uc_mgr->mutex);
|
pthread_mutex_unlock(&uc_mgr->mutex);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
@ -1643,7 +1645,7 @@ static int dismantle_use_case(snd_use_case_mgr_t *uc_mgr)
|
||||||
active_list);
|
active_list);
|
||||||
err = set_modifier(uc_mgr, modifier, 0);
|
err = set_modifier(uc_mgr, modifier, 0);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
uc_error("Unable to disable modifier %s", modifier->name);
|
snd_error(UCM, "Unable to disable modifier %s", modifier->name);
|
||||||
}
|
}
|
||||||
INIT_LIST_HEAD(&uc_mgr->active_modifiers);
|
INIT_LIST_HEAD(&uc_mgr->active_modifiers);
|
||||||
|
|
||||||
|
|
@ -1652,13 +1654,13 @@ static int dismantle_use_case(snd_use_case_mgr_t *uc_mgr)
|
||||||
active_list);
|
active_list);
|
||||||
err = set_device(uc_mgr, device, 0);
|
err = set_device(uc_mgr, device, 0);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
uc_error("Unable to disable device %s", device->name);
|
snd_error(UCM, "Unable to disable device %s", device->name);
|
||||||
}
|
}
|
||||||
INIT_LIST_HEAD(&uc_mgr->active_devices);
|
INIT_LIST_HEAD(&uc_mgr->active_devices);
|
||||||
|
|
||||||
err = set_verb(uc_mgr, uc_mgr->active_verb, 0);
|
err = set_verb(uc_mgr, uc_mgr->active_verb, 0);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("Unable to disable verb %s", uc_mgr->active_verb->name);
|
snd_error(UCM, "Unable to disable verb %s", uc_mgr->active_verb->name);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
uc_mgr->active_verb = NULL;
|
uc_mgr->active_verb = NULL;
|
||||||
|
|
@ -2478,7 +2480,7 @@ static int set_fixedboot_user(snd_use_case_mgr_t *uc_mgr,
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (value != NULL && *value) {
|
if (value != NULL && *value) {
|
||||||
uc_error("error: wrong value for _fboot (%s)", value);
|
snd_error(UCM, "error: wrong value for _fboot (%s)", value);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if (list_empty(&uc_mgr->fixedboot_list))
|
if (list_empty(&uc_mgr->fixedboot_list))
|
||||||
|
|
@ -2486,7 +2488,7 @@ static int set_fixedboot_user(snd_use_case_mgr_t *uc_mgr,
|
||||||
err = execute_sequence(uc_mgr, NULL, &uc_mgr->fixedboot_list,
|
err = execute_sequence(uc_mgr, NULL, &uc_mgr->fixedboot_list,
|
||||||
&uc_mgr->value_list, NULL, NULL);
|
&uc_mgr->value_list, NULL, NULL);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("Unable to execute force boot sequence");
|
snd_error(UCM, "Unable to execute force boot sequence");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
return err;
|
return err;
|
||||||
|
|
@ -2498,7 +2500,7 @@ static int set_boot_user(snd_use_case_mgr_t *uc_mgr,
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (value != NULL && *value) {
|
if (value != NULL && *value) {
|
||||||
uc_error("error: wrong value for _boot (%s)", value);
|
snd_error(UCM, "error: wrong value for _boot (%s)", value);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if (list_empty(&uc_mgr->boot_list))
|
if (list_empty(&uc_mgr->boot_list))
|
||||||
|
|
@ -2506,7 +2508,7 @@ static int set_boot_user(snd_use_case_mgr_t *uc_mgr,
|
||||||
err = execute_sequence(uc_mgr, NULL, &uc_mgr->boot_list,
|
err = execute_sequence(uc_mgr, NULL, &uc_mgr->boot_list,
|
||||||
&uc_mgr->value_list, NULL, NULL);
|
&uc_mgr->value_list, NULL, NULL);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("Unable to execute boot sequence");
|
snd_error(UCM, "Unable to execute boot sequence");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
return err;
|
return err;
|
||||||
|
|
@ -2516,7 +2518,7 @@ static int set_defaults_user(snd_use_case_mgr_t *uc_mgr,
|
||||||
const char *value)
|
const char *value)
|
||||||
{
|
{
|
||||||
if (value != NULL && *value) {
|
if (value != NULL && *value) {
|
||||||
uc_error("error: wrong value for _defaults (%s)", value);
|
snd_error(UCM, "error: wrong value for _defaults (%s)", value);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
return set_defaults(uc_mgr, false);
|
return set_defaults(uc_mgr, false);
|
||||||
|
|
@ -2579,8 +2581,9 @@ static int set_verb_user(snd_use_case_mgr_t *uc_mgr,
|
||||||
if (verb) {
|
if (verb) {
|
||||||
err = set_verb(uc_mgr, verb, 1);
|
err = set_verb(uc_mgr, verb, 1);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
uc_error("error: failed to initialize new use case: %s",
|
snd_error(UCM, "error: failed to initialize new use case: %s",
|
||||||
verb_name);
|
verb_name);
|
||||||
|
|
||||||
}
|
}
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
@ -2631,11 +2634,11 @@ static int switch_device(snd_use_case_mgr_t *uc_mgr,
|
||||||
if (uc_mgr->active_verb == NULL)
|
if (uc_mgr->active_verb == NULL)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
if (device_status(uc_mgr, old_device) == 0) {
|
if (device_status(uc_mgr, old_device) == 0) {
|
||||||
uc_error("error: device %s not enabled", old_device);
|
snd_error(UCM, "error: device %s not enabled", old_device);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if (device_status(uc_mgr, new_device) != 0) {
|
if (device_status(uc_mgr, new_device) != 0) {
|
||||||
uc_error("error: device %s already enabled", new_device);
|
snd_error(UCM, "error: device %s already enabled", new_device);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
xold = find_device(uc_mgr, uc_mgr->active_verb, old_device, 1);
|
xold = find_device(uc_mgr, uc_mgr->active_verb, old_device, 1);
|
||||||
|
|
@ -2687,11 +2690,11 @@ static int switch_modifier(snd_use_case_mgr_t *uc_mgr,
|
||||||
if (uc_mgr->active_verb == NULL)
|
if (uc_mgr->active_verb == NULL)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
if (modifier_status(uc_mgr, old_modifier) == 0) {
|
if (modifier_status(uc_mgr, old_modifier) == 0) {
|
||||||
uc_error("error: modifier %s not enabled", old_modifier);
|
snd_error(UCM, "error: modifier %s not enabled", old_modifier);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if (modifier_status(uc_mgr, new_modifier) != 0) {
|
if (modifier_status(uc_mgr, new_modifier) != 0) {
|
||||||
uc_error("error: modifier %s already enabled", new_modifier);
|
snd_error(UCM, "error: modifier %s already enabled", new_modifier);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
xold = find_modifier(uc_mgr, uc_mgr->active_verb, old_modifier, 1);
|
xold = find_modifier(uc_mgr, uc_mgr->active_verb, old_modifier, 1);
|
||||||
|
|
|
||||||
266
src/ucm/parser.c
266
src/ucm/parser.c
|
|
@ -75,7 +75,7 @@ int uc_mgr_config_load_file(snd_use_case_mgr_t *uc_mgr,
|
||||||
file);
|
file);
|
||||||
err = uc_mgr_config_load(uc_mgr->conf_format, filename, cfg);
|
err = uc_mgr_config_load(uc_mgr->conf_format, filename, cfg);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: failed to open file %s: %d", filename, err);
|
snd_error(UCM, "error: failed to open file %s: %d", filename, err);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -187,7 +187,7 @@ static int parse_integer_substitute3(snd_use_case_mgr_t *uc_mgr,
|
||||||
static int parse_is_name_safe(const char *name)
|
static int parse_is_name_safe(const char *name)
|
||||||
{
|
{
|
||||||
if (strchr(name, '.')) {
|
if (strchr(name, '.')) {
|
||||||
uc_error("char '.' not allowed in '%s'", name);
|
snd_error(UCM, "char '.' not allowed in '%s'", name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -237,11 +237,11 @@ static int error_node(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg)
|
||||||
|
|
||||||
err = parse_string_substitute3(uc_mgr, cfg, &s);
|
err = parse_string_substitute3(uc_mgr, cfg, &s);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: failed to get Error string");
|
snd_error(UCM, "error: failed to get Error string");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
if (!uc_mgr->suppress_nodev_errors)
|
if (!uc_mgr->suppress_nodev_errors)
|
||||||
uc_error("%s", s);
|
snd_error(UCM, "%s", s);
|
||||||
free(s);
|
free(s);
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
}
|
}
|
||||||
|
|
@ -258,16 +258,16 @@ static int parse_syntax_field(snd_use_case_mgr_t *uc_mgr,
|
||||||
|
|
||||||
err = snd_config_search(cfg, "Syntax", &n);
|
err = snd_config_search(cfg, "Syntax", &n);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("Syntax field not found in %s", filename);
|
snd_error(UCM, "Syntax field not found in %s", filename);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
err = snd_config_get_integer(n, &l);
|
err = snd_config_get_integer(n, &l);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("Syntax field is invalid in %s", filename);
|
snd_error(UCM, "Syntax field is invalid in %s", filename);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
if (l < 2 || l > SYNTAX_VERSION_MAX) {
|
if (l < 2 || l > SYNTAX_VERSION_MAX) {
|
||||||
uc_error("Incompatible syntax %ld in %s", l, filename);
|
snd_error(UCM, "Incompatible syntax %ld in %s", l, filename);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
/* delete this field to optimize strcmp() call in the parsing loop */
|
/* delete this field to optimize strcmp() call in the parsing loop */
|
||||||
|
|
@ -294,12 +294,12 @@ static int evaluate_regex(snd_use_case_mgr_t *uc_mgr,
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
if (snd_config_get_type(d) != SND_CONFIG_TYPE_COMPOUND) {
|
if (snd_config_get_type(d) != SND_CONFIG_TYPE_COMPOUND) {
|
||||||
uc_error("compound type expected for DefineRegex");
|
snd_error(UCM, "compound type expected for DefineRegex");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uc_mgr->conf_format < 3) {
|
if (uc_mgr->conf_format < 3) {
|
||||||
uc_error("DefineRegex is supported in v3+ syntax");
|
snd_error(UCM, "DefineRegex is supported in v3+ syntax");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -309,7 +309,7 @@ static int evaluate_regex(snd_use_case_mgr_t *uc_mgr,
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
if (id[0] == '@') {
|
if (id[0] == '@') {
|
||||||
uc_error("error: value names starting with '@' are reserved for application variables");
|
snd_error(UCM, "error: value names starting with '@' are reserved for application variables");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
err = uc_mgr_define_regex(uc_mgr, id, n);
|
err = uc_mgr_define_regex(uc_mgr, id, n);
|
||||||
|
|
@ -340,12 +340,12 @@ static int evaluate_define(snd_use_case_mgr_t *uc_mgr,
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
if (snd_config_get_type(d) != SND_CONFIG_TYPE_COMPOUND) {
|
if (snd_config_get_type(d) != SND_CONFIG_TYPE_COMPOUND) {
|
||||||
uc_error("compound type expected for Define");
|
snd_error(UCM, "compound type expected for Define");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uc_mgr->conf_format < 3) {
|
if (uc_mgr->conf_format < 3) {
|
||||||
uc_error("Define is supported in v3+ syntax");
|
snd_error(UCM, "Define is supported in v3+ syntax");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -363,7 +363,7 @@ static int evaluate_define(snd_use_case_mgr_t *uc_mgr,
|
||||||
return err;
|
return err;
|
||||||
if (id[0] == '@') {
|
if (id[0] == '@') {
|
||||||
free(s);
|
free(s);
|
||||||
uc_error("error: value names starting with '@' are reserved for application variables");
|
snd_error(UCM, "error: value names starting with '@' are reserved for application variables");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
err = uc_mgr_set_variable(uc_mgr, id, s);
|
err = uc_mgr_set_variable(uc_mgr, id, s);
|
||||||
|
|
@ -393,12 +393,12 @@ static int evaluate_define_macro(snd_use_case_mgr_t *uc_mgr,
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
if (snd_config_get_type(d) != SND_CONFIG_TYPE_COMPOUND) {
|
if (snd_config_get_type(d) != SND_CONFIG_TYPE_COMPOUND) {
|
||||||
uc_error("compound type expected for DefineMacro");
|
snd_error(UCM, "compound type expected for DefineMacro");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uc_mgr->conf_format < 6) {
|
if (uc_mgr->conf_format < 6) {
|
||||||
uc_error("DefineMacro is supported in v6+ syntax");
|
snd_error(UCM, "DefineMacro is supported in v6+ syntax");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -424,7 +424,7 @@ static int evaluate_macro1(snd_use_case_mgr_t *uc_mgr,
|
||||||
return err;
|
return err;
|
||||||
err = snd_config_search(uc_mgr->macros, mid, &m);
|
err = snd_config_search(uc_mgr->macros, mid, &m);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("Macro '%s' is not defined", mid);
|
snd_error(UCM, "Macro '%s' is not defined", mid);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -448,7 +448,7 @@ static int evaluate_macro1(snd_use_case_mgr_t *uc_mgr,
|
||||||
goto __err_path;
|
goto __err_path;
|
||||||
snprintf(name, sizeof(name), "__%s", id);
|
snprintf(name, sizeof(name), "__%s", id);
|
||||||
if (uc_mgr_get_variable(uc_mgr, name)) {
|
if (uc_mgr_get_variable(uc_mgr, name)) {
|
||||||
uc_error("Macro argument '%s' is already defined", name);
|
snd_error(UCM, "Macro argument '%s' is already defined", name);
|
||||||
goto __err_path;
|
goto __err_path;
|
||||||
}
|
}
|
||||||
err = snd_config_get_ascii(n, &var);
|
err = snd_config_get_ascii(n, &var);
|
||||||
|
|
@ -520,12 +520,12 @@ static int evaluate_macro(snd_use_case_mgr_t *uc_mgr,
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
if (snd_config_get_type(d) != SND_CONFIG_TYPE_COMPOUND) {
|
if (snd_config_get_type(d) != SND_CONFIG_TYPE_COMPOUND) {
|
||||||
uc_error("compound type expected for DefineMacro");
|
snd_error(UCM, "compound type expected for DefineMacro");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uc_mgr->conf_format < 6) {
|
if (uc_mgr->conf_format < 6) {
|
||||||
uc_error("Macro is supported in v6+ syntax");
|
snd_error(UCM, "Macro is supported in v6+ syntax");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -535,7 +535,7 @@ static int evaluate_macro(snd_use_case_mgr_t *uc_mgr,
|
||||||
const char *id;
|
const char *id;
|
||||||
if (snd_config_get_id(n, &id))
|
if (snd_config_get_id(n, &id))
|
||||||
id = "";
|
id = "";
|
||||||
uc_error("compound type expected for Macro.%s", id);
|
snd_error(UCM, "compound type expected for Macro.%s", id);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
snd_config_for_each(i2, next2, n) {
|
snd_config_for_each(i2, next2, n) {
|
||||||
|
|
@ -607,7 +607,7 @@ static int evaluate_variant(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
if (uc_mgr->conf_format < 6) {
|
if (uc_mgr->conf_format < 6) {
|
||||||
uc_error("Variant is supported in v6+ syntax");
|
snd_error(UCM, "Variant is supported in v6+ syntax");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -653,7 +653,7 @@ int uc_mgr_evaluate_inplace(snd_use_case_mgr_t *uc_mgr,
|
||||||
|
|
||||||
while (err1 == 0 || err2 == 0 || err3 == 0 || err4 == 0 || err5 == 0) {
|
while (err1 == 0 || err2 == 0 || err3 == 0 || err4 == 0 || err5 == 0) {
|
||||||
if (iterations == 0) {
|
if (iterations == 0) {
|
||||||
uc_error("Maximal inplace evaluation iterations number reached (recursive references?)");
|
snd_error(UCM, "Maximal inplace evaluation iterations number reached (recursive references?)");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
iterations--;
|
iterations--;
|
||||||
|
|
@ -676,7 +676,7 @@ int uc_mgr_evaluate_inplace(snd_use_case_mgr_t *uc_mgr,
|
||||||
continue;
|
continue;
|
||||||
uc_mgr->macro_hops++;
|
uc_mgr->macro_hops++;
|
||||||
if (uc_mgr->macro_hops > 100) {
|
if (uc_mgr->macro_hops > 100) {
|
||||||
uc_error("Maximal macro hops reached!");
|
snd_error(UCM, "Maximal macro hops reached!");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
err4 = evaluate_macro(uc_mgr, cfg);
|
err4 = evaluate_macro(uc_mgr, cfg);
|
||||||
|
|
@ -707,7 +707,7 @@ static int parse_libconfig1(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
|
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
|
||||||
uc_error("compound type expected for %s", id);
|
snd_error(UCM, "compound type expected for %s", id);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -735,7 +735,7 @@ static int parse_libconfig1(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
uc_error("unknown field %s", id);
|
snd_error(UCM, "unknown field %s", id);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -795,7 +795,7 @@ static int parse_libconfig(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
|
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
|
||||||
uc_error("compound type expected for %s", id);
|
snd_error(UCM, "compound type expected for %s", id);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -827,7 +827,7 @@ static int parse_transition(snd_use_case_mgr_t *uc_mgr,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
|
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
|
||||||
uc_error("compound type expected for %s", id);
|
snd_error(UCM, "compound type expected for %s", id);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -875,7 +875,7 @@ static int parse_compound(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
|
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
|
||||||
uc_error("compound type expected for %s", id);
|
snd_error(UCM, "compound type expected for %s", id);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
/* parse compound */
|
/* parse compound */
|
||||||
|
|
@ -883,7 +883,7 @@ static int parse_compound(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg,
|
||||||
n = snd_config_iterator_entry(i);
|
n = snd_config_iterator_entry(i);
|
||||||
|
|
||||||
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
|
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
|
||||||
uc_error("compound type expected for %s, is %d", id, snd_config_get_type(cfg));
|
snd_error(UCM, "compound type expected for %s, is %d", id, snd_config_get_type(cfg));
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -901,8 +901,9 @@ static int strip_legacy_dev_index(char *name)
|
||||||
if (!dot)
|
if (!dot)
|
||||||
return 0;
|
return 0;
|
||||||
if (dot[1] != '0' || dot[2] != '\0') {
|
if (dot[1] != '0' || dot[2] != '\0') {
|
||||||
uc_error("device name %s contains a '.',"
|
snd_error(UCM, "device name %s contains a '.',"
|
||||||
" and is not legacy foo.0 format", name);
|
" and is not legacy foo.0 format", name);
|
||||||
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
*dot = '\0';
|
*dot = '\0';
|
||||||
|
|
@ -924,8 +925,9 @@ static int parse_device_list(snd_use_case_mgr_t *uc_mgr ATTRIBUTE_UNUSED,
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (dev_list->type != DEVLIST_NONE) {
|
if (dev_list->type != DEVLIST_NONE) {
|
||||||
uc_error("error: multiple supported or"
|
snd_error(UCM, "error: multiple supported or"
|
||||||
" conflicting device lists");
|
" conflicting device lists");
|
||||||
|
|
||||||
return -EEXIST;
|
return -EEXIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -933,7 +935,7 @@ static int parse_device_list(snd_use_case_mgr_t *uc_mgr ATTRIBUTE_UNUSED,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
|
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
|
||||||
uc_error("compound type expected for %s", id);
|
snd_error(UCM, "compound type expected for %s", id);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1031,7 +1033,7 @@ static int parse_component_seq(snd_use_case_mgr_t *uc_mgr,
|
||||||
|
|
||||||
cmpt_seq->device = find_component_dev(uc_mgr, val);
|
cmpt_seq->device = find_component_dev(uc_mgr, val);
|
||||||
if (!cmpt_seq->device) {
|
if (!cmpt_seq->device) {
|
||||||
uc_error("error: Cannot find component device %s", val);
|
snd_error(UCM, "error: Cannot find component device %s", val);
|
||||||
free(val);
|
free(val);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
@ -1072,7 +1074,7 @@ static int parse_sequence(snd_use_case_mgr_t *uc_mgr,
|
||||||
const char *cmd = NULL;
|
const char *cmd = NULL;
|
||||||
|
|
||||||
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
|
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
|
||||||
uc_error("error: compound is expected for sequence definition");
|
snd_error(UCM, "error: compound is expected for sequence definition");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1085,7 +1087,7 @@ static int parse_sequence(snd_use_case_mgr_t *uc_mgr,
|
||||||
continue;
|
continue;
|
||||||
if (idx == 1) {
|
if (idx == 1) {
|
||||||
if (snd_config_get_type(n) != SND_CONFIG_TYPE_STRING) {
|
if (snd_config_get_type(n) != SND_CONFIG_TYPE_STRING) {
|
||||||
uc_error("error: string type is expected for sequence command");
|
snd_error(UCM, "error: string type is expected for sequence command");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
snd_config_get_string(n, &cmd);
|
snd_config_get_string(n, &cmd);
|
||||||
|
|
@ -1102,7 +1104,7 @@ static int parse_sequence(snd_use_case_mgr_t *uc_mgr,
|
||||||
curr->type = SEQUENCE_ELEMENT_TYPE_CDEV;
|
curr->type = SEQUENCE_ELEMENT_TYPE_CDEV;
|
||||||
err = parse_string_substitute3(uc_mgr, n, &curr->data.cdev);
|
err = parse_string_substitute3(uc_mgr, n, &curr->data.cdev);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: cdev requires a string!");
|
snd_error(UCM, "error: cdev requires a string!");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1113,7 +1115,7 @@ static int parse_sequence(snd_use_case_mgr_t *uc_mgr,
|
||||||
cset:
|
cset:
|
||||||
err = parse_string_substitute3(uc_mgr, n, &curr->data.cset);
|
err = parse_string_substitute3(uc_mgr, n, &curr->data.cset);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: %s requires a string!", cmd);
|
snd_error(UCM, "error: %s requires a string!", cmd);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1127,7 +1129,7 @@ cset:
|
||||||
strcmp(cmd, "enadev") == 0,
|
strcmp(cmd, "enadev") == 0,
|
||||||
&curr->data.cmpt_seq);
|
&curr->data.cmpt_seq);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: %s requires a valid device!", cmd);
|
snd_error(UCM, "error: %s requires a valid device!", cmd);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1143,7 +1145,7 @@ cset:
|
||||||
device:
|
device:
|
||||||
err = parse_string_substitute3(uc_mgr, n, &curr->data.device);
|
err = parse_string_substitute3(uc_mgr, n, &curr->data.device);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: %s requires a valid device!", cmd);
|
snd_error(UCM, "error: %s requires a valid device!", cmd);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1178,7 +1180,7 @@ device:
|
||||||
curr->type = SEQUENCE_ELEMENT_TYPE_SYSSET;
|
curr->type = SEQUENCE_ELEMENT_TYPE_SYSSET;
|
||||||
err = parse_string_substitute3(uc_mgr, n, &curr->data.sysw);
|
err = parse_string_substitute3(uc_mgr, n, &curr->data.sysw);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: sysw requires a string!");
|
snd_error(UCM, "error: sysw requires a string!");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1188,7 +1190,7 @@ device:
|
||||||
curr->type = SEQUENCE_ELEMENT_TYPE_SLEEP;
|
curr->type = SEQUENCE_ELEMENT_TYPE_SLEEP;
|
||||||
err = parse_integer_substitute3(uc_mgr, n, &curr->data.sleep);
|
err = parse_integer_substitute3(uc_mgr, n, &curr->data.sleep);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: usleep requires integer!");
|
snd_error(UCM, "error: usleep requires integer!");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1198,7 +1200,7 @@ device:
|
||||||
curr->type = SEQUENCE_ELEMENT_TYPE_SLEEP;
|
curr->type = SEQUENCE_ELEMENT_TYPE_SLEEP;
|
||||||
err = parse_integer_substitute3(uc_mgr, n, &curr->data.sleep);
|
err = parse_integer_substitute3(uc_mgr, n, &curr->data.sleep);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: msleep requires integer!");
|
snd_error(UCM, "error: msleep requires integer!");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
curr->data.sleep *= 1000L;
|
curr->data.sleep *= 1000L;
|
||||||
|
|
@ -1210,7 +1212,7 @@ device:
|
||||||
exec:
|
exec:
|
||||||
err = parse_string_substitute3(uc_mgr, n, &curr->data.exec);
|
err = parse_string_substitute3(uc_mgr, n, &curr->data.exec);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: exec requires a string!");
|
snd_error(UCM, "error: exec requires a string!");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1225,7 +1227,7 @@ exec:
|
||||||
curr->type = SEQUENCE_ELEMENT_TYPE_CFGSAVE;
|
curr->type = SEQUENCE_ELEMENT_TYPE_CFGSAVE;
|
||||||
err = parse_string_substitute3(uc_mgr, n, &curr->data.cfgsave);
|
err = parse_string_substitute3(uc_mgr, n, &curr->data.cfgsave);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: sysw requires a string!");
|
snd_error(UCM, "error: sysw requires a string!");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1234,7 +1236,7 @@ exec:
|
||||||
if (strcmp(cmd, "comment") == 0)
|
if (strcmp(cmd, "comment") == 0)
|
||||||
goto skip;
|
goto skip;
|
||||||
|
|
||||||
uc_error("error: sequence command '%s' is ignored", cmd);
|
snd_error(UCM, "error: sequence command '%s' is ignored", cmd);
|
||||||
|
|
||||||
skip:
|
skip:
|
||||||
list_del(&curr->list);
|
list_del(&curr->list);
|
||||||
|
|
@ -1287,7 +1289,7 @@ static int parse_value(snd_use_case_mgr_t *uc_mgr ATTRIBUTE_UNUSED,
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
|
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
|
||||||
uc_error("error: compound is expected for value definition");
|
snd_error(UCM, "error: compound is expected for value definition");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1310,19 +1312,19 @@ static int parse_value(snd_use_case_mgr_t *uc_mgr ATTRIBUTE_UNUSED,
|
||||||
case SND_CONFIG_TYPE_REAL:
|
case SND_CONFIG_TYPE_REAL:
|
||||||
err = snd_config_get_ascii(n, &s);
|
err = snd_config_get_ascii(n, &s);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: unable to parse value for id '%s': %s!", id, snd_strerror(err));
|
snd_error(UCM, "error: unable to parse value for id '%s': %s!", id, snd_strerror(err));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SND_CONFIG_TYPE_STRING:
|
case SND_CONFIG_TYPE_STRING:
|
||||||
err = parse_string_substitute(uc_mgr, n, &s);
|
err = parse_string_substitute(uc_mgr, n, &s);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: unable to parse a string for id '%s'!", id);
|
snd_error(UCM, "error: unable to parse a string for id '%s'!", id);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
uc_error("error: invalid type %i in Value compound '%s'", type, id);
|
snd_error(UCM, "error: invalid type %i in Value compound '%s'", type, id);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
err = uc_mgr_add_value(base, id, s);
|
err = uc_mgr_add_value(base, id, s);
|
||||||
|
|
@ -1419,7 +1421,7 @@ static int parse_modifier(snd_use_case_mgr_t *uc_mgr,
|
||||||
if (strcmp(id, "Comment") == 0) {
|
if (strcmp(id, "Comment") == 0) {
|
||||||
err = parse_string_substitute3(uc_mgr, n, &modifier->comment);
|
err = parse_string_substitute3(uc_mgr, n, &modifier->comment);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: failed to get modifier comment");
|
snd_error(UCM, "error: failed to get modifier comment");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1429,8 +1431,9 @@ static int parse_modifier(snd_use_case_mgr_t *uc_mgr,
|
||||||
err = parse_device_list(uc_mgr, &modifier->dev_list,
|
err = parse_device_list(uc_mgr, &modifier->dev_list,
|
||||||
DEVLIST_SUPPORTED, n);
|
DEVLIST_SUPPORTED, n);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: failed to parse supported"
|
snd_error(UCM, "error: failed to parse supported"
|
||||||
" device list");
|
" device list");
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1439,8 +1442,9 @@ static int parse_modifier(snd_use_case_mgr_t *uc_mgr,
|
||||||
err = parse_device_list(uc_mgr, &modifier->dev_list,
|
err = parse_device_list(uc_mgr, &modifier->dev_list,
|
||||||
DEVLIST_CONFLICTING, n);
|
DEVLIST_CONFLICTING, n);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: failed to parse conflicting"
|
snd_error(UCM, "error: failed to parse conflicting"
|
||||||
" device list");
|
" device list");
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1448,8 +1452,9 @@ static int parse_modifier(snd_use_case_mgr_t *uc_mgr,
|
||||||
if (strcmp(id, "EnableSequence") == 0) {
|
if (strcmp(id, "EnableSequence") == 0) {
|
||||||
err = parse_sequence(uc_mgr, &modifier->enable_list, n);
|
err = parse_sequence(uc_mgr, &modifier->enable_list, n);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: failed to parse modifier"
|
snd_error(UCM, "error: failed to parse modifier"
|
||||||
" enable sequence");
|
" enable sequence");
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1458,8 +1463,9 @@ static int parse_modifier(snd_use_case_mgr_t *uc_mgr,
|
||||||
if (strcmp(id, "DisableSequence") == 0) {
|
if (strcmp(id, "DisableSequence") == 0) {
|
||||||
err = parse_sequence(uc_mgr, &modifier->disable_list, n);
|
err = parse_sequence(uc_mgr, &modifier->disable_list, n);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: failed to parse modifier"
|
snd_error(UCM, "error: failed to parse modifier"
|
||||||
" disable sequence");
|
" disable sequence");
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1468,8 +1474,9 @@ static int parse_modifier(snd_use_case_mgr_t *uc_mgr,
|
||||||
if (strcmp(id, "TransitionSequence") == 0) {
|
if (strcmp(id, "TransitionSequence") == 0) {
|
||||||
err = parse_transition(uc_mgr, &modifier->transition_list, n);
|
err = parse_transition(uc_mgr, &modifier->transition_list, n);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: failed to parse transition"
|
snd_error(UCM, "error: failed to parse transition"
|
||||||
" modifier");
|
" modifier");
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1478,7 +1485,7 @@ static int parse_modifier(snd_use_case_mgr_t *uc_mgr,
|
||||||
if (strcmp(id, "Value") == 0) {
|
if (strcmp(id, "Value") == 0) {
|
||||||
err = parse_value(uc_mgr, &modifier->value_list, n);
|
err = parse_value(uc_mgr, &modifier->value_list, n);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: failed to parse Value");
|
snd_error(UCM, "error: failed to parse Value");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1564,7 +1571,7 @@ static int parse_device(snd_use_case_mgr_t *uc_mgr,
|
||||||
if (strcmp(id, "Comment") == 0) {
|
if (strcmp(id, "Comment") == 0) {
|
||||||
err = parse_string_substitute3(uc_mgr, n, &device->comment);
|
err = parse_string_substitute3(uc_mgr, n, &device->comment);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: failed to get device comment");
|
snd_error(UCM, "error: failed to get device comment");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1574,8 +1581,9 @@ static int parse_device(snd_use_case_mgr_t *uc_mgr,
|
||||||
err = parse_device_list(uc_mgr, &device->dev_list,
|
err = parse_device_list(uc_mgr, &device->dev_list,
|
||||||
DEVLIST_SUPPORTED, n);
|
DEVLIST_SUPPORTED, n);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: failed to parse supported"
|
snd_error(UCM, "error: failed to parse supported"
|
||||||
" device list");
|
" device list");
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1584,8 +1592,9 @@ static int parse_device(snd_use_case_mgr_t *uc_mgr,
|
||||||
err = parse_device_list(uc_mgr, &device->dev_list,
|
err = parse_device_list(uc_mgr, &device->dev_list,
|
||||||
DEVLIST_CONFLICTING, n);
|
DEVLIST_CONFLICTING, n);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: failed to parse conflicting"
|
snd_error(UCM, "error: failed to parse conflicting"
|
||||||
" device list");
|
" device list");
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1594,8 +1603,9 @@ static int parse_device(snd_use_case_mgr_t *uc_mgr,
|
||||||
uc_dbg("EnableSequence");
|
uc_dbg("EnableSequence");
|
||||||
err = parse_sequence(uc_mgr, &device->enable_list, n);
|
err = parse_sequence(uc_mgr, &device->enable_list, n);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: failed to parse device enable"
|
snd_error(UCM, "error: failed to parse device enable"
|
||||||
" sequence");
|
" sequence");
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1605,8 +1615,9 @@ static int parse_device(snd_use_case_mgr_t *uc_mgr,
|
||||||
uc_dbg("DisableSequence");
|
uc_dbg("DisableSequence");
|
||||||
err = parse_sequence(uc_mgr, &device->disable_list, n);
|
err = parse_sequence(uc_mgr, &device->disable_list, n);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: failed to parse device disable"
|
snd_error(UCM, "error: failed to parse device disable"
|
||||||
" sequence");
|
" sequence");
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1616,8 +1627,9 @@ static int parse_device(snd_use_case_mgr_t *uc_mgr,
|
||||||
uc_dbg("TransitionSequence");
|
uc_dbg("TransitionSequence");
|
||||||
err = parse_transition(uc_mgr, &device->transition_list, n);
|
err = parse_transition(uc_mgr, &device->transition_list, n);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: failed to parse transition"
|
snd_error(UCM, "error: failed to parse transition"
|
||||||
" device");
|
" device");
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1626,7 +1638,7 @@ static int parse_device(snd_use_case_mgr_t *uc_mgr,
|
||||||
if (strcmp(id, "Value") == 0) {
|
if (strcmp(id, "Value") == 0) {
|
||||||
err = parse_value(uc_mgr, &device->value_list, n);
|
err = parse_value(uc_mgr, &device->value_list, n);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: failed to parse Value");
|
snd_error(UCM, "error: failed to parse Value");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1660,7 +1672,7 @@ static int parse_dev_name_list(snd_use_case_mgr_t *uc_mgr,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
|
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
|
||||||
uc_error("compound type expected for %s", id);
|
snd_error(UCM, "compound type expected for %s", id);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1677,7 +1689,7 @@ static int parse_dev_name_list(snd_use_case_mgr_t *uc_mgr,
|
||||||
err = parse_string_substitute3(uc_mgr, n, &name2);
|
err = parse_string_substitute3(uc_mgr, n, &name2);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
free(name1s);
|
free(name1s);
|
||||||
uc_error("error: failed to get target device name for '%s'", name1);
|
snd_error(UCM, "error: failed to get target device name for '%s'", name1);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1789,14 +1801,15 @@ static int verb_dev_list_add(struct use_case_verb *verb,
|
||||||
if (list_empty(&device->dev_list.list)) {
|
if (list_empty(&device->dev_list.list)) {
|
||||||
device->dev_list.type = dst_type;
|
device->dev_list.type = dst_type;
|
||||||
} else {
|
} else {
|
||||||
uc_error("error: incompatible device list type ('%s', '%s')",
|
snd_error(UCM, "error: incompatible device list type ('%s', '%s')",
|
||||||
device->name, src);
|
device->name, src);
|
||||||
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return uc_mgr_put_to_dev_list(&device->dev_list, src);
|
return uc_mgr_put_to_dev_list(&device->dev_list, src);
|
||||||
}
|
}
|
||||||
uc_error("error: unable to find device '%s'", dst);
|
snd_error(UCM, "error: unable to find device '%s'", dst);
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1831,7 +1844,7 @@ static int verb_device_management(struct use_case_verb *verb)
|
||||||
dev = list_entry(pos, struct ucm_dev_name, list);
|
dev = list_entry(pos, struct ucm_dev_name, list);
|
||||||
err = uc_mgr_rename_device(verb, dev->name1, dev->name2);
|
err = uc_mgr_rename_device(verb, dev->name1, dev->name2);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: cannot rename device '%s' to '%s'", dev->name1, dev->name2);
|
snd_error(UCM, "error: cannot rename device '%s' to '%s'", dev->name1, dev->name2);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1841,7 +1854,7 @@ static int verb_device_management(struct use_case_verb *verb)
|
||||||
dev = list_entry(pos, struct ucm_dev_name, list);
|
dev = list_entry(pos, struct ucm_dev_name, list);
|
||||||
err = uc_mgr_remove_device(verb, dev->name2);
|
err = uc_mgr_remove_device(verb, dev->name2);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: cannot remove device '%s'", dev->name2);
|
snd_error(UCM, "error: cannot remove device '%s'", dev->name2);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1915,7 +1928,7 @@ static int parse_verb(snd_use_case_mgr_t *uc_mgr,
|
||||||
uc_dbg("Parse EnableSequence");
|
uc_dbg("Parse EnableSequence");
|
||||||
err = parse_sequence(uc_mgr, &verb->enable_list, n);
|
err = parse_sequence(uc_mgr, &verb->enable_list, n);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: failed to parse verb enable sequence");
|
snd_error(UCM, "error: failed to parse verb enable sequence");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1925,7 +1938,7 @@ static int parse_verb(snd_use_case_mgr_t *uc_mgr,
|
||||||
uc_dbg("Parse DisableSequence");
|
uc_dbg("Parse DisableSequence");
|
||||||
err = parse_sequence(uc_mgr, &verb->disable_list, n);
|
err = parse_sequence(uc_mgr, &verb->disable_list, n);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: failed to parse verb disable sequence");
|
snd_error(UCM, "error: failed to parse verb disable sequence");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1935,7 +1948,7 @@ static int parse_verb(snd_use_case_mgr_t *uc_mgr,
|
||||||
uc_dbg("Parse TransitionSequence");
|
uc_dbg("Parse TransitionSequence");
|
||||||
err = parse_transition(uc_mgr, &verb->transition_list, n);
|
err = parse_transition(uc_mgr, &verb->transition_list, n);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: failed to parse transition sequence");
|
snd_error(UCM, "error: failed to parse transition sequence");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -2022,8 +2035,9 @@ static int parse_verb_file(snd_use_case_mgr_t *uc_mgr,
|
||||||
if (strcmp(id, "SectionVerb") == 0) {
|
if (strcmp(id, "SectionVerb") == 0) {
|
||||||
err = parse_verb(uc_mgr, verb, n);
|
err = parse_verb(uc_mgr, verb, n);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: %s failed to parse verb",
|
snd_error(UCM, "error: %s failed to parse verb",
|
||||||
file);
|
file);
|
||||||
|
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -2034,8 +2048,9 @@ static int parse_verb_file(snd_use_case_mgr_t *uc_mgr,
|
||||||
err = parse_compound(uc_mgr, n,
|
err = parse_compound(uc_mgr, n,
|
||||||
parse_device_name, verb, NULL);
|
parse_device_name, verb, NULL);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: %s failed to parse device",
|
snd_error(UCM, "error: %s failed to parse device",
|
||||||
file);
|
file);
|
||||||
|
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -2046,8 +2061,9 @@ static int parse_verb_file(snd_use_case_mgr_t *uc_mgr,
|
||||||
err = parse_compound(uc_mgr, n,
|
err = parse_compound(uc_mgr, n,
|
||||||
parse_modifier_name, verb, NULL);
|
parse_modifier_name, verb, NULL);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: %s failed to parse modifier",
|
snd_error(UCM, "error: %s failed to parse modifier",
|
||||||
file);
|
file);
|
||||||
|
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -2057,8 +2073,9 @@ static int parse_verb_file(snd_use_case_mgr_t *uc_mgr,
|
||||||
if (strcmp(id, "RenameDevice") == 0) {
|
if (strcmp(id, "RenameDevice") == 0) {
|
||||||
err = parse_dev_name_list(uc_mgr, n, &verb->rename_list);
|
err = parse_dev_name_list(uc_mgr, n, &verb->rename_list);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: %s failed to parse device rename",
|
snd_error(UCM, "error: %s failed to parse device rename",
|
||||||
file);
|
file);
|
||||||
|
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -2068,8 +2085,9 @@ static int parse_verb_file(snd_use_case_mgr_t *uc_mgr,
|
||||||
if (strcmp(id, "RemoveDevice") == 0) {
|
if (strcmp(id, "RemoveDevice") == 0) {
|
||||||
err = parse_dev_name_list(uc_mgr, n, &verb->remove_list);
|
err = parse_dev_name_list(uc_mgr, n, &verb->remove_list);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: %s failed to parse device remove",
|
snd_error(UCM, "error: %s failed to parse device remove",
|
||||||
file);
|
file);
|
||||||
|
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -2079,7 +2097,7 @@ static int parse_verb_file(snd_use_case_mgr_t *uc_mgr,
|
||||||
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);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: failed to parse LibConfig");
|
snd_error(UCM, "error: failed to parse LibConfig");
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -2090,14 +2108,14 @@ static int parse_verb_file(snd_use_case_mgr_t *uc_mgr,
|
||||||
|
|
||||||
/* use case verb must have at least 1 device */
|
/* use case verb must have at least 1 device */
|
||||||
if (list_empty(&verb->device_list)) {
|
if (list_empty(&verb->device_list)) {
|
||||||
uc_error("error: no use case device defined", file);
|
snd_error(UCM, "error: no use case device defined", file);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* do device rename and delete */
|
/* do device rename and delete */
|
||||||
err = verb_device_management(verb);
|
err = verb_device_management(verb);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: device management error in verb '%s'", verb->name);
|
snd_error(UCM, "error: device management error in verb '%s'", verb->name);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2131,7 +2149,7 @@ static int parse_variant(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg,
|
||||||
if (_vfile) {
|
if (_vfile) {
|
||||||
err = parse_string_substitute3(uc_mgr, n, &file);
|
err = parse_string_substitute3(uc_mgr, n, &file);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("failed to get File");
|
snd_error(UCM, "failed to get File");
|
||||||
goto __error;
|
goto __error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2143,14 +2161,14 @@ static int parse_variant(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg,
|
||||||
if (_vcomment) {
|
if (_vcomment) {
|
||||||
err = parse_string_substitute3(uc_mgr, n, &comment);
|
err = parse_string_substitute3(uc_mgr, n, &comment);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: failed to get Comment");
|
snd_error(UCM, "error: failed to get Comment");
|
||||||
goto __error;
|
goto __error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
uc_error("unknown field '%s' in Variant section", id);
|
snd_error(UCM, "unknown field '%s' in Variant section", id);
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
goto __error;
|
goto __error;
|
||||||
}
|
}
|
||||||
|
|
@ -2181,13 +2199,13 @@ static int parse_master_section(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg,
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
|
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
|
||||||
uc_error("compound type expected for use case section");
|
snd_error(UCM, "compound type expected for use case section");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = parse_get_safe_name(uc_mgr, cfg, NULL, &use_case_name);
|
err = parse_get_safe_name(uc_mgr, cfg, NULL, &use_case_name);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("unable to get name for use case section");
|
snd_error(UCM, "unable to get name for use case section");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2209,7 +2227,7 @@ static int parse_master_section(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg,
|
||||||
if (strcmp(id, "File") == 0) {
|
if (strcmp(id, "File") == 0) {
|
||||||
err = parse_string_substitute3(uc_mgr, n, &file);
|
err = parse_string_substitute3(uc_mgr, n, &file);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("failed to get File");
|
snd_error(UCM, "failed to get File");
|
||||||
goto __error;
|
goto __error;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -2219,7 +2237,7 @@ static int parse_master_section(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg,
|
||||||
if (strncmp(id, "Comment", 7) == 0) {
|
if (strncmp(id, "Comment", 7) == 0) {
|
||||||
err = parse_string_substitute3(uc_mgr, n, &comment);
|
err = parse_string_substitute3(uc_mgr, n, &comment);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: failed to get Comment");
|
snd_error(UCM, "error: failed to get Comment");
|
||||||
goto __error;
|
goto __error;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -2243,11 +2261,11 @@ static int parse_master_section(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
uc_error("unknown field '%s' in SectionUseCase", id);
|
snd_error(UCM, "unknown field '%s' in SectionUseCase", id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (variant && !variant_ok) {
|
if (variant && !variant_ok) {
|
||||||
uc_error("error: undefined variant '%s'", use_case_name);
|
snd_error(UCM, "error: undefined variant '%s'", use_case_name);
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
goto __error;
|
goto __error;
|
||||||
}
|
}
|
||||||
|
|
@ -2257,7 +2275,7 @@ static int parse_master_section(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg,
|
||||||
|
|
||||||
/* do we have both use case name and file ? */
|
/* do we have both use case name and file ? */
|
||||||
if (!file) {
|
if (!file) {
|
||||||
uc_error("error: use case missing file");
|
snd_error(UCM, "error: use case missing file");
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
goto __error;
|
goto __error;
|
||||||
}
|
}
|
||||||
|
|
@ -2304,12 +2322,12 @@ static int parse_controls_fixedboot(snd_use_case_mgr_t *uc_mgr, snd_config_t *cf
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (!list_empty(&uc_mgr->fixedboot_list)) {
|
if (!list_empty(&uc_mgr->fixedboot_list)) {
|
||||||
uc_error("FixedBoot list is not empty");
|
snd_error(UCM, "FixedBoot list is not empty");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
err = parse_sequence(uc_mgr, &uc_mgr->fixedboot_list, cfg);
|
err = parse_sequence(uc_mgr, &uc_mgr->fixedboot_list, cfg);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("Unable to parse FixedBootSequence");
|
snd_error(UCM, "Unable to parse FixedBootSequence");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2324,12 +2342,12 @@ static int parse_controls_boot(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg)
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (!list_empty(&uc_mgr->boot_list)) {
|
if (!list_empty(&uc_mgr->boot_list)) {
|
||||||
uc_error("Boot list is not empty");
|
snd_error(UCM, "Boot list is not empty");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
err = parse_sequence(uc_mgr, &uc_mgr->boot_list, cfg);
|
err = parse_sequence(uc_mgr, &uc_mgr->boot_list, cfg);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("Unable to parse BootSequence");
|
snd_error(UCM, "Unable to parse BootSequence");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2344,12 +2362,12 @@ static int parse_controls(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg)
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (!list_empty(&uc_mgr->default_list)) {
|
if (!list_empty(&uc_mgr->default_list)) {
|
||||||
uc_error("Default list is not empty");
|
snd_error(UCM, "Default list is not empty");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
err = parse_sequence(uc_mgr, &uc_mgr->default_list, cfg);
|
err = parse_sequence(uc_mgr, &uc_mgr->default_list, cfg);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("Unable to parse SectionDefaults");
|
snd_error(UCM, "Unable to parse SectionDefaults");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2412,7 +2430,7 @@ static int parse_master_file(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg)
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
|
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
|
||||||
uc_error("compound type expected for master file");
|
snd_error(UCM, "compound type expected for master file");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2437,7 +2455,7 @@ static int parse_master_file(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg)
|
||||||
if (strcmp(id, "Comment") == 0) {
|
if (strcmp(id, "Comment") == 0) {
|
||||||
err = parse_string_substitute3(uc_mgr, n, &uc_mgr->comment);
|
err = parse_string_substitute3(uc_mgr, n, &uc_mgr->comment);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: failed to get master comment");
|
snd_error(UCM, "error: failed to get master comment");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -2481,7 +2499,7 @@ static int parse_master_file(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg)
|
||||||
if (strcmp(id, "ValueDefaults") == 0) {
|
if (strcmp(id, "ValueDefaults") == 0) {
|
||||||
err = parse_value(uc_mgr, &uc_mgr->value_list, n);
|
err = parse_value(uc_mgr, &uc_mgr->value_list, n);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: failed to parse ValueDefaults");
|
snd_error(UCM, "error: failed to parse ValueDefaults");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -2491,7 +2509,7 @@ static int parse_master_file(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg)
|
||||||
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);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: failed to parse LibraryConfig");
|
snd_error(UCM, "error: failed to parse LibraryConfig");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -2505,7 +2523,7 @@ static int parse_master_file(snd_use_case_mgr_t *uc_mgr, snd_config_t *cfg)
|
||||||
if (strcmp(id, "Syntax") == 0)
|
if (strcmp(id, "Syntax") == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
uc_error("unknown master file field %s", id);
|
snd_error(UCM, "unknown master file field %s", id);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -2538,7 +2556,7 @@ static int get_by_card_name(snd_use_case_mgr_t *mgr, const char *card_name)
|
||||||
|
|
||||||
card = -1;
|
card = -1;
|
||||||
if (snd_card_next(&card) < 0 || card < 0) {
|
if (snd_card_next(&card) < 0 || card < 0) {
|
||||||
uc_error("no soundcards found...");
|
snd_error(UCM, "no soundcards found...");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2562,7 +2580,7 @@ static int get_by_card_name(snd_use_case_mgr_t *mgr, const char *card_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (snd_card_next(&card) < 0) {
|
if (snd_card_next(&card) < 0) {
|
||||||
uc_error("snd_card_next");
|
snd_error(UCM, "snd_card_next");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2591,7 +2609,7 @@ static int parse_toplevel_path(snd_use_case_mgr_t *uc_mgr,
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
|
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
|
||||||
uc_error("compound type expected for UseCasePath node");
|
snd_error(UCM, "compound type expected for UseCasePath node");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2600,7 +2618,7 @@ static int parse_toplevel_path(snd_use_case_mgr_t *uc_mgr,
|
||||||
n = snd_config_iterator_entry(i);
|
n = snd_config_iterator_entry(i);
|
||||||
|
|
||||||
if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
|
if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
|
||||||
uc_error("compound type expected for UseCasePath.something node");
|
snd_error(UCM, "compound type expected for UseCasePath.something node");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2619,11 +2637,11 @@ static int parse_toplevel_path(snd_use_case_mgr_t *uc_mgr,
|
||||||
if (strcmp(id, "Version") == 0) {
|
if (strcmp(id, "Version") == 0) {
|
||||||
err = parse_integer_substitute(uc_mgr, n2, &version);
|
err = parse_integer_substitute(uc_mgr, n2, &version);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("unable to parse UcmDirectory");
|
snd_error(UCM, "unable to parse UcmDirectory");
|
||||||
goto __error;
|
goto __error;
|
||||||
}
|
}
|
||||||
if (version < 1 || version > 2) {
|
if (version < 1 || version > 2) {
|
||||||
uc_error("Version must be 1 or 2");
|
snd_error(UCM, "Version must be 1 or 2");
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
goto __error;
|
goto __error;
|
||||||
}
|
}
|
||||||
|
|
@ -2633,7 +2651,7 @@ static int parse_toplevel_path(snd_use_case_mgr_t *uc_mgr,
|
||||||
if (strcmp(id, "Directory") == 0) {
|
if (strcmp(id, "Directory") == 0) {
|
||||||
err = parse_string_substitute(uc_mgr, n2, &dir);
|
err = parse_string_substitute(uc_mgr, n2, &dir);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("unable to parse Directory");
|
snd_error(UCM, "unable to parse Directory");
|
||||||
goto __error;
|
goto __error;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -2642,21 +2660,21 @@ static int parse_toplevel_path(snd_use_case_mgr_t *uc_mgr,
|
||||||
if (strcmp(id, "File") == 0) {
|
if (strcmp(id, "File") == 0) {
|
||||||
err = parse_string_substitute(uc_mgr, n2, &file);
|
err = parse_string_substitute(uc_mgr, n2, &file);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("unable to parse File");
|
snd_error(UCM, "unable to parse File");
|
||||||
goto __error;
|
goto __error;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
uc_error("unknown UseCasePath field %s", id);
|
snd_error(UCM, "unknown UseCasePath field %s", id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dir == NULL) {
|
if (dir == NULL) {
|
||||||
uc_error("Directory is not defined in %s!", filename);
|
snd_error(UCM, "Directory is not defined in %s!", filename);
|
||||||
goto __next;
|
goto __next;
|
||||||
}
|
}
|
||||||
if (file == NULL) {
|
if (file == NULL) {
|
||||||
uc_error("File is not defined in %s!", filename);
|
snd_error(UCM, "File is not defined in %s!", filename);
|
||||||
goto __next;
|
goto __next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2736,7 +2754,7 @@ static int parse_toplevel_config(snd_use_case_mgr_t *uc_mgr,
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
|
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
|
||||||
uc_error("compound type expected for toplevel file");
|
snd_error(UCM, "compound type expected for toplevel file");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2767,7 +2785,7 @@ static int parse_toplevel_config(snd_use_case_mgr_t *uc_mgr,
|
||||||
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);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: failed to parse LibConfig");
|
snd_error(UCM, "error: failed to parse LibConfig");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -2777,7 +2795,7 @@ static int parse_toplevel_config(snd_use_case_mgr_t *uc_mgr,
|
||||||
if (strcmp(id, "Syntax") == 0)
|
if (strcmp(id, "Syntax") == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
uc_error("unknown toplevel field %s", id);
|
snd_error(UCM, "unknown toplevel field %s", id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
@ -2793,7 +2811,7 @@ static int load_toplevel_config(snd_use_case_mgr_t *uc_mgr,
|
||||||
ucm_filename(filename, sizeof(filename), 2, NULL, "ucm.conf");
|
ucm_filename(filename, sizeof(filename), 2, NULL, "ucm.conf");
|
||||||
|
|
||||||
if (access(filename, R_OK) != 0) {
|
if (access(filename, R_OK) != 0) {
|
||||||
uc_error("Unable to find the top-level configuration file '%s'.", filename);
|
snd_error(UCM, "Unable to find the top-level configuration file '%s'.", filename);
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2809,8 +2827,9 @@ static int load_toplevel_config(snd_use_case_mgr_t *uc_mgr,
|
||||||
|
|
||||||
err = uc_mgr_config_load(uc_mgr->conf_format, filename, cfg);
|
err = uc_mgr_config_load(uc_mgr->conf_format, filename, cfg);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("error: could not parse configuration for card %s",
|
snd_error(UCM, "error: could not parse configuration for card %s",
|
||||||
uc_mgr->card_name);
|
uc_mgr->card_name);
|
||||||
|
|
||||||
goto __error;
|
goto __error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2840,7 +2859,7 @@ int uc_mgr_import_master_config(snd_use_case_mgr_t *uc_mgr)
|
||||||
if (strncmp(name, "hw:", 3) == 0) {
|
if (strncmp(name, "hw:", 3) == 0) {
|
||||||
err = get_by_card(uc_mgr, name);
|
err = get_by_card(uc_mgr, name);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("card '%s' is not valid", name);
|
snd_error(UCM, "card '%s' is not valid", name);
|
||||||
goto __error;
|
goto __error;
|
||||||
}
|
}
|
||||||
} else if (strncmp(name, "strict:", 7)) {
|
} else if (strncmp(name, "strict:", 7)) {
|
||||||
|
|
@ -2943,8 +2962,9 @@ int uc_mgr_scan_master_configs(const char **_list[])
|
||||||
err = scandir64(filename, &namelist, filename_filter, SORTFUNC);
|
err = scandir64(filename, &namelist, filename_filter, SORTFUNC);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
err = -errno;
|
err = -errno;
|
||||||
uc_error("error: could not scan directory %s: %s",
|
snd_error(UCM, "error: could not scan directory %s: %s",
|
||||||
filename, strerror(-err));
|
filename, strerror(-err));
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
cnt = err;
|
cnt = err;
|
||||||
|
|
@ -2982,7 +3002,7 @@ int uc_mgr_scan_master_configs(const char **_list[])
|
||||||
if (err == -ENOENT || err == -ENXIO)
|
if (err == -ENOENT || err == -ENXIO)
|
||||||
continue;
|
continue;
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("Unable to open '%s': %s", fn, snd_strerror(err));
|
snd_error(UCM, "Unable to open '%s': %s", fn, snd_strerror(err));
|
||||||
goto __err;
|
goto __err;
|
||||||
}
|
}
|
||||||
err = snd_use_case_get(uc_mgr, "comment", (const char **)&s);
|
err = snd_use_case_get(uc_mgr, "comment", (const char **)&s);
|
||||||
|
|
@ -3020,18 +3040,18 @@ int uc_mgr_scan_master_configs(const char **_list[])
|
||||||
goto __err;
|
goto __err;
|
||||||
err = snd_config_search(cfg, "Syntax", &c);
|
err = snd_config_search(cfg, "Syntax", &c);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("Syntax field not found in %s", d_name);
|
snd_error(UCM, "Syntax field not found in %s", d_name);
|
||||||
snd_config_delete(cfg);
|
snd_config_delete(cfg);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
err = snd_config_get_integer(c, &l);
|
err = snd_config_get_integer(c, &l);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("Syntax field is invalid in %s", d_name);
|
snd_error(UCM, "Syntax field is invalid in %s", d_name);
|
||||||
snd_config_delete(cfg);
|
snd_config_delete(cfg);
|
||||||
goto __err;
|
goto __err;
|
||||||
}
|
}
|
||||||
if (l < 2 || l > SYNTAX_VERSION_MAX) {
|
if (l < 2 || l > SYNTAX_VERSION_MAX) {
|
||||||
uc_error("Incompatible syntax %d in %s", l, d_name);
|
snd_error(UCM, "Incompatible syntax %d in %s", l, d_name);
|
||||||
snd_config_delete(cfg);
|
snd_config_delete(cfg);
|
||||||
goto __err;
|
goto __err;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ static int if_eval_string(snd_use_case_mgr_t *uc_mgr, snd_config_t *eval)
|
||||||
if (uc_mgr->conf_format >= 3) {
|
if (uc_mgr->conf_format >= 3) {
|
||||||
err = get_string(eval, "Empty", &string1);
|
err = get_string(eval, "Empty", &string1);
|
||||||
if (err < 0 && err != -ENOENT) {
|
if (err < 0 && err != -ENOENT) {
|
||||||
uc_error("String error (If.Condition.Empty)");
|
snd_error(UCM, "String error (If.Condition.Empty)");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -63,23 +63,23 @@ static int if_eval_string(snd_use_case_mgr_t *uc_mgr, snd_config_t *eval)
|
||||||
|
|
||||||
err = get_string(eval, "String1", &string1);
|
err = get_string(eval, "String1", &string1);
|
||||||
if (err < 0 && err != -ENOENT) {
|
if (err < 0 && err != -ENOENT) {
|
||||||
uc_error("String error (If.Condition.String1)");
|
snd_error(UCM, "String error (If.Condition.String1)");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = get_string(eval, "String2", &string2);
|
err = get_string(eval, "String2", &string2);
|
||||||
if (err < 0 && err != -ENOENT) {
|
if (err < 0 && err != -ENOENT) {
|
||||||
uc_error("String error (If.Condition.String2)");
|
snd_error(UCM, "String error (If.Condition.String2)");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string1 || string2) {
|
if (string1 || string2) {
|
||||||
if (string1 == NULL) {
|
if (string1 == NULL) {
|
||||||
uc_error("If.Condition.String1 not defined");
|
snd_error(UCM, "If.Condition.String1 not defined");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if (string2 == NULL) {
|
if (string2 == NULL) {
|
||||||
uc_error("If.Condition.String2 not defined");
|
snd_error(UCM, "If.Condition.String2 not defined");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
err = uc_mgr_get_substituted_value(uc_mgr, &s1, string1);
|
err = uc_mgr_get_substituted_value(uc_mgr, &s1, string1);
|
||||||
|
|
@ -98,23 +98,23 @@ static int if_eval_string(snd_use_case_mgr_t *uc_mgr, snd_config_t *eval)
|
||||||
|
|
||||||
err = get_string(eval, "Haystack", &string1);
|
err = get_string(eval, "Haystack", &string1);
|
||||||
if (err < 0 && err != -ENOENT) {
|
if (err < 0 && err != -ENOENT) {
|
||||||
uc_error("String error (If.Condition.Haystack)");
|
snd_error(UCM, "String error (If.Condition.Haystack)");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = get_string(eval, "Needle", &string2);
|
err = get_string(eval, "Needle", &string2);
|
||||||
if (err < 0 && err != -ENOENT) {
|
if (err < 0 && err != -ENOENT) {
|
||||||
uc_error("String error (If.Condition.Needle)");
|
snd_error(UCM, "String error (If.Condition.Needle)");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string1 || string2) {
|
if (string1 || string2) {
|
||||||
if (string1 == NULL) {
|
if (string1 == NULL) {
|
||||||
uc_error("If.Condition.Haystack not defined");
|
snd_error(UCM, "If.Condition.Haystack not defined");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if (string2 == NULL) {
|
if (string2 == NULL) {
|
||||||
uc_error("If.Condition.Needle not defined");
|
snd_error(UCM, "If.Condition.Needle not defined");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
err = uc_mgr_get_substituted_value(uc_mgr, &s1, string1);
|
err = uc_mgr_get_substituted_value(uc_mgr, &s1, string1);
|
||||||
|
|
@ -131,7 +131,7 @@ static int if_eval_string(snd_use_case_mgr_t *uc_mgr, snd_config_t *eval)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
uc_error("Unknown String condition arguments");
|
snd_error(UCM, "Unknown String condition arguments");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -146,13 +146,13 @@ static int if_eval_regex_match(snd_use_case_mgr_t *uc_mgr, snd_config_t *eval)
|
||||||
|
|
||||||
err = get_string(eval, "String", &string);
|
err = get_string(eval, "String", &string);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("RegexMatch error (If.Condition.String)");
|
snd_error(UCM, "RegexMatch error (If.Condition.String)");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = get_string(eval, "Regex", ®ex_string);
|
err = get_string(eval, "Regex", ®ex_string);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("RegexMatch error (If.Condition.Regex)");
|
snd_error(UCM, "RegexMatch error (If.Condition.Regex)");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -161,7 +161,7 @@ static int if_eval_regex_match(snd_use_case_mgr_t *uc_mgr, snd_config_t *eval)
|
||||||
return err;
|
return err;
|
||||||
err = regcomp(&re, s, options);
|
err = regcomp(&re, s, options);
|
||||||
if (err) {
|
if (err) {
|
||||||
uc_error("Regex '%s' compilation failed (code %d)", s, err);
|
snd_error(UCM, "Regex '%s' compilation failed (code %d)", s, err);
|
||||||
free(s);
|
free(s);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
@ -194,19 +194,19 @@ static int if_eval_control_exists(snd_use_case_mgr_t *uc_mgr, snd_config_t *eval
|
||||||
|
|
||||||
err = get_string(eval, "Device", &device);
|
err = get_string(eval, "Device", &device);
|
||||||
if (err < 0 && err != -ENOENT) {
|
if (err < 0 && err != -ENOENT) {
|
||||||
uc_error("ControlExists error (If.Condition.Device)");
|
snd_error(UCM, "ControlExists error (If.Condition.Device)");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = get_string(eval, "Control", &ctldef);
|
err = get_string(eval, "Control", &ctldef);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("ControlExists error (If.Condition.Control)");
|
snd_error(UCM, "ControlExists error (If.Condition.Control)");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = get_string(eval, "ControlEnum", &enumval);
|
err = get_string(eval, "ControlEnum", &enumval);
|
||||||
if (err < 0 && err != -ENOENT) {
|
if (err < 0 && err != -ENOENT) {
|
||||||
uc_error("ControlExists error (If.Condition.ControlEnum)");
|
snd_error(UCM, "ControlExists error (If.Condition.ControlEnum)");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -216,14 +216,14 @@ static int if_eval_control_exists(snd_use_case_mgr_t *uc_mgr, snd_config_t *eval
|
||||||
err = snd_ctl_ascii_elem_id_parse(elem_id, s);
|
err = snd_ctl_ascii_elem_id_parse(elem_id, s);
|
||||||
free(s);
|
free(s);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("unable to parse element identificator (%s)", ctldef);
|
snd_error(UCM, "unable to parse element identificator (%s)", ctldef);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device == NULL) {
|
if (device == NULL) {
|
||||||
ctl = uc_mgr_get_ctl(uc_mgr);
|
ctl = uc_mgr_get_ctl(uc_mgr);
|
||||||
if (ctl == NULL) {
|
if (ctl == NULL) {
|
||||||
uc_error("cannot determine control device");
|
snd_error(UCM, "cannot determine control device");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -277,19 +277,19 @@ static int if_eval_path(snd_use_case_mgr_t *uc_mgr, snd_config_t *eval)
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
if (uc_mgr->conf_format < 4) {
|
if (uc_mgr->conf_format < 4) {
|
||||||
uc_error("Path condition is supported in v4+ syntax");
|
snd_error(UCM, "Path condition is supported in v4+ syntax");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = get_string(eval, "Path", &path);
|
err = get_string(eval, "Path", &path);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("Path error (If.Condition.Path)");
|
snd_error(UCM, "Path error (If.Condition.Path)");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = get_string(eval, "Mode", &mode);
|
err = get_string(eval, "Mode", &mode);
|
||||||
if (err < 0 && err != -ENOENT) {
|
if (err < 0 && err != -ENOENT) {
|
||||||
uc_error("Path error (If.Condition.Mode)");
|
snd_error(UCM, "Path error (If.Condition.Mode)");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -309,7 +309,7 @@ static int if_eval_path(snd_use_case_mgr_t *uc_mgr, snd_config_t *eval)
|
||||||
} else if (strcasecmp(s, "exec") == 0) {
|
} else if (strcasecmp(s, "exec") == 0) {
|
||||||
amode = X_OK;
|
amode = X_OK;
|
||||||
} else {
|
} else {
|
||||||
uc_error("Path unknown mode '%s' (If.Condition.Mode)", s);
|
snd_error(UCM, "Path unknown mode '%s' (If.Condition.Mode)", s);
|
||||||
free(s);
|
free(s);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
@ -339,13 +339,13 @@ static int if_eval(snd_use_case_mgr_t *uc_mgr, snd_config_t *eval)
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (snd_config_get_type(eval) != SND_CONFIG_TYPE_COMPOUND) {
|
if (snd_config_get_type(eval) != SND_CONFIG_TYPE_COMPOUND) {
|
||||||
uc_error("compound type expected for If.Condition");
|
snd_error(UCM, "compound type expected for If.Condition");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = get_string(eval, "Type", &type);
|
err = get_string(eval, "Type", &type);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("type block error (If.Condition)");
|
snd_error(UCM, "type block error (If.Condition)");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -364,7 +364,7 @@ static int if_eval(snd_use_case_mgr_t *uc_mgr, snd_config_t *eval)
|
||||||
if (strcmp(type, "Path") == 0)
|
if (strcmp(type, "Path") == 0)
|
||||||
return if_eval_path(uc_mgr, eval);
|
return if_eval_path(uc_mgr, eval);
|
||||||
|
|
||||||
uc_error("unknown If.Condition.Type");
|
snd_error(UCM, "unknown If.Condition.Type");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -380,36 +380,36 @@ static int if_eval_one(snd_use_case_mgr_t *uc_mgr,
|
||||||
*result = NULL;
|
*result = NULL;
|
||||||
|
|
||||||
if (snd_config_get_type(cond) != SND_CONFIG_TYPE_COMPOUND) {
|
if (snd_config_get_type(cond) != SND_CONFIG_TYPE_COMPOUND) {
|
||||||
uc_error("compound type expected for If.1");
|
snd_error(UCM, "compound type expected for If.1");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (snd_config_search(cond, "Condition", &expr) < 0) {
|
if (snd_config_search(cond, "Condition", &expr) < 0) {
|
||||||
uc_error("condition block expected (If)");
|
snd_error(UCM, "condition block expected (If)");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = snd_config_search(cond, "True", &_true);
|
err = snd_config_search(cond, "True", &_true);
|
||||||
if (err < 0 && err != -ENOENT) {
|
if (err < 0 && err != -ENOENT) {
|
||||||
uc_error("true block error (If)");
|
snd_error(UCM, "true block error (If)");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = snd_config_search(cond, "False", &_false);
|
err = snd_config_search(cond, "False", &_false);
|
||||||
if (err < 0 && err != -ENOENT) {
|
if (err < 0 && err != -ENOENT) {
|
||||||
uc_error("false block error (If)");
|
snd_error(UCM, "false block error (If)");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = snd_config_search(cond, "Before", before);
|
err = snd_config_search(cond, "Before", before);
|
||||||
if (err < 0 && err != -ENOENT) {
|
if (err < 0 && err != -ENOENT) {
|
||||||
uc_error("before block identifier error");
|
snd_error(UCM, "before block identifier error");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = snd_config_search(cond, "After", after);
|
err = snd_config_search(cond, "After", after);
|
||||||
if (err < 0 && err != -ENOENT) {
|
if (err < 0 && err != -ENOENT) {
|
||||||
uc_error("before block identifier error");
|
snd_error(UCM, "before block identifier error");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -448,12 +448,12 @@ int uc_mgr_evaluate_condition(snd_use_case_mgr_t *uc_mgr,
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (uc_mgr->conf_format < 2) {
|
if (uc_mgr->conf_format < 2) {
|
||||||
uc_error("conditions are not supported for v1 syntax");
|
snd_error(UCM, "conditions are not supported for v1 syntax");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (snd_config_get_type(cond) != SND_CONFIG_TYPE_COMPOUND) {
|
if (snd_config_get_type(cond) != SND_CONFIG_TYPE_COMPOUND) {
|
||||||
uc_error("compound type expected for If");
|
snd_error(UCM, "compound type expected for If");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -236,15 +236,16 @@ int uc_mgr_exec(const char *prog)
|
||||||
if (p == -1) {
|
if (p == -1) {
|
||||||
err = -errno;
|
err = -errno;
|
||||||
pthread_mutex_unlock(&fork_lock);
|
pthread_mutex_unlock(&fork_lock);
|
||||||
uc_error("Unable to fork() for \"%s\" -- %s", prog, strerror(errno));
|
snd_error(UCM, "Unable to fork() for \"%s\" -- %s", prog, strerror(errno));
|
||||||
goto __error;
|
goto __error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p == 0) {
|
if (p == 0) {
|
||||||
f = open("/dev/null", O_RDWR);
|
f = open("/dev/null", O_RDWR);
|
||||||
if (f == -1) {
|
if (f == -1) {
|
||||||
uc_error("pid %d cannot open /dev/null for redirect %s -- %s",
|
snd_error(UCM, "pid %d cannot open /dev/null for redirect %s -- %s",
|
||||||
getpid(), prog, strerror(errno));
|
getpid(), prog, strerror(errno));
|
||||||
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,25 +50,25 @@ static int include_eval_one(snd_use_case_mgr_t *uc_mgr,
|
||||||
*result = NULL;
|
*result = NULL;
|
||||||
|
|
||||||
if (snd_config_get_type(inc) != SND_CONFIG_TYPE_COMPOUND) {
|
if (snd_config_get_type(inc) != SND_CONFIG_TYPE_COMPOUND) {
|
||||||
uc_error("compound type expected for Include.1");
|
snd_error(UCM, "compound type expected for Include.1");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = get_string(inc, "File", &file);
|
err = get_string(inc, "File", &file);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("file expected (Include)");
|
snd_error(UCM, "file expected (Include)");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = snd_config_search(inc, "Before", before);
|
err = snd_config_search(inc, "Before", before);
|
||||||
if (err < 0 && err != -ENOENT) {
|
if (err < 0 && err != -ENOENT) {
|
||||||
uc_error("before block identifier error");
|
snd_error(UCM, "before block identifier error");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = snd_config_search(inc, "After", after);
|
err = snd_config_search(inc, "After", after);
|
||||||
if (err < 0 && err != -ENOENT) {
|
if (err < 0 && err != -ENOENT) {
|
||||||
uc_error("before block identifier error");
|
snd_error(UCM, "before block identifier error");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -144,7 +144,7 @@ static int compound_merge(snd_use_case_mgr_t *uc_mgr, const char *id,
|
||||||
int err, array, idx;
|
int err, array, idx;
|
||||||
|
|
||||||
if (snd_config_get_type(src) != SND_CONFIG_TYPE_COMPOUND) {
|
if (snd_config_get_type(src) != SND_CONFIG_TYPE_COMPOUND) {
|
||||||
uc_error("compound type expected for the merged block");
|
snd_error(UCM, "compound type expected for the merged block");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -164,17 +164,17 @@ static int compound_merge(snd_use_case_mgr_t *uc_mgr, const char *id,
|
||||||
return snd_config_merge(dst, src, 0); /* merge / append mode */
|
return snd_config_merge(dst, src, 0); /* merge / append mode */
|
||||||
|
|
||||||
if (_before && _after) {
|
if (_before && _after) {
|
||||||
uc_error("defined both before and after identifiers in the If or Include block");
|
snd_error(UCM, "defined both before and after identifiers in the If or Include block");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
array = snd_config_is_array(dst);
|
array = snd_config_is_array(dst);
|
||||||
if (array < 0) {
|
if (array < 0) {
|
||||||
uc_error("destination configuration node is not a compound");
|
snd_error(UCM, "destination configuration node is not a compound");
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
if (array && snd_config_is_array(src) <= 0) {
|
if (array && snd_config_is_array(src) <= 0) {
|
||||||
uc_error("source configuration node is not an array");
|
snd_error(UCM, "source configuration node is not an array");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -287,12 +287,12 @@ int uc_mgr_evaluate_include(snd_use_case_mgr_t *uc_mgr,
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (uc_mgr->conf_format < 3) {
|
if (uc_mgr->conf_format < 3) {
|
||||||
uc_error("in-place include is supported in v3+ syntax");
|
snd_error(UCM, "in-place include is supported in v3+ syntax");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (snd_config_get_type(inc) != SND_CONFIG_TYPE_COMPOUND) {
|
if (snd_config_get_type(inc) != SND_CONFIG_TYPE_COMPOUND) {
|
||||||
uc_error("compound type expected for Include");
|
snd_error(UCM, "compound type expected for Include");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -285,8 +285,6 @@ struct snd_use_case_mgr {
|
||||||
char *cdev;
|
char *cdev;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define uc_error SNDERR
|
|
||||||
|
|
||||||
#ifdef UC_MGR_DEBUG
|
#ifdef UC_MGR_DEBUG
|
||||||
#define uc_dbg SNDERR
|
#define uc_dbg SNDERR
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
|
|
@ -98,24 +98,24 @@ int uc_mgr_define_regex(snd_use_case_mgr_t *uc_mgr, const char *name,
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (uc_mgr->conf_format < 3) {
|
if (uc_mgr->conf_format < 3) {
|
||||||
uc_error("define regex is supported in v3+ syntax");
|
snd_error(UCM, "define regex is supported in v3+ syntax");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (snd_config_get_type(eval) != SND_CONFIG_TYPE_COMPOUND) {
|
if (snd_config_get_type(eval) != SND_CONFIG_TYPE_COMPOUND) {
|
||||||
uc_error("compound type expected for DefineRegex");
|
snd_error(UCM, "compound type expected for DefineRegex");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = get_string(eval, "String", &string);
|
err = get_string(eval, "String", &string);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("DefineRegex error (String)");
|
snd_error(UCM, "DefineRegex error (String)");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = get_string(eval, "Regex", ®ex_string);
|
err = get_string(eval, "Regex", ®ex_string);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("DefineRegex error (Regex string)");
|
snd_error(UCM, "DefineRegex error (Regex string)");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -123,7 +123,7 @@ int uc_mgr_define_regex(snd_use_case_mgr_t *uc_mgr, const char *name,
|
||||||
if (err == -ENOENT) {
|
if (err == -ENOENT) {
|
||||||
options = REG_EXTENDED;
|
options = REG_EXTENDED;
|
||||||
} else if (err < 0) {
|
} else if (err < 0) {
|
||||||
uc_error("DefineRegex error (Flags string)");
|
snd_error(UCM, "DefineRegex error (Flags string)");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
} else {
|
} else {
|
||||||
while (*flags_string) {
|
while (*flags_string) {
|
||||||
|
|
@ -141,7 +141,7 @@ int uc_mgr_define_regex(snd_use_case_mgr_t *uc_mgr, const char *name,
|
||||||
options |= REG_NEWLINE;
|
options |= REG_NEWLINE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
uc_error("DefineRegex error (unknown flag '%c')", *flags_string);
|
snd_error(UCM, "DefineRegex error (unknown flag '%c')", *flags_string);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
flags_string++;
|
flags_string++;
|
||||||
|
|
@ -154,7 +154,7 @@ int uc_mgr_define_regex(snd_use_case_mgr_t *uc_mgr, const char *name,
|
||||||
err = regcomp(&re, s, options);
|
err = regcomp(&re, s, options);
|
||||||
free(s);
|
free(s);
|
||||||
if (err) {
|
if (err) {
|
||||||
uc_error("Regex '%s' compilation failed (code %d)", s, err);
|
snd_error(UCM, "Regex '%s' compilation failed (code %d)", s, err);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -178,11 +178,11 @@ static struct ctl_list *get_ctl_list_by_name(snd_use_case_mgr_t *uc_mgr, const c
|
||||||
static char *rval_card_number_by_name(snd_use_case_mgr_t *uc_mgr, const char *id)
|
static char *rval_card_number_by_name(snd_use_case_mgr_t *uc_mgr, const char *id)
|
||||||
{
|
{
|
||||||
if (uc_mgr->conf_format < 3) {
|
if (uc_mgr->conf_format < 3) {
|
||||||
uc_error("CardNumberByName substitution is supported in v3+ syntax");
|
snd_error(UCM, "CardNumberByName substitution is supported in v3+ syntax");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
uc_error("${CardNumberByName} substitution is obsolete - use ${find-card}!");
|
snd_error(UCM, "${CardNumberByName} substitution is obsolete - use ${find-card}!");
|
||||||
|
|
||||||
return get_card_number(get_ctl_list_by_name(uc_mgr, id));
|
return get_card_number(get_ctl_list_by_name(uc_mgr, id));
|
||||||
}
|
}
|
||||||
|
|
@ -192,11 +192,11 @@ static char *rval_card_id_by_name(snd_use_case_mgr_t *uc_mgr, const char *id)
|
||||||
struct ctl_list *ctl_list;
|
struct ctl_list *ctl_list;
|
||||||
|
|
||||||
if (uc_mgr->conf_format < 3) {
|
if (uc_mgr->conf_format < 3) {
|
||||||
uc_error("CardIdByName substitution is supported in v3+ syntax");
|
snd_error(UCM, "CardIdByName substitution is supported in v3+ syntax");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
uc_error("${CardIdByName} substitution is obsolete - use ${find-card}!");
|
snd_error(UCM, "${CardIdByName} substitution is obsolete - use ${find-card}!");
|
||||||
|
|
||||||
ctl_list = get_ctl_list_by_name(uc_mgr, id);
|
ctl_list = get_ctl_list_by_name(uc_mgr, id);
|
||||||
if (ctl_list == NULL)
|
if (ctl_list == NULL)
|
||||||
|
|
@ -242,19 +242,19 @@ static char *rval_lookup_main(snd_use_case_mgr_t *uc_mgr,
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (uc_mgr->conf_format < 4) {
|
if (uc_mgr->conf_format < 4) {
|
||||||
uc_error("Lookups are supported in v4+ syntax");
|
snd_error(UCM, "Lookups are supported in v4+ syntax");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = snd_config_load_string(&config, query, 0);
|
err = snd_config_load_string(&config, query, 0);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("The lookup arguments '%s' are invalid", query);
|
snd_error(UCM, "The lookup arguments '%s' are invalid", query);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (iter->init && iter->init(uc_mgr, iter, config))
|
if (iter->init && iter->init(uc_mgr, iter, config))
|
||||||
goto null;
|
goto null;
|
||||||
if (snd_config_search(config, "field", &d)) {
|
if (snd_config_search(config, "field", &d)) {
|
||||||
uc_error("Lookups require field!");
|
snd_error(UCM, "Lookups require field!");
|
||||||
goto null;
|
goto null;
|
||||||
}
|
}
|
||||||
if (snd_config_get_string(d, &s))
|
if (snd_config_get_string(d, &s))
|
||||||
|
|
@ -266,18 +266,18 @@ static char *rval_lookup_main(snd_use_case_mgr_t *uc_mgr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (iter->fcn == NULL) {
|
if (iter->fcn == NULL) {
|
||||||
uc_error("Unknown field value '%s'", s);
|
snd_error(UCM, "Unknown field value '%s'", s);
|
||||||
goto null;
|
goto null;
|
||||||
}
|
}
|
||||||
if (snd_config_search(config, "regex", &d)) {
|
if (snd_config_search(config, "regex", &d)) {
|
||||||
uc_error("Lookups require regex!");
|
snd_error(UCM, "Lookups require regex!");
|
||||||
goto null;
|
goto null;
|
||||||
}
|
}
|
||||||
if (snd_config_get_string(d, &s))
|
if (snd_config_get_string(d, &s))
|
||||||
goto null;
|
goto null;
|
||||||
err = regcomp(&re, s, REG_EXTENDED | REG_ICASE);
|
err = regcomp(&re, s, REG_EXTENDED | REG_ICASE);
|
||||||
if (err) {
|
if (err) {
|
||||||
uc_error("Regex '%s' compilation failed (code %d)", s, err);
|
snd_error(UCM, "Regex '%s' compilation failed (code %d)", s, err);
|
||||||
goto null;
|
goto null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -343,7 +343,7 @@ static char *rval_card_lookup_return(struct lookup_iterate *iter, snd_config_t *
|
||||||
snprintf(num, sizeof(num), "%d", snd_ctl_card_info_get_card(iter->info));
|
snprintf(num, sizeof(num), "%d", snd_ctl_card_info_get_card(iter->info));
|
||||||
return strdup(num);
|
return strdup(num);
|
||||||
} else {
|
} else {
|
||||||
uc_error("Unknown return type '%s'", s);
|
snd_error(UCM, "Unknown return type '%s'", s);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -384,7 +384,7 @@ next:
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
if (err == -ENOENT)
|
if (err == -ENOENT)
|
||||||
goto next;
|
goto next;
|
||||||
uc_error("Unable to obtain PCM info (device %d)", device);
|
snd_error(UCM, "Unable to obtain PCM info (device %d)", device);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return iter;
|
return iter;
|
||||||
|
|
@ -431,7 +431,7 @@ static int rval_pcm_lookup_init(struct lookup_iterate *iter,
|
||||||
else if (strcasecmp(s, "capture") == 0)
|
else if (strcasecmp(s, "capture") == 0)
|
||||||
stream = SND_PCM_STREAM_CAPTURE;
|
stream = SND_PCM_STREAM_CAPTURE;
|
||||||
else {
|
else {
|
||||||
uc_error("Unknown stream type '%s'", s);
|
snd_error(UCM, "Unknown stream type '%s'", s);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -466,24 +466,24 @@ static int rval_device_lookup_init(snd_use_case_mgr_t *uc_mgr,
|
||||||
if (snd_config_search(config, "ctl", &d) || snd_config_get_string(d, &s)) {
|
if (snd_config_search(config, "ctl", &d) || snd_config_get_string(d, &s)) {
|
||||||
iter->ctl_list = uc_mgr_get_master_ctl(uc_mgr);
|
iter->ctl_list = uc_mgr_get_master_ctl(uc_mgr);
|
||||||
if (iter->ctl_list == NULL) {
|
if (iter->ctl_list == NULL) {
|
||||||
uc_error("Control device is not defined!");
|
snd_error(UCM, "Control device is not defined!");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
err = uc_mgr_open_ctl(uc_mgr, &iter->ctl_list, s, 1);
|
err = uc_mgr_open_ctl(uc_mgr, &iter->ctl_list, s, 1);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("Control device '%s' not found", s);
|
snd_error(UCM, "Control device '%s' not found", s);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (snd_config_search(config, "type", &d) || snd_config_get_string(d, &s)) {
|
if (snd_config_search(config, "type", &d) || snd_config_get_string(d, &s)) {
|
||||||
uc_error("Missing device type!");
|
snd_error(UCM, "Missing device type!");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
for (t = types; t->name; t++)
|
for (t = types; t->name; t++)
|
||||||
if (strcasecmp(t->name, s) == 0)
|
if (strcasecmp(t->name, s) == 0)
|
||||||
return t->init(iter, config);
|
return t->init(iter, config);
|
||||||
uc_error("Device type '%s' is invalid", s);
|
snd_error(UCM, "Device type '%s' is invalid", s);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -531,7 +531,7 @@ static int parse_position(snd_config_t *config, const char *name, ssize_t *pos,
|
||||||
*pos = -1;
|
*pos = -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
uc_error("Unable to find field '%s'", name);
|
snd_error(UCM, "Unable to find field '%s'", name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!snd_config_get_integer(d, &v))
|
if (!snd_config_get_integer(d, &v))
|
||||||
|
|
@ -539,7 +539,7 @@ static int parse_position(snd_config_t *config, const char *name, ssize_t *pos,
|
||||||
if (snd_config_get_string(d, &s))
|
if (snd_config_get_string(d, &s))
|
||||||
return -1;
|
return -1;
|
||||||
if (safe_strtol(s, &v)) {
|
if (safe_strtol(s, &v)) {
|
||||||
uc_error("Unable to parse position '%s'", s);
|
snd_error(UCM, "Unable to parse position '%s'", s);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
fin:
|
fin:
|
||||||
|
|
@ -555,7 +555,7 @@ static int parse_range(const char *cfg, int *type, ssize_t *pos, ssize_t *size)
|
||||||
|
|
||||||
err = snd_config_load_string(&config, cfg, 0);
|
err = snd_config_load_string(&config, cfg, 0);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("The range arguments '%s' are invalid", cfg);
|
snd_error(UCM, "The range arguments '%s' are invalid", cfg);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (snd_config_search(config, "type", &d)) {
|
if (snd_config_search(config, "type", &d)) {
|
||||||
|
|
@ -568,7 +568,7 @@ static int parse_range(const char *cfg, int *type, ssize_t *pos, ssize_t *size)
|
||||||
} else if (strcasecmp(s, "hex") == 0) {
|
} else if (strcasecmp(s, "hex") == 0) {
|
||||||
*type = RANGE_TYPE_HEX;
|
*type = RANGE_TYPE_HEX;
|
||||||
} else {
|
} else {
|
||||||
uc_error("Unknown range type '%s'", s);
|
snd_error(UCM, "Unknown range type '%s'", s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*pos = 0;
|
*pos = 0;
|
||||||
|
|
@ -582,7 +582,7 @@ static int parse_range(const char *cfg, int *type, ssize_t *pos, ssize_t *size)
|
||||||
if (*size <= 0)
|
if (*size <= 0)
|
||||||
*size = 1;
|
*size = 1;
|
||||||
if (*pos < 0) {
|
if (*pos < 0) {
|
||||||
uc_error("Invalid start position");
|
snd_error(UCM, "Invalid start position");
|
||||||
retval = -1;
|
retval = -1;
|
||||||
goto null;
|
goto null;
|
||||||
}
|
}
|
||||||
|
|
@ -605,7 +605,7 @@ static char *rval_sysfs_main(snd_use_case_mgr_t *uc_mgr, const char *top_path, c
|
||||||
return NULL;
|
return NULL;
|
||||||
if (id[0] == '[') {
|
if (id[0] == '[') {
|
||||||
if (uc_mgr->conf_format < 8) {
|
if (uc_mgr->conf_format < 8) {
|
||||||
uc_error("Sysfs ranges are supported in v8+ syntax");
|
snd_error(UCM, "Sysfs ranges are supported in v8+ syntax");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
s = strchr(id, ']');
|
s = strchr(id, ']');
|
||||||
|
|
@ -617,7 +617,7 @@ static char *rval_sysfs_main(snd_use_case_mgr_t *uc_mgr, const char *top_path, c
|
||||||
strncpy(link, id + 1, len);
|
strncpy(link, id + 1, len);
|
||||||
link[len] = '\0';
|
link[len] = '\0';
|
||||||
if (parse_range(link, &type, &range_start, &range_size)) {
|
if (parse_range(link, &type, &range_start, &range_size)) {
|
||||||
uc_error("sysfs: cannot parse hex range '%s'", link);
|
snd_error(UCM, "sysfs: cannot parse hex range '%s'", link);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
id = s + 1;
|
id = s + 1;
|
||||||
|
|
@ -633,7 +633,7 @@ static char *rval_sysfs_main(snd_use_case_mgr_t *uc_mgr, const char *top_path, c
|
||||||
if (S_ISLNK(sb.st_mode)) {
|
if (S_ISLNK(sb.st_mode)) {
|
||||||
len = readlink(path, link, sizeof(link) - 1);
|
len = readlink(path, link, sizeof(link) - 1);
|
||||||
if (len <= 0) {
|
if (len <= 0) {
|
||||||
uc_error("sysfs: cannot read link '%s' (%d)", path, errno);
|
snd_error(UCM, "sysfs: cannot read link '%s' (%d)", path, errno);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
link[len] = '\0';
|
link[len] = '\0';
|
||||||
|
|
@ -649,18 +649,18 @@ static char *rval_sysfs_main(snd_use_case_mgr_t *uc_mgr, const char *top_path, c
|
||||||
|
|
||||||
fd = open(path, O_RDONLY);
|
fd = open(path, O_RDONLY);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
uc_error("sysfs open failed for '%s' (%d)", path, errno);
|
snd_error(UCM, "sysfs open failed for '%s' (%d)", path, errno);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
len = sizeof(path) - 1;
|
len = sizeof(path) - 1;
|
||||||
if (range_start > 0 && lseek(fd, range_start, SEEK_SET) != range_start) {
|
if (range_start > 0 && lseek(fd, range_start, SEEK_SET) != range_start) {
|
||||||
uc_error("sysfs seek failed (%d)", errno);
|
snd_error(UCM, "sysfs seek failed (%d)", errno);
|
||||||
close(fd);
|
close(fd);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (range_size > 0) {
|
if (range_size > 0) {
|
||||||
if (range_size > len) {
|
if (range_size > len) {
|
||||||
uc_error("sysfs EOB for '%s'", path);
|
snd_error(UCM, "sysfs EOB for '%s'", path);
|
||||||
close(fd);
|
close(fd);
|
||||||
return NULL;
|
return NULL;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -670,7 +670,7 @@ static char *rval_sysfs_main(snd_use_case_mgr_t *uc_mgr, const char *top_path, c
|
||||||
len = read(fd, path, len);
|
len = read(fd, path, len);
|
||||||
close(fd);
|
close(fd);
|
||||||
if (len < 0) {
|
if (len < 0) {
|
||||||
uc_error("sysfs unable to read value '%s' (%d)", path, errno);
|
snd_error(UCM, "sysfs unable to read value '%s' (%d)", path, errno);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (type == RANGE_TYPE_HEX && range_start >= 0) {
|
if (type == RANGE_TYPE_HEX && range_start >= 0) {
|
||||||
|
|
@ -701,7 +701,7 @@ static char *rval_sysfs_card(snd_use_case_mgr_t *uc_mgr, const char *id)
|
||||||
char top_path[32], *s;
|
char top_path[32], *s;
|
||||||
|
|
||||||
if (uc_mgr->conf_format < 8) {
|
if (uc_mgr->conf_format < 8) {
|
||||||
uc_error("sys-card is supported in v8+ syntax");
|
snd_error(UCM, "sys-card is supported in v8+ syntax");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
s = get_card_number(uc_mgr_get_master_ctl(uc_mgr));
|
s = get_card_number(uc_mgr_get_master_ctl(uc_mgr));
|
||||||
|
|
@ -716,7 +716,7 @@ static char *rval_var(snd_use_case_mgr_t *uc_mgr, const char *id)
|
||||||
bool ignore_not_found = false;
|
bool ignore_not_found = false;
|
||||||
|
|
||||||
if (uc_mgr->conf_format < 3) {
|
if (uc_mgr->conf_format < 3) {
|
||||||
uc_error("variable substitution is supported in v3+ syntax");
|
snd_error(UCM, "variable substitution is supported in v3+ syntax");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -755,12 +755,12 @@ static char *rval_eval(snd_use_case_mgr_t *uc_mgr, const char *e)
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (uc_mgr->conf_format < 5) {
|
if (uc_mgr->conf_format < 5) {
|
||||||
uc_error("variable evaluation is supported in v5+ syntax");
|
snd_error(UCM, "variable evaluation is supported in v5+ syntax");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
err = _snd_eval_string(&dst, e, rval_eval_var_cb, uc_mgr);
|
err = _snd_eval_string(&dst, e, rval_eval_var_cb, uc_mgr);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("unable to evaluate '%s'", e);
|
snd_error(UCM, "unable to evaluate '%s'", e);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
err = snd_config_get_ascii(dst, &r);
|
err = snd_config_get_ascii(dst, &r);
|
||||||
|
|
@ -779,7 +779,7 @@ static int rval_evali(snd_use_case_mgr_t *uc_mgr, snd_config_t *node, const char
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (uc_mgr->conf_format < 6) {
|
if (uc_mgr->conf_format < 6) {
|
||||||
uc_error("variable evaluation is supported in v6+ syntax");
|
snd_error(UCM, "variable evaluation is supported in v6+ syntax");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
err = snd_config_get_id(node, &id);
|
err = snd_config_get_id(node, &id);
|
||||||
|
|
@ -796,7 +796,7 @@ static int rval_evali(snd_use_case_mgr_t *uc_mgr, snd_config_t *node, const char
|
||||||
err = _snd_eval_string(&dst, s + 8, rval_eval_var_cb, uc_mgr);
|
err = _snd_eval_string(&dst, s + 8, rval_eval_var_cb, uc_mgr);
|
||||||
free(s);
|
free(s);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("unable to evaluate '%s'", e);
|
snd_error(UCM, "unable to evaluate '%s'", e);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
err = snd_config_set_id(dst, id);
|
err = snd_config_set_id(dst, id);
|
||||||
|
|
@ -921,9 +921,9 @@ __merr:
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
strncpy(r, value, tmp + 1 - value);
|
strncpy(r, value, tmp + 1 - value);
|
||||||
r[tmp + 1 - value] = '\0';
|
r[tmp + 1 - value] = '\0';
|
||||||
uc_error("variable '%s' is not known!", r);
|
snd_error(UCM, "variable '%s' is not known!", r);
|
||||||
} else {
|
} else {
|
||||||
uc_error("variable reference '%s' is not complete", value);
|
snd_error(UCM, "variable reference '%s' is not complete", value);
|
||||||
}
|
}
|
||||||
goto __error;
|
goto __error;
|
||||||
__match2:
|
__match2:
|
||||||
|
|
@ -941,7 +941,7 @@ __match2:
|
||||||
goto __direct_fcn2;
|
goto __direct_fcn2;
|
||||||
tmp = uc_mgr_get_variable(uc_mgr, v2 + 1);
|
tmp = uc_mgr_get_variable(uc_mgr, v2 + 1);
|
||||||
if (tmp == NULL) {
|
if (tmp == NULL) {
|
||||||
uc_error("define '%s' is not reachable in this context!", v2 + 1);
|
snd_error(UCM, "define '%s' is not reachable in this context!", v2 + 1);
|
||||||
rval = NULL;
|
rval = NULL;
|
||||||
} else {
|
} else {
|
||||||
rval = fcn2(uc_mgr, tmp);
|
rval = fcn2(uc_mgr, tmp);
|
||||||
|
|
@ -962,8 +962,9 @@ __rval:
|
||||||
}
|
}
|
||||||
strncpy(r, value, idsize);
|
strncpy(r, value, idsize);
|
||||||
r[idsize] = '\0';
|
r[idsize] = '\0';
|
||||||
uc_error("variable '%s' is %s in this context!", r,
|
snd_error(UCM, "variable '%s' is %s in this context!", r,
|
||||||
rval ? "empty" : "not defined");
|
rval ? "empty" : "not defined");
|
||||||
|
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
goto __error;
|
goto __error;
|
||||||
}
|
}
|
||||||
|
|
@ -1016,7 +1017,7 @@ int uc_mgr_substitute_tree(snd_use_case_mgr_t *uc_mgr, snd_config_t *node)
|
||||||
return err;
|
return err;
|
||||||
err = snd_config_set_id(node, s);
|
err = snd_config_set_id(node, s);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("unable to set substituted id '%s' (old id '%s')", s, id);
|
snd_error(UCM, "unable to set substituted id '%s' (old id '%s')", s, id);
|
||||||
free(s);
|
free(s);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ const char *uc_mgr_sysfs_root(void)
|
||||||
if (e == NULL)
|
if (e == NULL)
|
||||||
return "/sys";
|
return "/sys";
|
||||||
if (*e == '\0')
|
if (*e == '\0')
|
||||||
uc_error("no sysfs root!");
|
snd_error(UCM, "no sysfs root!");
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -69,7 +69,7 @@ struct ctl_list *uc_mgr_get_master_ctl(snd_use_case_mgr_t *uc_mgr)
|
||||||
if (ctl_list2->slave)
|
if (ctl_list2->slave)
|
||||||
continue;
|
continue;
|
||||||
if (ctl_list) {
|
if (ctl_list) {
|
||||||
uc_error("multiple control device names were found!");
|
snd_error(UCM, "multiple control device names were found!");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
ctl_list = ctl_list2;
|
ctl_list = ctl_list2;
|
||||||
|
|
@ -298,7 +298,7 @@ int uc_mgr_open_ctl(snd_use_case_mgr_t *uc_mgr,
|
||||||
if (err == 0)
|
if (err == 0)
|
||||||
id = snd_ctl_card_info_get_id(info);
|
id = snd_ctl_card_info_get_id(info);
|
||||||
if (err < 0 || id == NULL || id[0] == '\0') {
|
if (err < 0 || id == NULL || id[0] == '\0') {
|
||||||
uc_error("control hardware info (%s): %s", device, snd_strerror(err));
|
snd_error(UCM, "control hardware info (%s): %s", device, snd_strerror(err));
|
||||||
snd_ctl_close(ctl);
|
snd_ctl_close(ctl);
|
||||||
return err >= 0 ? -EINVAL : err;
|
return err >= 0 ? -EINVAL : err;
|
||||||
}
|
}
|
||||||
|
|
@ -361,7 +361,7 @@ int uc_mgr_config_load_into(int format, const char *file, snd_config_t *top)
|
||||||
if (!fp) {
|
if (!fp) {
|
||||||
err = -errno;
|
err = -errno;
|
||||||
__err_open:
|
__err_open:
|
||||||
uc_error("could not open configuration file %s", file);
|
snd_error(UCM, "could not open configuration file %s", file);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
err = snd_input_stdio_attach(&in, fp, 1);
|
err = snd_input_stdio_attach(&in, fp, 1);
|
||||||
|
|
@ -372,7 +372,7 @@ int uc_mgr_config_load_into(int format, const char *file, snd_config_t *top)
|
||||||
default_paths[1] = NULL;
|
default_paths[1] = NULL;
|
||||||
err = _snd_config_load_with_include(top, in, 0, default_paths);
|
err = _snd_config_load_with_include(top, in, 0, default_paths);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
uc_error("could not load configuration file %s", file);
|
snd_error(UCM, "could not load configuration file %s", file);
|
||||||
if (in)
|
if (in)
|
||||||
snd_input_close(in);
|
snd_input_close(in);
|
||||||
return err;
|
return err;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue