}
sz = st.st_size;
if (sz > 16 * 1024 * 1024 || sz < 8 || sz % 4) {
- uc_error("File size should be less than 16 MB "
- "and multiple of 4");
+ snd_error(UCM, "File size should be less than 16 MB "
+ "and multiple of 4");
+
err = -EINVAL;
goto __fail;
}
/* Check if the tlv file specifies valid size. */
tlv = (struct snd_ctl_tlv *)(*res);
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;
free(*res);
*res = NULL;
type = snd_ctl_elem_info_get_type(info);
if (type != SND_CTL_ELEM_TYPE_BYTES) {
- uc_error("only support byte type!");
+ snd_error(UCM, "only support byte type!");
err = -EINVAL;
goto __fail;
}
sz = st.st_size;
count = snd_ctl_elem_info_get_count(info);
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;
goto __fail;
}
p += len;
v = strtol(p, &end, 0);
if (*end != '\0' && *end != ' ' && *end != ',') {
- uc_error("unable to parse '%s'", prefix);
+ snd_error(UCM, "unable to parse '%s'", prefix);
return NULL;
}
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;
}
*rval = v;
*pos = p;
return 0;
er:
- uc_error("unknown syntax '%s'", p);
+ snd_error(UCM, "unknown syntax '%s'", p);
return -EINVAL;
}
snd_ctl_elem_info_set_id(info2, id);
err = parse_cset_new_info(info2, pos, &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;
goto __fail;
}
}
if (!*pos) {
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;
goto __fail;
}
} 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;
goto __fail;
}
if (err >= 0) {
err = snd_ctl_elem_remove(ctl, id);
if (err < 0) {
- uc_error("unable to remove control");
+ snd_error(UCM, "unable to remove control");
err = -EINVAL;
goto __fail;
}
goto __ok;
err = __snd_ctl_add_elem_set(ctl, info2, info2->owner, info2->count);
if (err < 0) {
- uc_error("unable to create new control");
+ snd_error(UCM, "unable to create new control");
goto __fail;
}
/* new id copy */
free(s);
if (ignore_error)
return 0;
- uc_error("unable to open '%s' for write", path);
+ snd_error(UCM, "unable to open '%s' for write", path);
return -EINVAL;
}
wlen = write(fd, value, len);
goto __end;
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);
return -EINVAL;
}
}
err = snd_config_search(config, root, &config);
if (err < 0) {
- uc_error("Unable to find subtree '%s'", root);
+ snd_error(UCM, "Unable to find subtree '%s'", root);
goto _err;
}
}
err = snd_output_stdio_open(&out, file, "w+");
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;
}
if (!config || snd_config_is_empty(config)) {
}
snd_output_close(out);
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;
}
_err:
snd_trace(UCM, "device sequence '%s/%s': %s", verb->name, name, uc_mgr_enable_str(enable));
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;
}
device = find_device(uc_mgr, verb, name, 0);
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;
}
snd_trace(UCM, "disable all devices sequence for '%s'", verb->name);
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;
}
int err = 0;
if (uc_mgr->sequence_hops > 100) {
- uc_error("error: too many inner sequences!");
+ snd_error(UCM, "error: too many inner sequences!");
return -EINVAL;
}
uc_mgr->sequence_hops++;
* its parent's cdev stored by ucm manager.
*/
if (uc_mgr->cdev == NULL) {
- uc_error("cdev is not defined!");
+ snd_error(UCM, "cdev is not defined!");
return err;
}
value_list2,
value_list3);
if (err < 0 && err != -ENOENT) {
- uc_error("cdev is not defined!");
+ snd_error(UCM, "cdev is not defined!");
return err;
}
err = get_value3(uc_mgr, &capture_ctl, "CaptureCTL",
value_list3);
if (err < 0 && err != -ENOENT) {
free(playback_ctl);
- uc_error("cdev is not defined!");
+ snd_error(UCM, "cdev is not defined!");
return err;
}
if (playback_ctl == NULL &&
capture_ctl == NULL) {
- uc_error("cdev is not defined!");
+ snd_error(UCM, "cdev is not defined!");
return -EINVAL;
}
if (playback_ctl != NULL &&
strcmp(playback_ctl, capture_ctl) != 0) {
free(playback_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;
}
if (playback_ctl != NULL) {
if (ctl == NULL) {
err = uc_mgr_open_ctl(uc_mgr, &ctl_list, cdev, 1);
if (err < 0) {
- uc_error("unable to open ctl device '%s'", cdev);
+ snd_error(UCM, "unable to open ctl device '%s'", cdev);
goto __fail;
}
ctl = ctl_list->ctl;
}
err = execute_cset(ctl, s->data.cset, s->type);
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;
}
break;
ignore_error = s->data.exec[0] == '-';
err = uc_mgr_exec(s->data.exec + (ignore_error ? 1 : 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;
}
break;
err = -EINTR;
} if (WIFEXITED(err)) {
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;
goto __fail;
}
goto __fail;
break;
default:
- uc_error("unknown sequence command %i", s->type);
+ snd_error(UCM, "unknown sequence command %i", s->type);
break;
}
}
err = execute_sequence(uc_mgr, NULL, &uc_mgr->default_list,
&uc_mgr->value_list, NULL, NULL);
if (err < 0) {
- uc_error("Unable to execute default sequence");
+ snd_error(UCM, "Unable to execute default sequence");
return err;
}
uc_mgr->default_list_executed = 1;
err = snd_config_load_string(&cfg, args, 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;
}
if (err < 0) {
if (err == -ENXIO && mgr->suppress_nodev_errors)
goto _err;
- uc_error("error: failed to import %s use case configuration %d",
- card_name, err);
+ snd_error(UCM, "error: failed to import %s use case configuration %d",
+ card_name, err);
+
goto _err;
}
err = check_empty_configuration(mgr);
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;
}
/* reload all use cases */
err = import_master_config(uc_mgr);
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);
return -EINVAL;
}
active_list);
err = set_modifier(uc_mgr, modifier, 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);
active_list);
err = set_device(uc_mgr, device, 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);
err = set_verb(uc_mgr, uc_mgr->active_verb, 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;
}
uc_mgr->active_verb = NULL;
int err;
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;
}
if (list_empty(&uc_mgr->fixedboot_list))
err = execute_sequence(uc_mgr, NULL, &uc_mgr->fixedboot_list,
&uc_mgr->value_list, NULL, NULL);
if (err < 0) {
- uc_error("Unable to execute force boot sequence");
+ snd_error(UCM, "Unable to execute force boot sequence");
return err;
}
return err;
int err;
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;
}
if (list_empty(&uc_mgr->boot_list))
err = execute_sequence(uc_mgr, NULL, &uc_mgr->boot_list,
&uc_mgr->value_list, NULL, NULL);
if (err < 0) {
- uc_error("Unable to execute boot sequence");
+ snd_error(UCM, "Unable to execute boot sequence");
return err;
}
return err;
const char *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 set_defaults(uc_mgr, false);
if (verb) {
err = set_verb(uc_mgr, verb, 1);
if (err < 0)
- uc_error("error: failed to initialize new use case: %s",
- verb_name);
+ snd_error(UCM, "error: failed to initialize new use case: %s",
+ verb_name);
+
}
return err;
}
if (uc_mgr->active_verb == NULL)
return -ENOENT;
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;
}
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;
}
xold = find_device(uc_mgr, uc_mgr->active_verb, old_device, 1);
if (uc_mgr->active_verb == NULL)
return -ENOENT;
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;
}
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;
}
xold = find_modifier(uc_mgr, uc_mgr->active_verb, old_modifier, 1);
file);
err = uc_mgr_config_load(uc_mgr->conf_format, filename, cfg);
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 0;
static int parse_is_name_safe(const char *name)
{
if (strchr(name, '.')) {
- uc_error("char '.' not allowed in '%s'", name);
+ snd_error(UCM, "char '.' not allowed in '%s'", name);
return 0;
}
return 1;
err = parse_string_substitute3(uc_mgr, cfg, &s);
if (err < 0) {
- uc_error("error: failed to get Error string");
+ snd_error(UCM, "error: failed to get Error string");
return err;
}
if (!uc_mgr->suppress_nodev_errors)
- uc_error("%s", s);
+ snd_error(UCM, "%s", s);
free(s);
return -ENXIO;
}
err = snd_config_search(cfg, "Syntax", &n);
if (err < 0) {
- uc_error("Syntax field not found in %s", filename);
+ snd_error(UCM, "Syntax field not found in %s", filename);
return -EINVAL;
}
err = snd_config_get_integer(n, &l);
if (err < 0) {
- uc_error("Syntax field is invalid in %s", filename);
+ snd_error(UCM, "Syntax field is invalid in %s", filename);
return err;
}
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;
}
/* delete this field to optimize strcmp() call in the parsing loop */
return err;
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;
}
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;
}
if (err < 0)
return err;
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;
}
err = uc_mgr_define_regex(uc_mgr, id, n);
return err;
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;
}
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 err;
if (id[0] == '@') {
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;
}
err = uc_mgr_set_variable(uc_mgr, id, s);
return err;
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;
}
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 err;
err = snd_config_search(uc_mgr->macros, mid, &m);
if (err < 0) {
- uc_error("Macro '%s' is not defined", mid);
+ snd_error(UCM, "Macro '%s' is not defined", mid);
return err;
}
goto __err_path;
snprintf(name, sizeof(name), "__%s", id);
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;
}
err = snd_config_get_ascii(n, &var);
return err;
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;
}
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;
}
const char *id;
if (snd_config_get_id(n, &id))
id = "";
- uc_error("compound type expected for Macro.%s", id);
+ snd_error(UCM, "compound type expected for Macro.%s", id);
return -EINVAL;
}
snd_config_for_each(i2, next2, n) {
return err;
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;
}
while (err1 == 0 || err2 == 0 || err3 == 0 || err4 == 0 || err5 == 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;
}
iterations--;
continue;
uc_mgr->macro_hops++;
if (uc_mgr->macro_hops > 100) {
- uc_error("Maximal macro hops reached!");
+ snd_error(UCM, "Maximal macro hops reached!");
return -EINVAL;
}
err4 = evaluate_macro(uc_mgr, cfg);
return -EINVAL;
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;
}
continue;
}
- uc_error("unknown field %s", id);
+ snd_error(UCM, "unknown field %s", id);
return -EINVAL;
}
return -EINVAL;
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;
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;
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;
}
/* parse compound */
n = snd_config_iterator_entry(i);
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;
}
if (!dot)
return 0;
if (dot[1] != '0' || dot[2] != '\0') {
- uc_error("device name %s contains a '.',"
- " and is not legacy foo.0 format", name);
+ snd_error(UCM, "device name %s contains a '.',"
+ " and is not legacy foo.0 format", name);
+
return -EINVAL;
}
*dot = '\0';
int err;
if (dev_list->type != DEVLIST_NONE) {
- uc_error("error: multiple supported or"
- " conflicting device lists");
+ snd_error(UCM, "error: multiple supported or"
+ " conflicting device lists");
+
return -EEXIST;
}
return -EINVAL;
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;
}
cmpt_seq->device = find_component_dev(uc_mgr, val);
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);
return -EINVAL;
}
const char *cmd = NULL;
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;
}
continue;
if (idx == 1) {
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;
}
snd_config_get_string(n, &cmd);
curr->type = SEQUENCE_ELEMENT_TYPE_CDEV;
err = parse_string_substitute3(uc_mgr, n, &curr->data.cdev);
if (err < 0) {
- uc_error("error: cdev requires a string!");
+ snd_error(UCM, "error: cdev requires a string!");
return err;
}
continue;
cset:
err = parse_string_substitute3(uc_mgr, n, &curr->data.cset);
if (err < 0) {
- uc_error("error: %s requires a string!", cmd);
+ snd_error(UCM, "error: %s requires a string!", cmd);
return err;
}
continue;
strcmp(cmd, "enadev") == 0,
&curr->data.cmpt_seq);
if (err < 0) {
- uc_error("error: %s requires a valid device!", cmd);
+ snd_error(UCM, "error: %s requires a valid device!", cmd);
return err;
}
continue;
device:
err = parse_string_substitute3(uc_mgr, n, &curr->data.device);
if (err < 0) {
- uc_error("error: %s requires a valid device!", cmd);
+ snd_error(UCM, "error: %s requires a valid device!", cmd);
return err;
}
continue;
curr->type = SEQUENCE_ELEMENT_TYPE_SYSSET;
err = parse_string_substitute3(uc_mgr, n, &curr->data.sysw);
if (err < 0) {
- uc_error("error: sysw requires a string!");
+ snd_error(UCM, "error: sysw requires a string!");
return err;
}
continue;
curr->type = SEQUENCE_ELEMENT_TYPE_SLEEP;
err = parse_integer_substitute3(uc_mgr, n, &curr->data.sleep);
if (err < 0) {
- uc_error("error: usleep requires integer!");
+ snd_error(UCM, "error: usleep requires integer!");
return err;
}
continue;
curr->type = SEQUENCE_ELEMENT_TYPE_SLEEP;
err = parse_integer_substitute3(uc_mgr, n, &curr->data.sleep);
if (err < 0) {
- uc_error("error: msleep requires integer!");
+ snd_error(UCM, "error: msleep requires integer!");
return err;
}
curr->data.sleep *= 1000L;
exec:
err = parse_string_substitute3(uc_mgr, n, &curr->data.exec);
if (err < 0) {
- uc_error("error: exec requires a string!");
+ snd_error(UCM, "error: exec requires a string!");
return err;
}
continue;
curr->type = SEQUENCE_ELEMENT_TYPE_CFGSAVE;
err = parse_string_substitute3(uc_mgr, n, &curr->data.cfgsave);
if (err < 0) {
- uc_error("error: sysw requires a string!");
+ snd_error(UCM, "error: sysw requires a string!");
return err;
}
continue;
if (strcmp(cmd, "comment") == 0)
goto skip;
- uc_error("error: sequence command '%s' is ignored", cmd);
+ snd_error(UCM, "error: sequence command '%s' is ignored", cmd);
skip:
list_del(&curr->list);
int err;
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;
}
case SND_CONFIG_TYPE_REAL:
err = snd_config_get_ascii(n, &s);
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;
}
break;
case SND_CONFIG_TYPE_STRING:
err = parse_string_substitute(uc_mgr, n, &s);
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;
}
break;
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;
}
err = uc_mgr_add_value(base, id, s);
if (strcmp(id, "Comment") == 0) {
err = parse_string_substitute3(uc_mgr, n, &modifier->comment);
if (err < 0) {
- uc_error("error: failed to get modifier comment");
+ snd_error(UCM, "error: failed to get modifier comment");
return err;
}
continue;
err = parse_device_list(uc_mgr, &modifier->dev_list,
DEVLIST_SUPPORTED, n);
if (err < 0) {
- uc_error("error: failed to parse supported"
- " device list");
+ snd_error(UCM, "error: failed to parse supported"
+ " device list");
+
return err;
}
}
err = parse_device_list(uc_mgr, &modifier->dev_list,
DEVLIST_CONFLICTING, n);
if (err < 0) {
- uc_error("error: failed to parse conflicting"
- " device list");
+ snd_error(UCM, "error: failed to parse conflicting"
+ " device list");
+
return err;
}
}
if (strcmp(id, "EnableSequence") == 0) {
err = parse_sequence(uc_mgr, &modifier->enable_list, n);
if (err < 0) {
- uc_error("error: failed to parse modifier"
- " enable sequence");
+ snd_error(UCM, "error: failed to parse modifier"
+ " enable sequence");
+
return err;
}
continue;
if (strcmp(id, "DisableSequence") == 0) {
err = parse_sequence(uc_mgr, &modifier->disable_list, n);
if (err < 0) {
- uc_error("error: failed to parse modifier"
- " disable sequence");
+ snd_error(UCM, "error: failed to parse modifier"
+ " disable sequence");
+
return err;
}
continue;
if (strcmp(id, "TransitionSequence") == 0) {
err = parse_transition(uc_mgr, &modifier->transition_list, n);
if (err < 0) {
- uc_error("error: failed to parse transition"
- " modifier");
+ snd_error(UCM, "error: failed to parse transition"
+ " modifier");
+
return err;
}
continue;
if (strcmp(id, "Value") == 0) {
err = parse_value(uc_mgr, &modifier->value_list, n);
if (err < 0) {
- uc_error("error: failed to parse Value");
+ snd_error(UCM, "error: failed to parse Value");
return err;
}
continue;
if (strcmp(id, "Comment") == 0) {
err = parse_string_substitute3(uc_mgr, n, &device->comment);
if (err < 0) {
- uc_error("error: failed to get device comment");
+ snd_error(UCM, "error: failed to get device comment");
return err;
}
continue;
err = parse_device_list(uc_mgr, &device->dev_list,
DEVLIST_SUPPORTED, n);
if (err < 0) {
- uc_error("error: failed to parse supported"
- " device list");
+ snd_error(UCM, "error: failed to parse supported"
+ " device list");
+
return err;
}
}
err = parse_device_list(uc_mgr, &device->dev_list,
DEVLIST_CONFLICTING, n);
if (err < 0) {
- uc_error("error: failed to parse conflicting"
- " device list");
+ snd_error(UCM, "error: failed to parse conflicting"
+ " device list");
+
return err;
}
}
uc_dbg("EnableSequence");
err = parse_sequence(uc_mgr, &device->enable_list, n);
if (err < 0) {
- uc_error("error: failed to parse device enable"
- " sequence");
+ snd_error(UCM, "error: failed to parse device enable"
+ " sequence");
+
return err;
}
continue;
uc_dbg("DisableSequence");
err = parse_sequence(uc_mgr, &device->disable_list, n);
if (err < 0) {
- uc_error("error: failed to parse device disable"
- " sequence");
+ snd_error(UCM, "error: failed to parse device disable"
+ " sequence");
+
return err;
}
continue;
uc_dbg("TransitionSequence");
err = parse_transition(uc_mgr, &device->transition_list, n);
if (err < 0) {
- uc_error("error: failed to parse transition"
- " device");
+ snd_error(UCM, "error: failed to parse transition"
+ " device");
+
return err;
}
continue;
if (strcmp(id, "Value") == 0) {
err = parse_value(uc_mgr, &device->value_list, n);
if (err < 0) {
- uc_error("error: failed to parse Value");
+ snd_error(UCM, "error: failed to parse Value");
return err;
}
continue;
return -EINVAL;
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;
}
err = parse_string_substitute3(uc_mgr, n, &name2);
if (err < 0) {
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;
}
if (list_empty(&device->dev_list.list)) {
device->dev_list.type = dst_type;
} else {
- uc_error("error: incompatible device list type ('%s', '%s')",
- device->name, src);
+ snd_error(UCM, "error: incompatible device list type ('%s', '%s')",
+ device->name, src);
+
return -EINVAL;
}
}
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;
}
dev = list_entry(pos, struct ucm_dev_name, list);
err = uc_mgr_rename_device(verb, dev->name1, dev->name2);
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;
}
}
dev = list_entry(pos, struct ucm_dev_name, list);
err = uc_mgr_remove_device(verb, dev->name2);
if (err < 0) {
- uc_error("error: cannot remove device '%s'", dev->name2);
+ snd_error(UCM, "error: cannot remove device '%s'", dev->name2);
return err;
}
}
uc_dbg("Parse EnableSequence");
err = parse_sequence(uc_mgr, &verb->enable_list, n);
if (err < 0) {
- uc_error("error: failed to parse verb enable sequence");
+ snd_error(UCM, "error: failed to parse verb enable sequence");
return err;
}
continue;
uc_dbg("Parse DisableSequence");
err = parse_sequence(uc_mgr, &verb->disable_list, n);
if (err < 0) {
- uc_error("error: failed to parse verb disable sequence");
+ snd_error(UCM, "error: failed to parse verb disable sequence");
return err;
}
continue;
uc_dbg("Parse TransitionSequence");
err = parse_transition(uc_mgr, &verb->transition_list, n);
if (err < 0) {
- uc_error("error: failed to parse transition sequence");
+ snd_error(UCM, "error: failed to parse transition sequence");
return err;
}
continue;
if (strcmp(id, "SectionVerb") == 0) {
err = parse_verb(uc_mgr, verb, n);
if (err < 0) {
- uc_error("error: %s failed to parse verb",
- file);
+ snd_error(UCM, "error: %s failed to parse verb",
+ file);
+
goto _err;
}
continue;
err = parse_compound(uc_mgr, n,
parse_device_name, verb, NULL);
if (err < 0) {
- uc_error("error: %s failed to parse device",
- file);
+ snd_error(UCM, "error: %s failed to parse device",
+ file);
+
goto _err;
}
continue;
err = parse_compound(uc_mgr, n,
parse_modifier_name, verb, NULL);
if (err < 0) {
- uc_error("error: %s failed to parse modifier",
- file);
+ snd_error(UCM, "error: %s failed to parse modifier",
+ file);
+
goto _err;
}
continue;
if (strcmp(id, "RenameDevice") == 0) {
err = parse_dev_name_list(uc_mgr, n, &verb->rename_list);
if (err < 0) {
- uc_error("error: %s failed to parse device rename",
- file);
+ snd_error(UCM, "error: %s failed to parse device rename",
+ file);
+
goto _err;
}
continue;
if (strcmp(id, "RemoveDevice") == 0) {
err = parse_dev_name_list(uc_mgr, n, &verb->remove_list);
if (err < 0) {
- uc_error("error: %s failed to parse device remove",
- file);
+ snd_error(UCM, "error: %s failed to parse device remove",
+ file);
+
goto _err;
}
continue;
if (uc_mgr->conf_format > 3 && strcmp(id, "LibraryConfig") == 0) {
err = parse_libconfig(uc_mgr, n);
if (err < 0) {
- uc_error("error: failed to parse LibConfig");
+ snd_error(UCM, "error: failed to parse LibConfig");
goto _err;
}
continue;
/* use case verb must have at least 1 device */
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;
}
/* do device rename and delete */
err = verb_device_management(verb);
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;
}
if (_vfile) {
err = parse_string_substitute3(uc_mgr, n, &file);
if (err < 0) {
- uc_error("failed to get File");
+ snd_error(UCM, "failed to get File");
goto __error;
}
}
if (_vcomment) {
err = parse_string_substitute3(uc_mgr, n, &comment);
if (err < 0) {
- uc_error("error: failed to get Comment");
+ snd_error(UCM, "error: failed to get Comment");
goto __error;
}
}
continue;
}
- uc_error("unknown field '%s' in Variant section", id);
+ snd_error(UCM, "unknown field '%s' in Variant section", id);
err = -EINVAL;
goto __error;
}
int err;
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;
}
err = parse_get_safe_name(uc_mgr, cfg, NULL, &use_case_name);
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;
}
if (strcmp(id, "File") == 0) {
err = parse_string_substitute3(uc_mgr, n, &file);
if (err < 0) {
- uc_error("failed to get File");
+ snd_error(UCM, "failed to get File");
goto __error;
}
continue;
if (strncmp(id, "Comment", 7) == 0) {
err = parse_string_substitute3(uc_mgr, n, &comment);
if (err < 0) {
- uc_error("error: failed to get Comment");
+ snd_error(UCM, "error: failed to get Comment");
goto __error;
}
continue;
continue;
}
- uc_error("unknown field '%s' in SectionUseCase", id);
+ snd_error(UCM, "unknown field '%s' in SectionUseCase", id);
}
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;
goto __error;
}
/* do we have both use case name and file ? */
if (!file) {
- uc_error("error: use case missing file");
+ snd_error(UCM, "error: use case missing file");
err = -EINVAL;
goto __error;
}
int err;
if (!list_empty(&uc_mgr->fixedboot_list)) {
- uc_error("FixedBoot list is not empty");
+ snd_error(UCM, "FixedBoot list is not empty");
return -EINVAL;
}
err = parse_sequence(uc_mgr, &uc_mgr->fixedboot_list, cfg);
if (err < 0) {
- uc_error("Unable to parse FixedBootSequence");
+ snd_error(UCM, "Unable to parse FixedBootSequence");
return err;
}
int err;
if (!list_empty(&uc_mgr->boot_list)) {
- uc_error("Boot list is not empty");
+ snd_error(UCM, "Boot list is not empty");
return -EINVAL;
}
err = parse_sequence(uc_mgr, &uc_mgr->boot_list, cfg);
if (err < 0) {
- uc_error("Unable to parse BootSequence");
+ snd_error(UCM, "Unable to parse BootSequence");
return err;
}
int err;
if (!list_empty(&uc_mgr->default_list)) {
- uc_error("Default list is not empty");
+ snd_error(UCM, "Default list is not empty");
return -EINVAL;
}
err = parse_sequence(uc_mgr, &uc_mgr->default_list, cfg);
if (err < 0) {
- uc_error("Unable to parse SectionDefaults");
+ snd_error(UCM, "Unable to parse SectionDefaults");
return err;
}
int err;
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;
}
if (strcmp(id, "Comment") == 0) {
err = parse_string_substitute3(uc_mgr, n, &uc_mgr->comment);
if (err < 0) {
- uc_error("error: failed to get master comment");
+ snd_error(UCM, "error: failed to get master comment");
return err;
}
continue;
if (strcmp(id, "ValueDefaults") == 0) {
err = parse_value(uc_mgr, &uc_mgr->value_list, n);
if (err < 0) {
- uc_error("error: failed to parse ValueDefaults");
+ snd_error(UCM, "error: failed to parse ValueDefaults");
return err;
}
continue;
if (uc_mgr->conf_format > 3 && strcmp(id, "LibraryConfig") == 0) {
err = parse_libconfig(uc_mgr, n);
if (err < 0) {
- uc_error("error: failed to parse LibraryConfig");
+ snd_error(UCM, "error: failed to parse LibraryConfig");
return err;
}
continue;
if (strcmp(id, "Syntax") == 0)
continue;
- uc_error("unknown master file field %s", id);
+ snd_error(UCM, "unknown master file field %s", id);
}
return 0;
}
card = -1;
if (snd_card_next(&card) < 0 || card < 0) {
- uc_error("no soundcards found...");
+ snd_error(UCM, "no soundcards found...");
return -1;
}
}
if (snd_card_next(&card) < 0) {
- uc_error("snd_card_next");
+ snd_error(UCM, "snd_card_next");
break;
}
}
int err;
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;
}
n = snd_config_iterator_entry(i);
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;
}
if (strcmp(id, "Version") == 0) {
err = parse_integer_substitute(uc_mgr, n2, &version);
if (err < 0) {
- uc_error("unable to parse UcmDirectory");
+ snd_error(UCM, "unable to parse UcmDirectory");
goto __error;
}
if (version < 1 || version > 2) {
- uc_error("Version must be 1 or 2");
+ snd_error(UCM, "Version must be 1 or 2");
err = -EINVAL;
goto __error;
}
if (strcmp(id, "Directory") == 0) {
err = parse_string_substitute(uc_mgr, n2, &dir);
if (err < 0) {
- uc_error("unable to parse Directory");
+ snd_error(UCM, "unable to parse Directory");
goto __error;
}
continue;
if (strcmp(id, "File") == 0) {
err = parse_string_substitute(uc_mgr, n2, &file);
if (err < 0) {
- uc_error("unable to parse File");
+ snd_error(UCM, "unable to parse File");
goto __error;
}
continue;
}
- uc_error("unknown UseCasePath field %s", id);
+ snd_error(UCM, "unknown UseCasePath field %s", id);
}
if (dir == NULL) {
- uc_error("Directory is not defined in %s!", filename);
+ snd_error(UCM, "Directory is not defined in %s!", filename);
goto __next;
}
if (file == NULL) {
- uc_error("File is not defined in %s!", filename);
+ snd_error(UCM, "File is not defined in %s!", filename);
goto __next;
}
int err;
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;
}
if (uc_mgr->conf_format > 3 && strcmp(id, "LibraryConfig") == 0) {
err = parse_libconfig(uc_mgr, n);
if (err < 0) {
- uc_error("error: failed to parse LibConfig");
+ snd_error(UCM, "error: failed to parse LibConfig");
return err;
}
continue;
if (strcmp(id, "Syntax") == 0)
continue;
- uc_error("unknown toplevel field %s", id);
+ snd_error(UCM, "unknown toplevel field %s", id);
}
return -ENOENT;
ucm_filename(filename, sizeof(filename), 2, NULL, "ucm.conf");
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;
}
err = uc_mgr_config_load(uc_mgr->conf_format, filename, cfg);
if (err < 0) {
- uc_error("error: could not parse configuration for card %s",
- uc_mgr->card_name);
+ snd_error(UCM, "error: could not parse configuration for card %s",
+ uc_mgr->card_name);
+
goto __error;
}
if (strncmp(name, "hw:", 3) == 0) {
err = get_by_card(uc_mgr, name);
if (err < 0) {
- uc_error("card '%s' is not valid", name);
+ snd_error(UCM, "card '%s' is not valid", name);
goto __error;
}
} else if (strncmp(name, "strict:", 7)) {
err = scandir64(filename, &namelist, filename_filter, SORTFUNC);
if (err < 0) {
err = -errno;
- uc_error("error: could not scan directory %s: %s",
- filename, strerror(-err));
+ snd_error(UCM, "error: could not scan directory %s: %s",
+ filename, strerror(-err));
+
return err;
}
cnt = err;
if (err == -ENOENT || err == -ENXIO)
continue;
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;
}
err = snd_use_case_get(uc_mgr, "comment", (const char **)&s);
goto __err;
err = snd_config_search(cfg, "Syntax", &c);
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);
continue;
}
err = snd_config_get_integer(c, &l);
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);
goto __err;
}
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);
goto __err;
}
if (uc_mgr->conf_format >= 3) {
err = get_string(eval, "Empty", &string1);
if (err < 0 && err != -ENOENT) {
- uc_error("String error (If.Condition.Empty)");
+ snd_error(UCM, "String error (If.Condition.Empty)");
return -EINVAL;
}
err = get_string(eval, "String1", &string1);
if (err < 0 && err != -ENOENT) {
- uc_error("String error (If.Condition.String1)");
+ snd_error(UCM, "String error (If.Condition.String1)");
return -EINVAL;
}
err = get_string(eval, "String2", &string2);
if (err < 0 && err != -ENOENT) {
- uc_error("String error (If.Condition.String2)");
+ snd_error(UCM, "String error (If.Condition.String2)");
return -EINVAL;
}
if (string1 || string2) {
if (string1 == NULL) {
- uc_error("If.Condition.String1 not defined");
+ snd_error(UCM, "If.Condition.String1 not defined");
return -EINVAL;
}
if (string2 == NULL) {
- uc_error("If.Condition.String2 not defined");
+ snd_error(UCM, "If.Condition.String2 not defined");
return -EINVAL;
}
err = uc_mgr_get_substituted_value(uc_mgr, &s1, string1);
err = get_string(eval, "Haystack", &string1);
if (err < 0 && err != -ENOENT) {
- uc_error("String error (If.Condition.Haystack)");
+ snd_error(UCM, "String error (If.Condition.Haystack)");
return -EINVAL;
}
err = get_string(eval, "Needle", &string2);
if (err < 0 && err != -ENOENT) {
- uc_error("String error (If.Condition.Needle)");
+ snd_error(UCM, "String error (If.Condition.Needle)");
return -EINVAL;
}
if (string1 || string2) {
if (string1 == NULL) {
- uc_error("If.Condition.Haystack not defined");
+ snd_error(UCM, "If.Condition.Haystack not defined");
return -EINVAL;
}
if (string2 == NULL) {
- uc_error("If.Condition.Needle not defined");
+ snd_error(UCM, "If.Condition.Needle not defined");
return -EINVAL;
}
err = uc_mgr_get_substituted_value(uc_mgr, &s1, string1);
return err;
}
- uc_error("Unknown String condition arguments");
+ snd_error(UCM, "Unknown String condition arguments");
return -EINVAL;
}
err = get_string(eval, "String", &string);
if (err < 0) {
- uc_error("RegexMatch error (If.Condition.String)");
+ snd_error(UCM, "RegexMatch error (If.Condition.String)");
return -EINVAL;
}
err = get_string(eval, "Regex", ®ex_string);
if (err < 0) {
- uc_error("RegexMatch error (If.Condition.Regex)");
+ snd_error(UCM, "RegexMatch error (If.Condition.Regex)");
return -EINVAL;
}
return err;
err = regcomp(&re, s, options);
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);
return -EINVAL;
}
err = get_string(eval, "Device", &device);
if (err < 0 && err != -ENOENT) {
- uc_error("ControlExists error (If.Condition.Device)");
+ snd_error(UCM, "ControlExists error (If.Condition.Device)");
return -EINVAL;
}
err = get_string(eval, "Control", &ctldef);
if (err < 0) {
- uc_error("ControlExists error (If.Condition.Control)");
+ snd_error(UCM, "ControlExists error (If.Condition.Control)");
return -EINVAL;
}
err = get_string(eval, "ControlEnum", &enumval);
if (err < 0 && err != -ENOENT) {
- uc_error("ControlExists error (If.Condition.ControlEnum)");
+ snd_error(UCM, "ControlExists error (If.Condition.ControlEnum)");
return -EINVAL;
}
err = snd_ctl_ascii_elem_id_parse(elem_id, s);
free(s);
if (err < 0) {
- uc_error("unable to parse element identificator (%s)", ctldef);
+ snd_error(UCM, "unable to parse element identificator (%s)", ctldef);
return -EINVAL;
}
if (device == NULL) {
ctl = uc_mgr_get_ctl(uc_mgr);
if (ctl == NULL) {
- uc_error("cannot determine control device");
+ snd_error(UCM, "cannot determine control device");
return -EINVAL;
}
} else {
char *s;
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;
}
err = get_string(eval, "Path", &path);
if (err < 0) {
- uc_error("Path error (If.Condition.Path)");
+ snd_error(UCM, "Path error (If.Condition.Path)");
return -EINVAL;
}
err = get_string(eval, "Mode", &mode);
if (err < 0 && err != -ENOENT) {
- uc_error("Path error (If.Condition.Mode)");
+ snd_error(UCM, "Path error (If.Condition.Mode)");
return -EINVAL;
}
} else if (strcasecmp(s, "exec") == 0) {
amode = X_OK;
} else {
- uc_error("Path unknown mode '%s' (If.Condition.Mode)", s);
+ snd_error(UCM, "Path unknown mode '%s' (If.Condition.Mode)", s);
free(s);
return -EINVAL;
}
int err;
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;
}
err = get_string(eval, "Type", &type);
if (err < 0) {
- uc_error("type block error (If.Condition)");
+ snd_error(UCM, "type block error (If.Condition)");
return -EINVAL;
}
if (strcmp(type, "Path") == 0)
return if_eval_path(uc_mgr, eval);
- uc_error("unknown If.Condition.Type");
+ snd_error(UCM, "unknown If.Condition.Type");
return -EINVAL;
}
*result = NULL;
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;
}
if (snd_config_search(cond, "Condition", &expr) < 0) {
- uc_error("condition block expected (If)");
+ snd_error(UCM, "condition block expected (If)");
return -EINVAL;
}
err = snd_config_search(cond, "True", &_true);
if (err < 0 && err != -ENOENT) {
- uc_error("true block error (If)");
+ snd_error(UCM, "true block error (If)");
return -EINVAL;
}
err = snd_config_search(cond, "False", &_false);
if (err < 0 && err != -ENOENT) {
- uc_error("false block error (If)");
+ snd_error(UCM, "false block error (If)");
return -EINVAL;
}
err = snd_config_search(cond, "Before", before);
if (err < 0 && err != -ENOENT) {
- uc_error("before block identifier error");
+ snd_error(UCM, "before block identifier error");
return -EINVAL;
}
err = snd_config_search(cond, "After", after);
if (err < 0 && err != -ENOENT) {
- uc_error("before block identifier error");
+ snd_error(UCM, "before block identifier error");
return -EINVAL;
}
int err;
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;
}
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;
}
if (p == -1) {
err = -errno;
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;
}
if (p == 0) {
f = open("/dev/null", O_RDWR);
if (f == -1) {
- uc_error("pid %d cannot open /dev/null for redirect %s -- %s",
- getpid(), prog, strerror(errno));
+ snd_error(UCM, "pid %d cannot open /dev/null for redirect %s -- %s",
+ getpid(), prog, strerror(errno));
+
exit(1);
}
*result = NULL;
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;
}
err = get_string(inc, "File", &file);
if (err < 0) {
- uc_error("file expected (Include)");
+ snd_error(UCM, "file expected (Include)");
return -EINVAL;
}
err = snd_config_search(inc, "Before", before);
if (err < 0 && err != -ENOENT) {
- uc_error("before block identifier error");
+ snd_error(UCM, "before block identifier error");
return -EINVAL;
}
err = snd_config_search(inc, "After", after);
if (err < 0 && err != -ENOENT) {
- uc_error("before block identifier error");
+ snd_error(UCM, "before block identifier error");
return -EINVAL;
}
int err, array, idx;
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 snd_config_merge(dst, src, 0); /* merge / append mode */
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;
}
array = snd_config_is_array(dst);
if (array < 0) {
- uc_error("destination configuration node is not a compound");
+ snd_error(UCM, "destination configuration node is not a compound");
return array;
}
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;
}
int err;
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;
}
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;
}
char *cdev;
};
-#define uc_error SNDERR
-
#ifdef UC_MGR_DEBUG
#define uc_dbg SNDERR
#else
int err;
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;
}
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;
}
err = get_string(eval, "String", &string);
if (err < 0) {
- uc_error("DefineRegex error (String)");
+ snd_error(UCM, "DefineRegex error (String)");
return -EINVAL;
}
err = get_string(eval, "Regex", ®ex_string);
if (err < 0) {
- uc_error("DefineRegex error (Regex string)");
+ snd_error(UCM, "DefineRegex error (Regex string)");
return -EINVAL;
}
if (err == -ENOENT) {
options = REG_EXTENDED;
} else if (err < 0) {
- uc_error("DefineRegex error (Flags string)");
+ snd_error(UCM, "DefineRegex error (Flags string)");
return -EINVAL;
} else {
while (*flags_string) {
options |= REG_NEWLINE;
break;
default:
- uc_error("DefineRegex error (unknown flag '%c')", *flags_string);
+ snd_error(UCM, "DefineRegex error (unknown flag '%c')", *flags_string);
return -EINVAL;
}
flags_string++;
err = regcomp(&re, s, options);
free(s);
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;
}
static char *rval_card_number_by_name(snd_use_case_mgr_t *uc_mgr, const char *id)
{
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;
}
- 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));
}
struct ctl_list *ctl_list;
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;
}
- 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);
if (ctl_list == NULL)
int err;
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;
}
err = snd_config_load_string(&config, query, 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;
}
if (iter->init && iter->init(uc_mgr, iter, config))
goto null;
if (snd_config_search(config, "field", &d)) {
- uc_error("Lookups require field!");
+ snd_error(UCM, "Lookups require field!");
goto null;
}
if (snd_config_get_string(d, &s))
}
}
if (iter->fcn == NULL) {
- uc_error("Unknown field value '%s'", s);
+ snd_error(UCM, "Unknown field value '%s'", s);
goto null;
}
if (snd_config_search(config, "regex", &d)) {
- uc_error("Lookups require regex!");
+ snd_error(UCM, "Lookups require regex!");
goto null;
}
if (snd_config_get_string(d, &s))
goto null;
err = regcomp(&re, s, REG_EXTENDED | REG_ICASE);
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;
}
snprintf(num, sizeof(num), "%d", snd_ctl_card_info_get_card(iter->info));
return strdup(num);
} else {
- uc_error("Unknown return type '%s'", s);
+ snd_error(UCM, "Unknown return type '%s'", s);
return NULL;
}
}
if (err < 0) {
if (err == -ENOENT)
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 iter;
else if (strcasecmp(s, "capture") == 0)
stream = SND_PCM_STREAM_CAPTURE;
else {
- uc_error("Unknown stream type '%s'", s);
+ snd_error(UCM, "Unknown stream type '%s'", s);
return -EINVAL;
}
}
if (snd_config_search(config, "ctl", &d) || snd_config_get_string(d, &s)) {
iter->ctl_list = uc_mgr_get_master_ctl(uc_mgr);
if (iter->ctl_list == NULL) {
- uc_error("Control device is not defined!");
+ snd_error(UCM, "Control device is not defined!");
return -EINVAL;
}
} else {
err = uc_mgr_open_ctl(uc_mgr, &iter->ctl_list, s, 1);
if (err < 0) {
- uc_error("Control device '%s' not found", s);
+ snd_error(UCM, "Control device '%s' not found", s);
return -EINVAL;
}
}
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;
}
for (t = types; t->name; t++)
if (strcasecmp(t->name, s) == 0)
return t->init(iter, config);
- uc_error("Device type '%s' is invalid", s);
+ snd_error(UCM, "Device type '%s' is invalid", s);
return -EINVAL;
}
*pos = -1;
return 0;
}
- uc_error("Unable to find field '%s'", name);
+ snd_error(UCM, "Unable to find field '%s'", name);
return -1;
}
if (!snd_config_get_integer(d, &v))
if (snd_config_get_string(d, &s))
return -1;
if (safe_strtol(s, &v)) {
- uc_error("Unable to parse position '%s'", s);
+ snd_error(UCM, "Unable to parse position '%s'", s);
return -1;
}
fin:
err = snd_config_load_string(&config, cfg, 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;
}
if (snd_config_search(config, "type", &d)) {
} else if (strcasecmp(s, "hex") == 0) {
*type = RANGE_TYPE_HEX;
} else {
- uc_error("Unknown range type '%s'", s);
+ snd_error(UCM, "Unknown range type '%s'", s);
}
}
*pos = 0;
if (*size <= 0)
*size = 1;
if (*pos < 0) {
- uc_error("Invalid start position");
+ snd_error(UCM, "Invalid start position");
retval = -1;
goto null;
}
return NULL;
if (id[0] == '[') {
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;
}
s = strchr(id, ']');
strncpy(link, id + 1, len);
link[len] = '\0';
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;
}
id = s + 1;
if (S_ISLNK(sb.st_mode)) {
len = readlink(path, link, sizeof(link) - 1);
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;
}
link[len] = '\0';
fd = open(path, O_RDONLY);
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;
}
len = sizeof(path) - 1;
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);
return NULL;
}
if (range_size > 0) {
if (range_size > len) {
- uc_error("sysfs EOB for '%s'", path);
+ snd_error(UCM, "sysfs EOB for '%s'", path);
close(fd);
return NULL;
} else {
len = read(fd, path, len);
close(fd);
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;
}
if (type == RANGE_TYPE_HEX && range_start >= 0) {
char top_path[32], *s;
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;
}
s = get_card_number(uc_mgr_get_master_ctl(uc_mgr));
bool ignore_not_found = false;
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;
}
int err;
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;
}
err = _snd_eval_string(&dst, e, rval_eval_var_cb, uc_mgr);
if (err < 0) {
- uc_error("unable to evaluate '%s'", e);
+ snd_error(UCM, "unable to evaluate '%s'", e);
return NULL;
}
err = snd_config_get_ascii(dst, &r);
int err;
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;
}
err = snd_config_get_id(node, &id);
err = _snd_eval_string(&dst, s + 8, rval_eval_var_cb, uc_mgr);
free(s);
if (err < 0) {
- uc_error("unable to evaluate '%s'", e);
+ snd_error(UCM, "unable to evaluate '%s'", e);
return err;
}
err = snd_config_set_id(dst, id);
if (tmp) {
strncpy(r, value, tmp + 1 - value);
r[tmp + 1 - value] = '\0';
- uc_error("variable '%s' is not known!", r);
+ snd_error(UCM, "variable '%s' is not known!", r);
} else {
- uc_error("variable reference '%s' is not complete", value);
+ snd_error(UCM, "variable reference '%s' is not complete", value);
}
goto __error;
__match2:
goto __direct_fcn2;
tmp = uc_mgr_get_variable(uc_mgr, v2 + 1);
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;
} else {
rval = fcn2(uc_mgr, tmp);
}
strncpy(r, value, idsize);
r[idsize] = '\0';
- uc_error("variable '%s' is %s in this context!", r,
- rval ? "empty" : "not defined");
+ snd_error(UCM, "variable '%s' is %s in this context!", r,
+ rval ? "empty" : "not defined");
+
err = -EINVAL;
goto __error;
}
return err;
err = snd_config_set_id(node, s);
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);
return err;
}
if (e == NULL)
return "/sys";
if (*e == '\0')
- uc_error("no sysfs root!");
+ snd_error(UCM, "no sysfs root!");
return e;
}
if (ctl_list2->slave)
continue;
if (ctl_list) {
- uc_error("multiple control device names were found!");
+ snd_error(UCM, "multiple control device names were found!");
return NULL;
}
ctl_list = ctl_list2;
if (err == 0)
id = snd_ctl_card_info_get_id(info);
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);
return err >= 0 ? -EINVAL : err;
}
if (!fp) {
err = -errno;
__err_open:
- uc_error("could not open configuration file %s", file);
+ snd_error(UCM, "could not open configuration file %s", file);
return err;
}
err = snd_input_stdio_attach(&in, fp, 1);
default_paths[1] = NULL;
err = _snd_config_load_with_include(top, in, 0, default_paths);
if (err < 0) {
- uc_error("could not load configuration file %s", file);
+ snd_error(UCM, "could not load configuration file %s", file);
if (in)
snd_input_close(in);
return err;