return 1;
}
if (snd_config_get_type(conf) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("Invalid type for server %s definition", srvname);
+ snd_error(ASERVER, "Invalid type for server %s definition", srvname);
return -EINVAL;
}
snd_config_for_each(i, next, conf) {
}
Py_XDECREF(obj1);
} else {
- SNDERR("Unable to create InternalMixer object");
+ snd_error(MIXER, "Unable to create InternalMixer object");
return NULL;
}
if (obj2) {
PyDict_SetItemString(mdict, "mixer", obj2);
priv->py_mixer = obj2;
} else {
- SNDERR("Unable to create InternalMixer object");
+ snd_error(MIXER, "Unable to create InternalMixer object");
return -EIO;
}
Py_XDECREF(obj);
priv->py_event_func = PyDict_GetItemString(mdict, "event");
if (priv->py_event_func == NULL) {
- SNDERR("Unable to find python function 'event'");
+ snd_error(MIXER, "Unable to find python function 'event'");
return -EIO;
}
return 0;
fp = fopen(file, "r");
if (fp == NULL) {
- SNDERR("Unable to find python module '%s'", file);
+ snd_error(MIXER, "Unable to find python module '%s'", file);
return -ENODEV;
}
strcat(xlib, lib);
h = snd_dlopen(xlib, RTLD_NOW, errbuf, sizeof(errbuf));
if (h == NULL) {
- SNDERR("Unable to open library '%s': %s", xlib, errbuf);
+ snd_error(MIXER, "Unable to open library '%s': %s", xlib, errbuf);
goto __error;
}
initpriv = dlsym(h, "alsa_mixer_sbasic_initpriv");
if (initpriv == NULL) {
- SNDERR("Symbol 'alsa_mixer_sbasic_initpriv' was not found in '%s'", xlib);
+ snd_error(MIXER, "Symbol 'alsa_mixer_sbasic_initpriv' was not found in '%s'", xlib);
goto __error;
}
priv->ops.event = dlsym(h, "alsa_mixer_sbasic_event");
if (priv->ops.event == NULL) {
- SNDERR("Symbol 'alsa_mixer_sbasic_event' was not found in '%s'", xlib);
+ snd_error(MIXER, "Symbol 'alsa_mixer_sbasic_event' was not found in '%s'", xlib);
goto __error;
}
priv->ops.selreg = dlsym(h, "alsa_mixer_sbasic_selreg");
if (priv->ops.selreg == NULL) {
- SNDERR("Symbol 'alsa_mixer_sbasic_selreg' was not found in '%s'", xlib);
+ snd_error(MIXER, "Symbol 'alsa_mixer_sbasic_selreg' was not found in '%s'", xlib);
goto __error;
}
priv->ops.sidreg = dlsym(h, "alsa_mixer_sbasic_sidreg");
if (priv->ops.sidreg == NULL) {
- SNDERR("Symbol 'alsa_mixer_sbasic_sidreg' was not found in '%s'", xlib);
+ snd_error(MIXER, "Symbol 'alsa_mixer_sbasic_sidreg' was not found in '%s'", xlib);
goto __error;
}
free(xlib);
{
snd_async_signo = __libc_allocate_rtsig(0);
if (snd_async_signo < 0) {
- SNDERR("Unable to find a RT signal to use for snd_async");
+ snd_error(CORE, "Unable to find a RT signal to use for snd_async");
exit(1);
}
}
assert(!previous_action.sa_sigaction);
err = sigaction(snd_async_signo, &act, &previous_action);
if (err < 0) {
- SYSERR("sigaction");
+ snd_errornum(CORE, "sigaction");
return -errno;
}
}
if (!was_empty && list_empty(&snd_async_handlers)) {
err = sigaction(snd_async_signo, &previous_action, NULL);
if (err < 0) {
- SYSERR("sigaction");
+ snd_errornum(CORE, "sigaction");
return -errno;
}
memset(&previous_action, 0, sizeof(previous_action));
err = add_include_path(input->current, str);
if (err < 0) {
- SNDERR("Cannot add search dir %s", str);
+ snd_error(CORE, "Cannot add search dir %s", str);
free(str);
return err;
}
}
if (err < 0) {
- SNDERR("Cannot access file %s", str);
+ snd_error(CORE, "Cannot access file %s", str);
free(str);
return err;
}
free(s);
if (n) {
if (n->type != SND_CONFIG_TYPE_REAL) {
- SNDERR("%s is not a real", *id);
+ snd_error(CORE, "%s is not a real", *id);
return -EINVAL;
}
} else {
free(s);
if (n) {
if (n->type != SND_CONFIG_TYPE_INTEGER && n->type != SND_CONFIG_TYPE_INTEGER64) {
- SNDERR("%s is not an integer", *id);
+ snd_error(CORE, "%s is not an integer", *id);
return -EINVAL;
}
} else {
}
if (n) {
if (n->type != SND_CONFIG_TYPE_STRING) {
- SNDERR("%s is not a string", *id);
+ snd_error(CORE, "%s is not a string", *id);
free(s);
return -EINVAL;
}
if (!skip) {
if (n) {
if (n->type != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("%s is not a compound", id);
+ snd_error(CORE, "%s is not a compound", id);
err = -EINVAL;
goto __end;
}
}
if (mode != OVERRIDE) {
if (n->type != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("%s is not a compound", id);
+ snd_error(CORE, "%s is not a compound", id);
return -EINVAL;
}
n->u.compound.join = true;
snd_config_delete(n);
}
if (mode == MERGE) {
- SNDERR("%s does not exists", id);
+ snd_error(CORE, "%s does not exists", id);
err = -ENOENT;
goto __end;
}
} else {
n = NULL;
if (mode == MERGE) {
- SNDERR("%s does not exists", id);
+ snd_error(CORE, "%s does not exists", id);
err = -ENOENT;
goto __end;
}
if (!skip) {
if (n) {
if (n->type != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("%s is not a compound", id);
+ snd_error(CORE, "%s is not a compound", id);
err = -EINVAL;
goto __end;
}
string_print(n->u.string, 0, out);
break;
case SND_CONFIG_TYPE_POINTER:
- SNDERR("cannot save runtime pointer type");
+ snd_error(CORE, "cannot save runtime pointer type");
return -EINVAL;
case SND_CONFIG_TYPE_COMPOUND:
array = snd_config_is_array(n);
str = strerror(-err);
break;
}
- SNDERR("%s:%d:%d:%s", fd->name ? fd->name : "_toplevel_", fd->line, fd->column, str);
+ snd_error(CORE, "%s:%d:%d:%s", fd->name ? fd->name : "_toplevel_", fd->line, fd->column, str);
goto _end;
}
err = get_char(&input);
fd = input.current;
if (err != LOCAL_UNEXPECTED_EOF) {
- SNDERR("%s:%d:%d:Unexpected }", fd->name ? fd->name : "", fd->line, fd->column);
+ snd_error(CORE, "%s:%d:%d:Unexpected }", fd->name ? fd->name : "", fd->line, fd->column);
err = -EINVAL;
goto _end;
}
assert(key); \
if (!first && (strcmp(key, old_key) == 0 || maxloop <= 0)) { \
if (maxloop == 0) \
- SNDERR("maximum loop count reached (circular configuration?)"); \
+ snd_error(CORE, "maximum loop count reached (circular configuration?)"); \
else \
- SNDERR("key %s refers to itself", key); \
+ snd_error(CORE, "key %s refers to itself", key); \
err = -EINVAL; \
res = NULL; \
break; \
err = snd_config_search(config, "func", &c);
if (err < 0) {
- SNDERR("Field func is missing");
+ snd_error(CORE, "Field func is missing");
return err;
}
err = snd_config_get_string(c, &str);
if (err < 0) {
- SNDERR("Invalid type for field func");
+ snd_error(CORE, "Invalid type for field func");
return err;
}
assert(str);
if (err >= 0) {
snd_config_iterator_t i, next;
if (snd_config_get_type(func_conf) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("Invalid type for func %s definition", str);
+ snd_error(CORE, "Invalid type for func %s definition", str);
err = -EINVAL;
goto _err;
}
if (strcmp(id, "lib") == 0) {
err = snd_config_get_string(n, &lib);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(CORE, "Invalid type for %s", id);
goto _err;
}
continue;
if (strcmp(id, "func") == 0) {
err = snd_config_get_string(n, &func_name);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(CORE, "Invalid type for %s", id);
goto _err;
}
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(CORE, "Unknown field %s", id);
}
}
if (!func_name) {
func = h ? snd_dlsym(h, func_name, SND_DLSYM_VERSION(SND_CONFIG_DLSYM_VERSION_HOOK)) : NULL;
err = 0;
if (!h) {
- SNDERR("Cannot open shared library %s (%s)", lib, errbuf);
+ snd_error(CORE, "Cannot open shared library %s (%s)", lib, errbuf);
err = -ENOENT;
} else if (!func) {
- SNDERR("symbol %s is not defined inside %s", func_name, lib);
+ snd_error(CORE, "symbol %s is not defined inside %s", func_name, lib);
snd_dlclose(h);
err = -ENXIO;
}
snd_config_t *nroot;
err = func(root, config, &nroot, private_data);
if (err < 0)
- SNDERR("function %s returned error: %s", func_name, snd_strerror(err));
+ snd_error(CORE, "function %s returned error: %s", func_name, snd_strerror(err));
snd_dlclose(h);
if (err >= 0 && nroot)
err = snd_config_substitute(root, nroot);
long i;
err = safe_strtol(id, &i);
if (err < 0) {
- SNDERR("id of field %s is not and integer", id);
+ snd_error(CORE, "id of field %s is not and integer", id);
err = -EINVAL;
goto _err;
}
err = snd_config_load_override(root, in);
snd_input_close(in);
if (err < 0)
- SNDERR("%s may be old or corrupted: consider to remove or fix it", filename);
+ snd_error(CORE, "%s may be old or corrupted: consider to remove or fix it", filename);
} else
- SNDERR("cannot access file %s", filename);
+ snd_error(CORE, "cannot access file %s", filename);
return err;
}
if (!errors && access(fn, R_OK) < 0)
return 1;
if (stat64(fn, &st) < 0) {
- SNDERR("cannot stat file/directory %s", fn);
+ snd_error(CORE, "cannot stat file/directory %s", fn);
return 1;
}
if (!S_ISDIR(st.st_mode))
if (snd_config_get_type(_file) == SND_CONFIG_TYPE_COMPOUND) {
if ((err = snd_config_search(_file, "file", &file)) < 0) {
- SNDERR("Field file not found");
+ snd_error(CORE, "Field file not found");
return err;
}
if ((err = snd_config_search(_file, "root", &root)) >= 0) {
err = snd_config_get_ascii(root, &rname);
if (err < 0) {
- SNDERR("Field root is bad");
+ snd_error(CORE, "Field root is bad");
return err;
}
err = snd_config_make_compound(&root, rname, 0);
if ((err = snd_config_search(config, "errors", &n)) >= 0) {
errors = snd_config_get_bool(n);
if (errors < 0) {
- SNDERR("Invalid bool value in field errors");
+ snd_error(CORE, "Invalid bool value in field errors");
return errors;
}
}
merge = 0;
}
if ((err = snd_config_search(config, "files", &n)) < 0) {
- SNDERR("Unable to find field files in the pre-load section");
+ snd_error(CORE, "Unable to find field files in the pre-load section");
return -EINVAL;
}
if ((err = snd_config_expand(n, root, NULL, private_data, &n)) < 0) {
- SNDERR("Unable to expand filenames in the pre-load section");
+ snd_error(CORE, "Unable to expand filenames in the pre-load section");
return err;
}
if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("Invalid type for field filenames");
+ snd_error(CORE, "Invalid type for field filenames");
goto _err;
}
long i;
err = safe_strtol(id, &i);
if (err < 0) {
- SNDERR("id of field %s is not and integer", id);
+ snd_error(CORE, "id of field %s is not and integer", id);
err = -EINVAL;
goto _err;
}
if (snd_config_search(config, "table", &n) < 0)
return 0;
if ((err = snd_config_expand(n, root, NULL, private_data, &n)) < 0) {
- SNDERR("Unable to expand table compound");
+ snd_error(CORE, "Unable to expand table compound");
return err;
}
if (snd_config_search(n, "id", &tn) < 0 ||
snd_config_get_string(tn, &id) < 0) {
- SNDERR("Unable to find field table.id");
+ snd_error(CORE, "Unable to find field table.id");
snd_config_delete(n);
return -EINVAL;
}
if (snd_config_search(n, "value", &tn) < 0 ||
snd_config_get_type(tn) != SND_CONFIG_TYPE_STRING) {
- SNDERR("Unable to find field table.value");
+ snd_error(CORE, "Unable to find field table.value");
snd_config_delete(n);
return -EINVAL;
}
lf->ino = st.st_ino;
lf->mtime = st.st_mtime;
} else {
- SNDERR("Cannot access file %s", lf->name);
+ snd_error(CORE, "Cannot access file %s", lf->name);
free(lf->name);
memmove(&local->finfo[k], &local->finfo[k+1], sizeof(struct finfo) * (local->count - k - 1));
k--;
err = snd_config_load(top, in);
snd_input_close(in);
if (err < 0) {
- SNDERR("%s may be old or corrupted: consider to remove or fix it", local->finfo[k].name);
+ snd_error(CORE, "%s may be old or corrupted: consider to remove or fix it", local->finfo[k].name);
goto _end;
}
} else {
- SNDERR("cannot access file %s", local->finfo[k].name);
+ snd_error(CORE, "cannot access file %s", local->finfo[k].name);
}
}
_skip:
err = snd_config_hooks(top, NULL);
if (err < 0) {
- SNDERR("hooks failed, removing configuration");
+ snd_error(CORE, "hooks failed, removing configuration");
goto _end;
}
*_top = top;
return 1;
err = snd_config_get_string(c, &str);
if (err < 0) {
- SNDERR("Invalid type for @func");
+ snd_error(CORE, "Invalid type for @func");
return err;
}
assert(str);
if (err >= 0) {
snd_config_iterator_t i, next;
if (snd_config_get_type(func_conf) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("Invalid type for func %s definition", str);
+ snd_error(CORE, "Invalid type for func %s definition", str);
err = -EINVAL;
goto _err;
}
if (strcmp(id, "lib") == 0) {
err = snd_config_get_string(n, &lib);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(CORE, "Invalid type for %s", id);
goto _err;
}
continue;
if (strcmp(id, "func") == 0) {
err = snd_config_get_string(n, &func_name);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(CORE, "Invalid type for %s", id);
goto _err;
}
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(CORE, "Unknown field %s", id);
}
}
if (!func_name) {
func = snd_dlsym(h, func_name, SND_DLSYM_VERSION(SND_CONFIG_DLSYM_VERSION_EVALUATE));
err = 0;
if (!h) {
- SNDERR("Cannot open shared library %s (%s)", lib, errbuf);
+ snd_error(CORE, "Cannot open shared library %s (%s)", lib, errbuf);
err = -ENOENT;
goto _errbuf;
} else if (!func) {
- SNDERR("symbol %s is not defined inside %s", func_name, lib);
+ snd_error(CORE, "symbol %s is not defined inside %s", func_name, lib);
snd_dlclose(h);
err = -ENXIO;
goto _errbuf;
snd_config_t *eval;
err = func(&eval, root, src, private_data);
if (err < 0)
- SNDERR("function %s returned error: %s", func_name, snd_strerror(err));
+ snd_error(CORE, "function %s returned error: %s", func_name, snd_strerror(err));
snd_dlclose(h);
if (err >= 0 && eval)
err = snd_config_substitute(src, eval);
}
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(CORE, "Unknown field %s", id);
return -EINVAL;
}
}
int c = **ptr;
switch (c) {
case '\0':
- SNDERR("Unterminated string");
+ snd_error(CORE, "Unterminated string");
return -EINVAL;
case '\\':
c = parse_char(ptr);
const char *id = n->id;
err = snd_config_search(defs, id, &d);
if (err < 0) {
- SNDERR("Unknown parameter %s", id);
+ snd_error(CORE, "Unknown parameter %s", id);
return err;
}
}
}
err = snd_config_search_alias(defs, NULL, var, &def);
if (err < 0) {
- SNDERR("Unknown parameter %s", var);
+ snd_error(CORE, "Unknown parameter %s", var);
goto _err;
}
if (snd_config_get_type(def) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("Parameter %s definition is not correct", var);
+ snd_error(CORE, "Parameter %s definition is not correct", var);
err = -EINVAL;
goto _err;
}
err = snd_config_search(def, "type", &typ);
if (err < 0) {
_invalid_type:
- SNDERR("Parameter %s definition is missing a valid type info", var);
+ snd_error(CORE, "Parameter %s definition is missing a valid type info", var);
goto _err;
}
err = snd_config_get_string(typ, &tmp);
goto _err;
err = safe_strtol(val, &v);
if (err < 0) {
- SNDERR("Parameter %s must be an integer", var);
+ snd_error(CORE, "Parameter %s must be an integer", var);
goto _err;
}
err = snd_config_set_integer(sub, v);
goto _err;
err = safe_strtoll(val, &v);
if (err < 0) {
- SNDERR("Parameter %s must be an integer", var);
+ snd_error(CORE, "Parameter %s must be an integer", var);
goto _err;
}
err = snd_config_set_integer64(sub, v);
goto _err;
err = safe_strtod(val, &v);
if (err < 0) {
- SNDERR("Parameter %s must be a real", var);
+ snd_error(CORE, "Parameter %s must be a real", var);
goto _err;
}
err = snd_config_set_real(sub, v);
err = snd_config_walk(config, root, &res, _snd_config_expand, fcn, private_data);
if (err < 0) {
- SNDERR("Expand error (walk): %s", snd_strerror(err));
+ snd_error(CORE, "Expand error (walk): %s", snd_strerror(err));
return err;
}
*result = res;
err = snd_config_search(config, "@args", &defs);
if (err < 0) {
if (args != NULL) {
- SNDERR("Unknown parameters %s", args);
+ snd_error(CORE, "Unknown parameters %s", args);
return -EINVAL;
}
err = snd_config_copy(&res, config);
return err;
err = load_defaults(subs, defs);
if (err < 0) {
- SNDERR("Load defaults error: %s", snd_strerror(err));
+ snd_error(CORE, "Load defaults error: %s", snd_strerror(err));
goto _end;
}
err = parse_args(subs, args, defs);
if (err < 0) {
- SNDERR("Parse arguments error: %s", snd_strerror(err));
+ snd_error(CORE, "Parse arguments error: %s", snd_strerror(err));
goto _end;
}
err = snd_config_evaluate(subs, root, private_data, NULL);
if (err < 0) {
- SNDERR("Args evaluate error: %s", snd_strerror(err));
+ snd_error(CORE, "Args evaluate error: %s", snd_strerror(err));
goto _end;
}
err = snd_config_walk(config, root, &res, _snd_config_expand, _snd_config_expand_vars, subs);
if (err < 0) {
- SNDERR("Expand error (walk): %s", snd_strerror(err));
+ snd_error(CORE, "Expand error (walk): %s", snd_strerror(err));
goto _end;
}
}
err = snd_config_evaluate(res, root, private_data, NULL);
if (err < 0) {
- SNDERR("Evaluate error: %s", snd_strerror(err));
+ snd_error(CORE, "Evaluate error: %s", snd_strerror(err));
snd_config_delete(res);
goto _end;
}
{
if (conf) {
if (conf->hop >= SND_CONF_MAX_HOPS) {
- SYSERR("Too many definition levels (looped?)\n");
+ snd_errornum(CORE, "Too many definition levels (looped?)\n");
return -EINVAL;
}
return conf->hop;
if (c == '\0')
break;
if (pos == END) {
- SNDERR("unexpected expression tail '%s'", s);
+ snd_error(CORE, "unexpected expression tail '%s'", s);
return -EINVAL;
}
if (pos == OP) {
case '|':
case '&': op = c; break;
default:
- SNDERR("unknown operation '%c'", c);
+ snd_error(CORE, "unknown operation '%c'", c);
return -EINVAL;
}
pos = RIGHT;
pos = op == LEFT ? OP : END;
}
if (pos != OP && pos != END) {
- SNDERR("incomplete expression '%s'", save);
+ snd_error(CORE, "incomplete expression '%s'", save);
return -EINVAL;
}
if (s[1] == '[') {
err = _snd_eval_string(dst, s, fcn, private_data);
if (err < 0)
- SNDERR("wrong expression '%s'", s);
+ snd_error(CORE, "wrong expression '%s'", s);
} else {
err = fcn(dst, s + 1, private_data);
}
if (err >= 0) {
if (v < 0 || v > 1) {
_invalid_value:
- SNDERR("Invalid value for %s", id);
+ snd_error(CORE, "Invalid value for %s", id);
return -EINVAL;
}
return v;
}
err = snd_config_get_string(conf, &str);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(CORE, "Invalid type for %s", id);
return -EINVAL;
}
err = snd_config_get_bool_ascii(str);
if (snd_config_get_integer(conf, &v) < 0) {
if (snd_config_get_string(conf, &str)) {
if (snd_config_get_id(conf, &id) >= 0)
- SNDERR("Invalid field %s", id);
+ snd_error(CORE, "Invalid field %s", id);
return -EINVAL;
}
err = snd_card_get_index(str);
if (err < 0) {
- SNDERR("Cannot get card index for %s", str);
+ snd_error(CORE, "Cannot get card index for %s", str);
return err;
}
v = err;
if (err >= 0) {
if (v < 0 || v > SND_CTL_ELEM_IFACE_LAST) {
_invalid_value:
- SNDERR("Invalid value for %s", id);
+ snd_error(CORE, "Invalid value for %s", id);
return -EINVAL;
}
return v;
}
err = snd_config_get_string(conf, &str);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(CORE, "Invalid type for %s", id);
return -EINVAL;
}
err = snd_config_get_ctl_iface_ascii(str);
err = snd_config_search(src, "vars", &n);
if (err < 0) {
- SNDERR("field vars not found");
+ snd_error(CORE, "field vars not found");
goto __error;
}
err = snd_config_evaluate(n, root, private_data, NULL);
if (err < 0) {
- SNDERR("error evaluating vars");
+ snd_error(CORE, "error evaluating vars");
goto __error;
}
err = snd_config_search(src, "default", &d);
if (err < 0) {
- SNDERR("field default not found");
+ snd_error(CORE, "field default not found");
goto __error;
}
err = snd_config_evaluate(d, root, private_data, NULL);
if (err < 0) {
- SNDERR("error evaluating default");
+ snd_error(CORE, "error evaluating default");
goto __error;
}
err = snd_config_get_ascii(d, &def);
if (err < 0) {
- SNDERR("error getting field default");
+ snd_error(CORE, "error getting field default");
goto __error;
}
do {
if (snd_config_get_id(n, &id) < 0)
continue;
if (snd_config_get_type(n) != SND_CONFIG_TYPE_STRING) {
- SNDERR("field %s is not a string", id);
+ snd_error(CORE, "field %s is not a string", id);
err = -EINVAL;
goto __error;
}
err = safe_strtol(id, &i);
if (err < 0) {
- SNDERR("id of field %s is not an integer", id);
+ snd_error(CORE, "id of field %s is not an integer", id);
err = -EINVAL;
goto __error;
}
idx++;
err = snd_config_get_string(n, &ptr);
if (err < 0) {
- SNDERR("invalid string for id %s", id);
+ snd_error(CORE, "invalid string for id %s", id);
err = -EINVAL;
goto __error;
}
err = snd_config_search(src, "strings", &n);
if (err < 0) {
- SNDERR("field strings not found");
+ snd_error(CORE, "field strings not found");
goto __error;
}
err = snd_config_evaluate(n, root, private_data, NULL);
if (err < 0) {
- SNDERR("error evaluating strings");
+ snd_error(CORE, "error evaluating strings");
goto __error;
}
do {
continue;
err = safe_strtol(id, &i);
if (err < 0) {
- SNDERR("id of field %s is not an integer", id);
+ snd_error(CORE, "id of field %s is not an integer", id);
err = -EINVAL;
goto __error;
}
idx++;
err = snd_config_get_ascii(n, &ptr);
if (err < 0) {
- SNDERR("invalid ascii string for id %s", id);
+ snd_error(CORE, "invalid ascii string for id %s", id);
err = -EINVAL;
goto __error;
}
}
} while (hit);
if (res == NULL) {
- SNDERR("empty string is not accepted");
+ snd_error(CORE, "empty string is not accepted");
err = -EINVAL;
goto __error;
}
err = snd_config_search(src, "integers", &n);
if (err < 0) {
- SNDERR("field integers not found");
+ snd_error(CORE, "field integers not found");
goto __error;
}
err = snd_config_evaluate(n, root, private_data, NULL);
if (err < 0) {
- SNDERR("error evaluating integers");
+ snd_error(CORE, "error evaluating integers");
goto __error;
}
do {
continue;
err = safe_strtol(id, &i);
if (err < 0) {
- SNDERR("id of field %s is not an integer", id);
+ snd_error(CORE, "id of field %s is not an integer", id);
err = -EINVAL;
goto __error;
}
idx++;
err = snd_config_get_integer(n, &val);
if (err < 0) {
- SNDERR("invalid integer for id %s", id);
+ snd_error(CORE, "invalid integer for id %s", id);
err = -EINVAL;
goto __error;
}
err = snd_config_test_id(*private_data, id);
if (err) {
notfound:
- SNDERR("field %s not found", id);
+ snd_error(CORE, "field %s not found", id);
return -EINVAL;
}
return 0;
return err;
err = snd_config_get_string(private_data, &str);
if (err < 0) {
- SNDERR("field string is not a string");
+ snd_error(CORE, "field string is not a string");
return err;
}
err = snd_config_get_id(src, &id);
return err;
err = snd_config_get_integer(private_data, &val);
if (err < 0) {
- SNDERR("field integer is not a string");
+ snd_error(CORE, "field integer is not a string");
return err;
}
err = snd_config_get_id(src, &id);
assert(card >= 0 && card <= SND_MAX_CARDS);
err = open_ctl(card, &ctl);
if (err < 0) {
- SNDERR("could not open control for card %i", card);
+ snd_error(CORE, "could not open control for card %i", card);
goto __error;
}
err = snd_ctl_card_info(ctl, &info);
if (err < 0) {
- SNDERR("snd_ctl_card_info error: %s", snd_strerror(err));
+ snd_error(CORE, "snd_ctl_card_info error: %s", snd_strerror(err));
goto __error;
}
res = strdup(snd_ctl_card_info_get_driver(&info));
err = snd_config_test_id(private_data, "card");
if (err) {
- SNDERR("field card not found");
+ snd_error(CORE, "field card not found");
return -EINVAL;
}
err = snd_config_get_integer(private_data, &card);
if (err < 0) {
- SNDERR("field card is not an integer");
+ snd_error(CORE, "field card is not an integer");
return err;
}
if ((err = snd_determine_driver(card, &driver)) < 0)
err = snd_config_search(src, "card", &n);
if (err < 0) {
- SNDERR("field card not found");
+ snd_error(CORE, "field card not found");
return err;
}
err = snd_config_evaluate(n, root, private_data, NULL);
if (err < 0) {
- SNDERR("error evaluating card");
+ snd_error(CORE, "error evaluating card");
return err;
}
err = snd_config_get_ascii(n, &str);
if (err < 0) {
- SNDERR("field card is not an integer or a string");
+ snd_error(CORE, "field card is not an integer or a string");
return err;
}
card = snd_card_get_index(str);
if (card < 0)
- SNDERR("cannot find card '%s'", str);
+ snd_error(CORE, "cannot find card '%s'", str);
free(str);
return card;
}
return card;
err = open_ctl(card, &ctl);
if (err < 0) {
- SNDERR("could not open control for card %i", card);
+ snd_error(CORE, "could not open control for card %i", card);
goto __error;
}
err = snd_ctl_card_info(ctl, &info);
if (err < 0) {
- SNDERR("snd_ctl_card_info error: %s", snd_strerror(err));
+ snd_error(CORE, "snd_ctl_card_info error: %s", snd_strerror(err));
goto __error;
}
err = snd_config_get_id(src, &id);
return card;
err = open_ctl(card, &ctl);
if (err < 0) {
- SNDERR("could not open control for card %i", card);
+ snd_error(CORE, "could not open control for card %i", card);
goto __error;
}
err = snd_ctl_card_info(ctl, &info);
if (err < 0) {
- SNDERR("snd_ctl_card_info error: %s", snd_strerror(err));
+ snd_error(CORE, "snd_ctl_card_info error: %s", snd_strerror(err));
goto __error;
}
err = snd_config_get_id(src, &id);
return card;
err = snd_config_search(src, "device", &n);
if (err < 0) {
- SNDERR("field device not found");
+ snd_error(CORE, "field device not found");
goto __error;
}
err = snd_config_evaluate(n, root, private_data, NULL);
if (err < 0) {
- SNDERR("error evaluating device");
+ snd_error(CORE, "error evaluating device");
goto __error;
}
err = snd_config_get_integer(n, &device);
if (err < 0) {
- SNDERR("field device is not an integer");
+ snd_error(CORE, "field device is not an integer");
goto __error;
}
if (snd_config_search(src, "subdevice", &n) >= 0) {
err = snd_config_evaluate(n, root, private_data, NULL);
if (err < 0) {
- SNDERR("error evaluating subdevice");
+ snd_error(CORE, "error evaluating subdevice");
goto __error;
}
err = snd_config_get_integer(n, &subdevice);
if (err < 0) {
- SNDERR("field subdevice is not an integer");
+ snd_error(CORE, "field subdevice is not an integer");
goto __error;
}
}
err = open_ctl(card, &ctl);
if (err < 0) {
- SNDERR("could not open control for card %li", card);
+ snd_error(CORE, "could not open control for card %li", card);
goto __error;
}
snd_pcm_info_set_device(&info, device);
snd_pcm_info_set_subdevice(&info, subdevice);
err = snd_ctl_pcm_info(ctl, &info);
if (err < 0) {
- SNDERR("snd_ctl_pcm_info error: %s", snd_strerror(err));
+ snd_error(CORE, "snd_ctl_pcm_info error: %s", snd_strerror(err));
goto __error;
}
err = snd_config_get_id(src, &id);
err = snd_config_search(src, "class", &n);
if (err < 0) {
- SNDERR("field class not found");
+ snd_error(CORE, "field class not found");
goto __out;
}
err = snd_config_evaluate(n, root, private_data, NULL);
if (err < 0) {
- SNDERR("error evaluating class");
+ snd_error(CORE, "error evaluating class");
goto __out;
}
err = snd_config_get_integer(n, &class);
if (err < 0) {
- SNDERR("field class is not an integer");
+ snd_error(CORE, "field class is not an integer");
goto __out;
}
err = snd_config_search(src, "index", &n);
if (err < 0) {
- SNDERR("field index not found");
+ snd_error(CORE, "field index not found");
goto __out;
}
err = snd_config_evaluate(n, root, private_data, NULL);
if (err < 0) {
- SNDERR("error evaluating index");
+ snd_error(CORE, "error evaluating index");
goto __out;
}
err = snd_config_get_integer(n, &index);
if (err < 0) {
- SNDERR("field index is not an integer");
+ snd_error(CORE, "field index is not an integer");
goto __out;
}
while(1) {
err = snd_card_next(&card);
if (err < 0) {
- SNDERR("could not get next card");
+ snd_error(CORE, "could not get next card");
goto __out;
}
if (card < 0)
break;
err = open_ctl(card, &ctl);
if (err < 0) {
- SNDERR("could not open control for card %i", card);
+ snd_error(CORE, "could not open control for card %i", card);
goto __out;
}
dev = -1;
while(1) {
err = snd_ctl_pcm_next_device(ctl, &dev);
if (err < 0) {
- SNDERR("could not get next pcm for card %i", card);
+ snd_error(CORE, "could not get next pcm for card %i", card);
goto __out;
}
if (dev < 0)
return snd_config_copy(dst, src);
err = snd_config_test_id(private_data, "pcm_handle");
if (err) {
- SNDERR("field pcm_handle not found");
+ snd_error(CORE, "field pcm_handle not found");
return -EINVAL;
}
err = snd_config_get_pointer(private_data, &data);
pcm = (snd_pcm_t *)data;
if (err < 0) {
- SNDERR("field pcm_handle is not a pointer");
+ snd_error(CORE, "field pcm_handle is not a pointer");
return err;
}
err = snd_pcm_info(pcm, &info);
if (err < 0) {
- SNDERR("snd_ctl_pcm_info error: %s", snd_strerror(err));
+ snd_error(CORE, "snd_ctl_pcm_info error: %s", snd_strerror(err));
return err;
}
err = snd_config_get_id(src, &id);
if (err >= 0) {
err = snd_config_evaluate(n, root, private_data, NULL);
if (err < 0) {
- SNDERR("error evaluating file");
+ snd_error(CORE, "error evaluating file");
goto _end;
}
err = snd_config_get_string(n, &file);
if (err < 0) {
- SNDERR("file is not a string");
+ snd_error(CORE, "file is not a string");
goto _end;
}
}
if (err >= 0) {
err = snd_config_evaluate(n, root, private_data, NULL);
if (err < 0) {
- SNDERR("error evaluating name");
+ snd_error(CORE, "error evaluating name");
goto _end;
}
err = snd_config_get_string(n, &name);
if (err < 0) {
- SNDERR("name is not a string");
+ snd_error(CORE, "name is not a string");
goto _end;
}
}
if (!name) {
err = -EINVAL;
- SNDERR("name is not specified");
+ snd_error(CORE, "name is not specified");
goto _end;
}
if (file) {
snd_input_t *input;
err = snd_input_stdio_open(&input, file, "r");
if (err < 0) {
- SNDERR("Unable to open file %s: %s", file, snd_strerror(err));
+ snd_error(CORE, "Unable to open file %s: %s", file, snd_strerror(err));
goto _end;
}
err = snd_config_load(root, input);
} else {
err = snd_config_search(src, "default", &n);
if (err < 0)
- SNDERR("Unable to find definition '%s'", name);
+ snd_error(CORE, "Unable to find definition '%s'", name);
else {
const char *id;
err = snd_config_evaluate(n, root, private_data, NULL);
npfds = snd_ctl_poll_descriptors_count(ctl);
if (npfds <= 0 || npfds >= 16) {
- SNDERR("Invalid poll_fds %d", npfds);
+ snd_error(CONTROL, "Invalid poll_fds %d", npfds);
return -EIO;
}
pfd = alloca(sizeof(*pfd) * npfds);
if (err < 0)
return err;
if (err != npfds) {
- SNDMSG("invalid poll descriptors %d", err);
+ snd_check(CONTROL, "invalid poll descriptors %d", err);
return -EIO;
}
for (;;) {
#endif
if (snd_config_get_type(ctl_conf) != SND_CONFIG_TYPE_COMPOUND) {
if (name)
- SNDERR("Invalid type for CTL %s definition", name);
+ snd_error(CONTROL, "Invalid type for CTL %s definition", name);
else
- SNDERR("Invalid type for CTL definition");
+ snd_error(CONTROL, "Invalid type for CTL definition");
return -EINVAL;
}
err = snd_config_search(ctl_conf, "type", &conf);
if (err < 0) {
- SNDERR("type is not defined");
+ snd_error(CONTROL, "type is not defined");
return err;
}
err = snd_config_get_id(conf, &id);
if (err < 0) {
- SNDERR("unable to get id");
+ snd_error(CONTROL, "unable to get id");
return err;
}
err = snd_config_get_string(conf, &str);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(CONTROL, "Invalid type for %s", id);
return err;
}
err = snd_config_search_definition(ctl_root, "ctl_type", str, &type_conf);
if (err >= 0) {
if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("Invalid type for CTL type %s definition", str);
+ snd_error(CONTROL, "Invalid type for CTL type %s definition", str);
err = -EINVAL;
goto _err;
}
if (strcmp(id, "lib") == 0) {
err = snd_config_get_string(n, &lib);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(CONTROL, "Invalid type for %s", id);
goto _err;
}
continue;
if (strcmp(id, "open") == 0) {
err = snd_config_get_string(n, &open_name);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(CONTROL, "Invalid type for %s", id);
goto _err;
}
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(CONTROL, "Unknown field %s", id);
err = -EINVAL;
goto _err;
}
err = snd_config_search_definition(root, "ctl", name, &ctl_conf);
if (err < 0) {
- SNDERR("Invalid CTL %s", name);
+ snd_error(CONTROL, "Invalid CTL %s", name);
return err;
}
if (snd_config_get_string(ctl_conf, &str) >= 0)
child = n;
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(CONTROL, "Unknown field %s", id);
return -EINVAL;
}
if (!child) {
- SNDERR("child is not defined");
+ snd_error(CONTROL, "child is not defined");
return -EINVAL;
}
return _snd_ctl_open_named_child(handlep, name, root, child, mode, conf);
....
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(CONTROL, "Unknown field %s", id);
return -EINVAL;
}
if (ext->version < SNDRV_PROTOCOL_VERSION(1, 0, 0) ||
ext->version > SND_CTL_EXT_VERSION) {
- SNDERR("ctl_ext: Plugin version mismatch");
+ snd_error(CONTROL, "ctl_ext: Plugin version mismatch");
return -ENXIO;
}
long flags;
int fd = hw->fd;
if ((flags = fcntl(fd, F_GETFL)) < 0) {
- SYSERR("F_GETFL failed");
+ snd_errornum(CONTROL, "F_GETFL failed");
return -errno;
}
if (nonblock)
else
flags &= ~O_NONBLOCK;
if (fcntl(fd, F_SETFL, flags) < 0) {
- SYSERR("F_SETFL for O_NONBLOCK failed");
+ snd_errornum(CONTROL, "F_SETFL for O_NONBLOCK failed");
return -errno;
}
return 0;
int fd = hw->fd;
if ((flags = fcntl(fd, F_GETFL)) < 0) {
- SYSERR("F_GETFL failed");
+ snd_errornum(CONTROL, "F_GETFL failed");
return -errno;
}
if (sig >= 0)
else
flags &= ~O_ASYNC;
if (fcntl(fd, F_SETFL, flags) < 0) {
- SYSERR("F_SETFL for O_ASYNC failed");
+ snd_errornum(CONTROL, "F_SETFL for O_ASYNC failed");
return -errno;
}
if (sig < 0)
return 0;
if (fcntl(fd, F_SETSIG, (long)sig) < 0) {
- SYSERR("F_SETSIG failed");
+ snd_errornum(CONTROL, "F_SETSIG failed");
return -errno;
}
if (fcntl(fd, F_SETOWN, (long)pid) < 0) {
- SYSERR("F_SETOWN failed");
+ snd_errornum(CONTROL, "F_SETOWN failed");
return -errno;
}
return 0;
{
snd_ctl_hw_t *hw = handle->private_data;
if (ioctl(hw->fd, SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS, &subscribe) < 0) {
- SYSERR("SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS failed");
+ snd_errornum(CONTROL, "SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS failed");
return -errno;
}
return 0;
{
snd_ctl_hw_t *hw = handle->private_data;
if (ioctl(hw->fd, SNDRV_CTL_IOCTL_CARD_INFO, info) < 0) {
- SYSERR("SNDRV_CTL_IOCTL_CARD_INFO failed");
+ snd_errornum(CONTROL, "SNDRV_CTL_IOCTL_CARD_INFO failed");
return -errno;
}
return 0;
if (res <= 0)
return -errno;
if (CHECK_SANITY(res != sizeof(*event))) {
- SNDMSG("snd_ctl_hw_read: read size error (req:%d, got:%d)",
- sizeof(*event), res);
+ snd_check(CONTROL, "snd_ctl_hw_read: read size error (req:%d, got:%d)",
+ sizeof(*event), res);
+
return -EINVAL;
}
return 1;
*handle = NULL;
if (CHECK_SANITY(card < 0 || card >= SND_MAX_CARDS)) {
- SNDMSG("Invalid card index %d", card);
+ snd_check(CONTROL, "Invalid card index %d", card);
return -EINVAL;
}
sprintf(filename, SNDRV_FILE_CONTROL, card);
if (snd_config_get_id(n, &id) < 0)
continue;
if (snd_config_get_string(n, &str) < 0) {
- SNDERR("expected string with the target control id!");
+ snd_error(CONTROL, "expected string with the target control id!");
return -EINVAL;
}
snd_ctl_elem_id_clear(&app);
err = snd_ctl_ascii_elem_id_parse(&app, str);
if (err < 0) {
- SNDERR("unable to parse target id '%s'!", str);
+ snd_error(CONTROL, "unable to parse target id '%s'!", str);
return -EINVAL;
}
if (remap_find_id_app(priv, &app)) {
- SNDERR("duplicate target id '%s'!", id);
+ snd_error(CONTROL, "duplicate target id '%s'!", id);
return -EINVAL;
}
snd_ctl_elem_id_clear(&child);
err = snd_ctl_ascii_elem_id_parse(&child, id);
if (err < 0) {
- SNDERR("unable to parse source id '%s'!", id);
+ snd_error(CONTROL, "unable to parse source id '%s'!", id);
return -EINVAL;
}
if (remap_find_id_child(priv, &app)) {
- SNDERR("duplicate source id '%s'!", id);
+ snd_error(CONTROL, "duplicate source id '%s'!", id);
return -EINVAL;
}
err = add_to_remap(priv, &child, &app);
long *map;
if (src_idx >= mctl->src_channels) {
- SNDERR("Wrong channel mapping (extra source channel?)");
+ snd_error(CONTROL, "Wrong channel mapping (extra source channel?)");
return -EINVAL;
}
if (mctl->channel_map_alloc <= (size_t)idx) {
snd_config_t *n = snd_config_iterator_entry(i);
long idx = -1, chn = -1;
if (safe_strtol(dst_id, &idx) || snd_config_get_integer(n, &chn)) {
- SNDERR("Wrong channel mapping (%ld -> %ld)", idx, chn);
+ snd_error(CONTROL, "Wrong channel mapping (%ld -> %ld)", idx, chn);
return -EINVAL;
}
err = add_chn_to_map(mctl, idx, src_idx, chn);
err = add_chn_to_map_array(mctl, id, n);
} else {
if (safe_strtol(id, &idx) || snd_config_get_integer(n, &chn)) {
- SNDERR("Wrong channel mapping (%ld -> %ld)", idx, chn);
+ snd_error(CONTROL, "Wrong channel mapping (%ld -> %ld)", idx, chn);
return -EINVAL;
}
err = add_chn_to_map(mctl, idx, 0, chn);
snd_ctl_elem_id_clear(&cid);
err = snd_ctl_ascii_elem_id_parse(&cid, id);
if (err < 0) {
- SNDERR("unable to parse control id '%s'!", id);
+ snd_error(CONTROL, "unable to parse control id '%s'!", id);
return -EINVAL;
}
err = add_ctl_to_map(map, &mctl, &cid);
snd_ctl_elem_id_clear(&eid);
err = snd_ctl_ascii_elem_id_parse(&eid, id);
if (err < 0) {
- SNDERR("unable to parse id '%s'!", id);
+ snd_error(CONTROL, "unable to parse id '%s'!", id);
return -EINVAL;
}
err = new_map(priv, &map, &eid);
snd_config_for_each(i, next, conf) {
snd_config_t *n = snd_config_iterator_entry(i);
if (snd_config_get_string(n, &str) < 0) {
- SNDERR("strings are expected in sync array");
+ snd_error(CONTROL, "strings are expected in sync array");
return -EINVAL;
}
eid = &sync->control_ids[index];
snd_ctl_elem_id_clear(eid);
err = snd_ctl_ascii_elem_id_parse(eid, str);
if (err < 0) {
- SNDERR("unable to parse control id '%s'!", str);
+ snd_error(CONTROL, "unable to parse control id '%s'!", str);
return -EINVAL;
}
sync->control_items++;
continue;
if (strcmp(id, "switch") == 0) {
if (snd_config_get_string(n, &str) < 0) {
- SNDERR("String is expected for switch");
+ snd_error(CONTROL, "String is expected for switch");
return -EINVAL;
}
err = snd_ctl_ascii_elem_id_parse(&eid, str);
if (err < 0) {
- SNDERR("unable to parse id '%s'!", str);
+ snd_error(CONTROL, "unable to parse id '%s'!", str);
return -EINVAL;
}
eid_found = true;
if (strcmp(id, "controls") == 0) {
count = snd_config_is_array(n);
if (count <= 0) {
- SNDERR("Array is expected for sync!");
+ snd_error(CONTROL, "Array is expected for sync!");
return -EINVAL;
}
err = parse_sync1(priv, count, n);
} else {
count = snd_config_is_array(n);
if (count <= 0) {
- SNDERR("Array is expected for sync!");
+ snd_error(CONTROL, "Array is expected for sync!");
return -EINVAL;
}
err = parse_sync1(priv, count, n);
child = n;
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(CONTROL, "Unknown field %s", id);
return -EINVAL;
}
if (!child) {
- SNDERR("child is not defined");
+ snd_error(CONTROL, "child is not defined");
return -EINVAL;
}
err = _snd_ctl_open_child(&cctl, root, child, mode, conf);
if (err != 1)
return -EBADFD;
if (ctrl->cmd) {
- SNDERR("Server has not done the cmd");
+ snd_error(CONTROL, "Server has not done the cmd");
return -EBADFD;
}
return ctrl->result;
if (err != 1)
return -EBADFD;
if (ctrl->cmd) {
- SNDERR("Server has not done the cmd");
+ snd_error(CONTROL, "Server has not done the cmd");
return -EBADFD;
}
return ctrl->result;
result = make_local_socket(sockname);
if (result < 0) {
- SNDERR("server for socket %s is not running", sockname);
+ snd_error(CONTROL, "server for socket %s is not running", sockname);
goto _err;
}
sock = result;
req->namelen = snamelen;
err = write(sock, req, reqlen);
if (err < 0) {
- SNDERR("write error");
+ snd_error(CONTROL, "write error");
result = -errno;
goto _err;
}
if ((size_t) err != reqlen) {
- SNDERR("write size error");
+ snd_error(CONTROL, "write size error");
result = -EINVAL;
goto _err;
}
err = read(sock, &ans, sizeof(ans));
if (err < 0) {
- SNDERR("read error");
+ snd_error(CONTROL, "read error");
result = -errno;
goto _err;
}
if (err != sizeof(ans)) {
- SNDERR("read size error");
+ snd_error(CONTROL, "read size error");
result = -EINVAL;
goto _err;
}
if (strcmp(id, "server") == 0) {
err = snd_config_get_string(n, &server);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(CONTROL, "Invalid type for %s", id);
return -EINVAL;
}
continue;
if (strcmp(id, "ctl") == 0) {
err = snd_config_get_string(n, &ctl_name);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(CONTROL, "Invalid type for %s", id);
return -EINVAL;
}
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(CONTROL, "Unknown field %s", id);
return -EINVAL;
}
if (!ctl_name) {
- SNDERR("ctl is not defined");
+ snd_error(CONTROL, "ctl is not defined");
return -EINVAL;
}
if (!server) {
- SNDERR("server is not defined");
+ snd_error(CONTROL, "server is not defined");
return -EINVAL;
}
err = snd_config_search_definition(root, "server", server, &sconfig);
if (err < 0) {
- SNDERR("Unknown server %s", server);
+ snd_error(CONTROL, "Unknown server %s", server);
return -EINVAL;
}
if (snd_config_get_type(sconfig) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("Invalid type for server %s definition", server);
+ snd_error(CONTROL, "Invalid type for server %s definition", server);
err = -EINVAL;
goto _err;
}
if (strcmp(id, "socket") == 0) {
err = snd_config_get_string(n, &sockname);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(CONTROL, "Invalid type for %s", id);
goto _err;
}
continue;
if (strcmp(id, "port") == 0) {
err = snd_config_get_integer(n, &port);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(CONTROL, "Invalid type for %s", id);
goto _err;
}
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(CONTROL, "Unknown field %s", id);
err = -EINVAL;
goto _err;
}
if (!sockname) {
- SNDERR("socket is not defined");
+ snd_error(CONTROL, "socket is not defined");
goto _err;
}
err = snd_ctl_shm_open(handlep, name, sockname, ctl_name, mode);
ret = snd_ctl_hw_open(&ctl, NULL, info->card, 0);
if (ret < 0) {
- SYSMSG("Cannot open the associated CTL");
+ snd_checknum(CONTROL, "Cannot open the associated CTL");
return ret;
}
if (ret == -ENOENT || cinfo.type != SND_CTL_ELEM_TYPE_BYTES || cinfo.count == 0)
return 0;
if (ret < 0) {
- SYSMSG("Cannot read ELD");
+ snd_checknum(CONTROL, "Cannot read ELD");
return ret;
}
/* decode connected HDMI device name */
/* no monitor name detected */
goto __present;
if (l > 16 || 20 + l > cinfo.count) {
- SNDERR("ELD decode failed, using old HDMI output names");
+ snd_error(CONTROL, "ELD decode failed, using old HDMI output names");
return 0;
}
s = alloca(l + 1);
npfds = snd_hctl_poll_descriptors_count(hctl);
if (npfds <= 0 || npfds >= 16) {
- SNDERR("Invalid poll_fds %d", npfds);
+ snd_error(CONTROL, "Invalid poll_fds %d", npfds);
return -EIO;
}
pfd = alloca(sizeof(*pfd) * npfds);
if (err < 0)
return err;
if (err != npfds) {
- SNDMSG("invalid poll descriptors %d", err);
+ snd_check(CONTROL, "invalid poll descriptors %d", err);
return -EIO;
}
do {
strcmp(str, "hw") == 0) {
if (snd_config_search(cfg1, "device", &cfg) >= 0) {
if (snd_config_get_integer(cfg, &dev) < 0) {
- SNDERR("(%s) device must be an integer", buf);
+ snd_error(CONTROL, "(%s) device must be an integer", buf);
err = -EINVAL;
goto __cleanup;
}
if (snd_config_search(cfg1, "hint", &cfg) >= 0) {
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("hint (%s) must be a compound", buf);
+ snd_error(CONTROL, "hint (%s) must be a compound", buf);
err = -EINVAL;
goto __cleanup;
}
}
if (snd_config_search(cfg, "device", &n) >= 0) {
if (snd_config_get_integer(n, &dev) < 0) {
- SNDERR("(%s) device must be an integer", buf);
+ snd_error(CONTROL, "(%s) device must be an integer", buf);
err = -EINVAL;
goto __cleanup;
}
}
if (snd_config_search(cfg, "device_input", &n) >= 0) {
if (snd_config_get_integer(n, &list->device_input) < 0) {
- SNDERR("(%s) device_input must be an integer", buf);
+ snd_error(CONTROL, "(%s) device_input must be an integer", buf);
err = -EINVAL;
goto __cleanup;
}
}
if (snd_config_search(cfg, "device_output", &n) >= 0) {
if (snd_config_get_integer(n, &list->device_output) < 0) {
- SNDERR("(%s) device_output must be an integer", buf);
+ snd_error(CONTROL, "(%s) device_output must be an integer", buf);
err = -EINVAL;
goto __cleanup;
}
if (elem->lock) {
err = snd_ctl_elem_lock(h->ctl, elem->id);
if (err < 0) {
- SNDERR("Cannot lock ctl elem");
+ snd_error(CONTROL, "Cannot lock ctl elem");
return err;
}
}
err = snd_ctl_elem_read(h->ctl, elem->old);
if (err < 0) {
- SNDERR("Cannot read ctl elem");
+ snd_error(CONTROL, "Cannot read ctl elem");
return err;
}
count = snd_ctl_elem_info_get_count(elem->info);
}
err = snd_ctl_elem_write(h->ctl, elem->val);
if (err < 0) {
- SNDERR("Cannot write ctl elem");
+ snd_error(CONTROL, "Cannot write ctl elem");
return err;
}
}
if (elem->lock) {
err = snd_ctl_elem_unlock(h->ctl, elem->id);
if (err < 0) {
- SNDERR("Cannot unlock ctl elem");
+ snd_error(CONTROL, "Cannot unlock ctl elem");
return err;
}
}
if (elem->preserve && snd_ctl_elem_value_compare(elem->val, elem->old)) {
err = snd_ctl_elem_write(h->ctl, elem->old);
if (err < 0) {
- SNDERR("Cannot restore ctl elem");
+ snd_error(CONTROL, "Cannot restore ctl elem");
return err;
}
}
snd_ctl_elem_info_set_item(info, idx);
err = snd_ctl_elem_info(ctl, info);
if (err < 0) {
- SNDERR("Cannot obtain info for CTL elem");
+ snd_error(CONTROL, "Cannot obtain info for CTL elem");
return err;
}
if (strcmp(str, snd_ctl_elem_info_get_item_name(info)) == 0)
case SND_CTL_ELEM_TYPE_IEC958:
break;
default:
- SNDERR("Unknown control type: %d", type);
+ snd_error(CONTROL, "Unknown control type: %d", type);
return -EINVAL;
}
}
unsigned int idx = 0;
if (len % 2 != 0 || len > count * 2) {
_bad_content:
- SNDERR("bad value content");
+ snd_error(CONTROL, "bad value content");
return -EINVAL;
}
while (*buf) {
break;
}
if (snd_config_get_type(conf) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("bad value type");
+ snd_error(CONTROL, "bad value type");
return -EINVAL;
}
continue;
err = safe_strtol(id, &idx);
if (err < 0 || idx < 0 || (unsigned int) idx >= count) {
- SNDERR("bad value index");
+ snd_error(CONTROL, "bad value index");
return -EINVAL;
}
switch (type) {
if (strcmp(id, "iface") == 0 || strcmp(id, "interface") == 0) {
const char *ptr;
if ((err = snd_config_get_string(n, &ptr)) < 0) {
- SNDERR("field %s is not a string", id);
+ snd_error(CONTROL, "field %s is not a string", id);
goto _err;
}
if ((err = snd_config_get_ctl_iface_ascii(ptr)) < 0) {
- SNDERR("Invalid value for '%s'", id);
+ snd_error(CONTROL, "Invalid value for '%s'", id);
goto _err;
}
iface = err;
}
if (strcmp(id, "name") == 0) {
if ((err = snd_config_get_string(n, &name)) < 0) {
- SNDERR("field %s is not a string", id);
+ snd_error(CONTROL, "field %s is not a string", id);
goto _err;
}
continue;
}
if (strcmp(id, "index") == 0) {
if ((err = snd_config_get_integer(n, &index)) < 0) {
- SNDERR("field %s is not an integer", id);
+ snd_error(CONTROL, "field %s is not an integer", id);
goto _err;
}
continue;
}
if (strcmp(id, "device") == 0) {
if ((err = snd_config_get_integer(n, &device)) < 0) {
- SNDERR("field %s is not an integer", id);
+ snd_error(CONTROL, "field %s is not an integer", id);
goto _err;
}
continue;
}
if (strcmp(id, "subdevice") == 0) {
if ((err = snd_config_get_integer(n, &subdevice)) < 0) {
- SNDERR("field %s is not an integer", id);
+ snd_error(CONTROL, "field %s is not an integer", id);
goto _err;
}
continue;
skip_rest = err;
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(CONTROL, "Unknown field %s", id);
return -EINVAL;
}
if (name == NULL) {
- SNDERR("Missing control name");
+ snd_error(CONTROL, "Missing control name");
err = -EINVAL;
goto _err;
}
if (value == NULL) {
- SNDERR("Missing control value");
+ snd_error(CONTROL, "Missing control value");
err = -EINVAL;
goto _err;
}
err = snd_ctl_elem_info(h->ctl, elem->info);
if (err < 0) {
if (! optional)
- SNDERR("Cannot obtain info for CTL elem (%s,'%s',%li,%li,%li): %s", snd_ctl_elem_iface_name(iface), name, index, device, subdevice, snd_strerror(err));
+ snd_error(CONTROL, "Cannot obtain info for CTL elem (%s,'%s',%li,%li,%li): %s", snd_ctl_elem_iface_name(iface), name, index, device, subdevice, snd_strerror(err));
goto _err;
} else {
if (skip_rest)
/* Validate that it is possible to read the type and size
* without reading past the end of the buffer. */
if (tlv_size < MIN_TLV_STREAM_LEN) {
- SNDERR("TLV stream too short");
+ snd_error(CONTROL, "TLV stream too short");
return -EINVAL;
}
size = tlv[SNDRV_CTL_TLVO_LEN];
tlv_size -= 2 * sizeof(int);
if (size > tlv_size) {
- SNDERR("TLV size error");
+ snd_error(CONTROL, "TLV size error");
return -EINVAL;
}
switch (type) {
else
minsize = 2 * sizeof(int);
if (size < minsize) {
- SNDERR("Invalid dB_scale TLV size");
+ snd_error(CONTROL, "Invalid dB_scale TLV size");
return -EINVAL;
}
if (size > MAX_TLV_RANGE_SIZE) {
- SNDERR("Too big dB_scale TLV size: %d", size);
+ snd_error(CONTROL, "Too big dB_scale TLV size: %d", size);
return -EINVAL;
}
*db_tlvp = tlv;
res = dlsym(handle, vname) == NULL ? -ENOENT : 0;
// printf("dlsym verify: %i, vname = '%s'\n", res, vname);
if (res < 0)
- SNDERR("unable to verify version for symbol %s", name);
+ snd_error(CORE, "unable to verify version for symbol %s", name);
return res;
#else
return 0;
verbose ? sizeof(errbuf) : 0);
if (dlobj == NULL) {
if (verbose)
- SNDERR("Cannot open shared library %s (%s)",
- lib ? lib : "[builtin]",
- errbuf);
+ snd_error(CORE, "Cannot open shared library %s (%s)",
+ lib ? lib : "[builtin]",
+
+ errbuf);
+
return NULL;
}
func = snd_dlsym(dlobj, name, version);
if (func == NULL) {
if (verbose)
- SNDERR("symbol %s is not defined inside %s",
- name, lib ? lib : "[builtin]");
+ snd_error(CORE, "symbol %s is not defined inside %s",
+ name, lib ? lib : "[builtin]");
+
goto __err;
}
c = malloc(sizeof(*c));
void *h = NULL;
if (snd_config_get_type(hwdep_conf) != SND_CONFIG_TYPE_COMPOUND) {
if (name)
- SNDERR("Invalid type for HWDEP %s definition", name);
+ snd_error(HWDEP, "Invalid type for HWDEP %s definition", name);
else
- SNDERR("Invalid type for HWDEP definition");
+ snd_error(HWDEP, "Invalid type for HWDEP definition");
return -EINVAL;
}
err = snd_config_search(hwdep_conf, "type", &conf);
if (err < 0) {
- SNDERR("type is not defined");
+ snd_error(HWDEP, "type is not defined");
return err;
}
err = snd_config_get_id(conf, &id);
if (err < 0) {
- SNDERR("unable to get id");
+ snd_error(HWDEP, "unable to get id");
return err;
}
err = snd_config_get_string(conf, &str);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(HWDEP, "Invalid type for %s", id);
return err;
}
err = snd_config_search_definition(hwdep_root, "hwdep_type", str, &type_conf);
if (err >= 0) {
if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("Invalid type for HWDEP type %s definition", str);
+ snd_error(HWDEP, "Invalid type for HWDEP type %s definition", str);
err = -EINVAL;
goto _err;
}
if (strcmp(id, "lib") == 0) {
err = snd_config_get_string(n, &lib);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(HWDEP, "Invalid type for %s", id);
goto _err;
}
continue;
if (strcmp(id, "open") == 0) {
err = snd_config_get_string(n, &open_name);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(HWDEP, "Invalid type for %s", id);
goto _err;
}
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(HWDEP, "Unknown field %s", id);
err = -EINVAL;
goto _err;
}
open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_HWDEP_DLSYM_VERSION));
err = 0;
if (!h) {
- SNDERR("Cannot open shared library %s (%s)", lib, errbuf);
+ snd_error(HWDEP, "Cannot open shared library %s (%s)", lib, errbuf);
err = -ENOENT;
} else if (!open_func) {
- SNDERR("symbol %s is not defined inside %s", open_name, lib);
+ snd_error(HWDEP, "symbol %s is not defined inside %s", open_name, lib);
snd_dlclose(h);
err = -ENXIO;
}
snd_config_t *hwdep_conf;
err = snd_config_search_definition(root, "hwdep", name, &hwdep_conf);
if (err < 0) {
- SNDERR("Unknown HwDep %s", name);
+ snd_error(HWDEP, "Unknown HwDep %s", name);
return err;
}
err = snd_hwdep_open_conf(hwdep, name, root, hwdep_conf, mode);
return err;
continue;
}
- SNDERR("Unexpected field %s", id);
+ snd_error(HWDEP, "Unexpected field %s", id);
return -EINVAL;
}
if (card < 0)
strcat(xlib, lib);
h = INTERNAL(snd_dlopen)(xlib, RTLD_NOW, errbuf, sizeof(errbuf));
if (h == NULL) {
- SNDERR("Unable to open library '%s' (%s)", xlib, errbuf);
+ snd_error(MIXER, "Unable to open library '%s' (%s)", xlib, errbuf);
free(xlib);
return -ENXIO;
}
priv->dlhandle = h;
event_func = snd_dlsym(h, "alsa_mixer_simple_event", NULL);
if (event_func == NULL) {
- SNDERR("Symbol 'alsa_mixer_simple_event' was not found in '%s'", xlib);
+ snd_error(MIXER, "Symbol 'alsa_mixer_simple_event' was not found in '%s'", xlib);
err = -ENXIO;
}
if (err == 0) {
init_func = snd_dlsym(h, "alsa_mixer_simple_init", NULL);
if (init_func == NULL) {
- SNDERR("Symbol 'alsa_mixer_simple_init' was not found in '%s'", xlib);
+ snd_error(MIXER, "Symbol 'alsa_mixer_simple_init' was not found in '%s'", xlib);
err = -ENXIO;
}
}
/* note python modules requires RTLD_GLOBAL */
h = INTERNAL(snd_dlopen)(xlib, RTLD_NOW|RTLD_GLOBAL, errbuf, sizeof(errbuf));
if (h == NULL) {
- SNDERR("Unable to open library '%s'", xlib);
+ snd_error(MIXER, "Unable to open library '%s'", xlib);
free(xlib);
return -ENXIO;
}
priv->dlhandle = h;
event_func = snd_dlsym(h, "alsa_mixer_simple_event", NULL);
if (event_func == NULL) {
- SNDERR("Symbol 'alsa_mixer_simple_event' was not found in '%s'", xlib);
+ snd_error(MIXER, "Symbol 'alsa_mixer_simple_event' was not found in '%s'", xlib);
err = -ENXIO;
}
if (err == 0) {
init_func = snd_dlsym(h, "alsa_mixer_simple_finit", NULL);
if (init_func == NULL) {
- SNDERR("Symbol 'alsa_mixer_simple_finit' was not found in '%s'", xlib);
+ snd_error(MIXER, "Symbol 'alsa_mixer_simple_finit' was not found in '%s'", xlib);
err = -ENXIO;
}
}
if (err >= 0) {
err = snd_input_stdio_open(&input, file, "r");
if (err < 0) {
- SNDERR("unable to open simple mixer configuration file '%s'", file);
+ snd_error(MIXER, "unable to open simple mixer configuration file '%s'", file);
goto __error;
}
err = snd_config_load(top, input);
snd_input_close(input);
if (err < 0) {
- SNDERR("%s may be old or corrupted: consider to remove or fix it", file);
+ snd_error(MIXER, "%s may be old or corrupted: consider to remove or fix it", file);
goto __error;
}
err = find_full(class, mixer, top, priv->device);
if (err >= 0) {
err = snd_ctl_open(&priv->ctl, priv->device, 0);
if (err < 0) {
- SNDERR("unable to open control device '%s': %s", priv->device, snd_strerror(err));
+ snd_error(MIXER, "unable to open control device '%s': %s", priv->device, snd_strerror(err));
goto __error;
}
err = snd_hctl_open_ctl(&priv->hctl, priv->ctl);
snd_mixer_selem_id_free(id);
}
if (simple->ctls[type].elem) {
- SNDERR("helem (%s,'%s',%u,%u,%u) appears twice or more",
- snd_ctl_elem_iface_name(
- snd_hctl_elem_get_interface(helem)),
+ snd_error(MIXER, "helem (%s,'%s',%u,%u,%u) appears twice or more",
+ snd_ctl_elem_iface_name(
+
+ snd_hctl_elem_get_interface(helem)),
+
snd_hctl_elem_get_name(helem),
snd_hctl_elem_get_index(helem),
snd_hctl_elem_get_device(helem),
int err;
/* the hw_params must be set at first!!! */
if (CHECK_SANITY(! pcm->setup)) {
- SNDMSG("PCM not set up");
+ snd_check(PCM, "PCM not set up");
return -EIO;
}
if (! params->avail_min) {
- SNDMSG("params->avail_min is 0");
+ snd_check(PCM, "params->avail_min is 0");
return -EINVAL;
}
#if 0
*/
if (params->start_threshold <= pcm->buffer_size &&
params->start_threshold > (pcm->buffer_size / params->avail_min) * params->avail_min) {
- SNDMSG("params->avail_min problem for start_threshold");
+ snd_check(PCM, "params->avail_min problem for start_threshold");
return -EINVAL;
}
#endif
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
- SNDMSG("PCM not set up");
+ snd_check(PCM, "PCM not set up");
return -EIO;
}
snd_pcm_lock(pcm->fast_op_arg);
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
- SNDMSG("PCM not set up");
+ snd_check(PCM, "PCM not set up");
return -EIO;
}
snd_pcm_lock(pcm->fast_op_arg);
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
- SNDMSG("PCM not set up");
+ snd_check(PCM, "PCM not set up");
return -EIO;
}
/* lock handled in the callback */
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
- SNDMSG("PCM not set up");
+ snd_check(PCM, "PCM not set up");
return -EIO;
}
snd_pcm_lock(pcm->fast_op_arg);
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
- SNDMSG("PCM not set up");
+ snd_check(PCM, "PCM not set up");
return -EIO;
}
err = bad_pcm_state(pcm, ~P_STATE(DISCONNECTED), 0);
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
- SNDMSG("PCM not set up");
+ snd_check(PCM, "PCM not set up");
return -EIO;
}
snd_pcm_lock(pcm->fast_op_arg);
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
- SNDMSG("PCM not set up");
+ snd_check(PCM, "PCM not set up");
return -EIO;
}
err = bad_pcm_state(pcm, P_STATE(PREPARED), 0);
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
- SNDMSG("PCM not set up");
+ snd_check(PCM, "PCM not set up");
return -EIO;
}
err = bad_pcm_state(pcm, P_STATE_RUNNABLE | P_STATE(SETUP) |
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
- SNDMSG("PCM not set up");
+ snd_check(PCM, "PCM not set up");
return -EIO;
}
err = bad_pcm_state(pcm, P_STATE_RUNNABLE | P_STATE(SETUP), P_STATE(SETUP));
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
- SNDMSG("PCM not set up");
+ snd_check(PCM, "PCM not set up");
return -EIO;
}
err = bad_pcm_state(pcm, P_STATE_RUNNABLE, 0);
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
- SNDMSG("PCM not set up");
+ snd_check(PCM, "PCM not set up");
return -EIO;
}
err = bad_pcm_state(pcm, P_STATE_RUNNABLE, 0);
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
- SNDMSG("PCM not set up");
+ snd_check(PCM, "PCM not set up");
return -EIO;
}
if (frames == 0)
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
- SNDMSG("PCM not set up");
+ snd_check(PCM, "PCM not set up");
return -EIO;
}
err = bad_pcm_state(pcm, P_STATE_RUNNABLE, 0);
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
- SNDMSG("PCM not set up");
+ snd_check(PCM, "PCM not set up");
return -EIO;
}
if (frames == 0)
assert(pcm);
assert(size == 0 || buffer);
if (CHECK_SANITY(! pcm->setup)) {
- SNDMSG("PCM not set up");
+ snd_check(PCM, "PCM not set up");
return -EIO;
}
if (pcm->access != SND_PCM_ACCESS_RW_INTERLEAVED) {
- SNDMSG("invalid access type %s", snd_pcm_access_name(pcm->access));
+ snd_check(PCM, "invalid access type %s", snd_pcm_access_name(pcm->access));
return -EINVAL;
}
err = bad_pcm_state(pcm, P_STATE_RUNNABLE, 0);
assert(pcm);
assert(size == 0 || bufs);
if (CHECK_SANITY(! pcm->setup)) {
- SNDMSG("PCM not set up");
+ snd_check(PCM, "PCM not set up");
return -EIO;
}
if (pcm->access != SND_PCM_ACCESS_RW_NONINTERLEAVED) {
- SNDMSG("invalid access type %s", snd_pcm_access_name(pcm->access));
+ snd_check(PCM, "invalid access type %s", snd_pcm_access_name(pcm->access));
return -EINVAL;
}
err = bad_pcm_state(pcm, P_STATE_RUNNABLE, 0);
assert(pcm);
assert(size == 0 || buffer);
if (CHECK_SANITY(! pcm->setup)) {
- SNDMSG("PCM not set up");
+ snd_check(PCM, "PCM not set up");
return -EIO;
}
if (pcm->access != SND_PCM_ACCESS_RW_INTERLEAVED) {
- SNDMSG("invalid access type %s", snd_pcm_access_name(pcm->access));
+ snd_check(PCM, "invalid access type %s", snd_pcm_access_name(pcm->access));
return -EINVAL;
}
err = bad_pcm_state(pcm, P_STATE_RUNNABLE, 0);
assert(pcm);
assert(size == 0 || bufs);
if (CHECK_SANITY(! pcm->setup)) {
- SNDMSG("PCM not set up");
+ snd_check(PCM, "PCM not set up");
return -EIO;
}
if (pcm->access != SND_PCM_ACCESS_RW_NONINTERLEAVED) {
- SNDMSG("invalid access type %s", snd_pcm_access_name(pcm->access));
+ snd_check(PCM, "invalid access type %s", snd_pcm_access_name(pcm->access));
return -EINVAL;
}
err = bad_pcm_state(pcm, P_STATE_RUNNABLE, 0);
if (pcm->fast_ops->poll_descriptors)
return pcm->fast_ops->poll_descriptors(pcm->fast_op_arg, pfds, space);
if (pcm->poll_fd < 0) {
- SNDMSG("poll_fd < 0");
+ snd_check(PCM, "poll_fd < 0");
return -EIO;
}
if (space >= 1 && pfds) {
assert(pcm);
assert(out);
if (CHECK_SANITY(! pcm->setup)) {
- SNDMSG("PCM not set up");
+ snd_check(PCM, "PCM not set up");
return -EIO;
}
snd_output_printf(out, " stream : %s\n", snd_pcm_stream_name(pcm->stream));
assert(pcm);
assert(out);
if (CHECK_SANITY(! pcm->setup)) {
- SNDMSG("PCM not set up");
+ snd_check(PCM, "PCM not set up");
return -EIO;
}
snd_output_printf(out, " tstamp_mode : %s\n", snd_pcm_tstamp_mode_name(pcm->tstamp_mode));
{
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
- SNDMSG("PCM not set up");
+ snd_check(PCM, "PCM not set up");
return -EIO;
}
return bytes * 8 / pcm->frame_bits;
{
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
- SNDMSG("PCM not set up");
+ snd_check(PCM, "PCM not set up");
return -EIO;
}
return frames * pcm->frame_bits / 8;
{
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
- SNDMSG("PCM not set up");
+ snd_check(PCM, "PCM not set up");
return -EIO;
}
return bytes * 8 / pcm->sample_bits;
{
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
- SNDMSG("PCM not set up");
+ snd_check(PCM, "PCM not set up");
return -EIO;
}
return samples * pcm->sample_bits / 8;
snd_pcm_t *snd_async_handler_get_pcm(snd_async_handler_t *handler)
{
if (handler->type != SND_ASYNC_HANDLER_PCM) {
- SNDMSG("invalid handler type %d", handler->type);
+ snd_check(PCM, "invalid handler type %d", handler->type);
return NULL;
}
return handler->u.pcm;
snd_config_get_id(pcm_conf, &id);
val = NULL;
snd_config_get_ascii(pcm_conf, &val);
- SNDERR("Invalid type for PCM %s%sdefinition (id: %s, value: %s)", name ? name : "", name ? " " : "", id, val);
+ snd_error(PCM, "Invalid type for PCM %s%sdefinition (id: %s, value: %s)", name ? name : "", name ? " " : "", id, val);
free(val);
return -EINVAL;
}
err = snd_config_search(pcm_conf, "type", &conf);
if (err < 0) {
- SNDERR("type is not defined");
+ snd_error(PCM, "type is not defined");
return err;
}
err = snd_config_get_id(conf, &id);
if (err < 0) {
- SNDERR("unable to get id");
+ snd_error(PCM, "unable to get id");
return err;
}
err = snd_config_get_string(conf, &str);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
return err;
}
err = snd_config_search_definition(pcm_root, "pcm_type", str, &type_conf);
if (err >= 0) {
if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("Invalid type for PCM type %s definition", str);
+ snd_error(PCM, "Invalid type for PCM type %s definition", str);
err = -EINVAL;
goto _err;
}
if (strcmp(id, "lib") == 0) {
err = snd_config_get_string(n, &lib);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
goto _err;
}
continue;
if (strcmp(id, "open") == 0) {
err = snd_config_get_string(n, &open_name);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
goto _err;
}
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(PCM, "Unknown field %s", id);
err = -EINVAL;
goto _err;
}
err = snd_config_search_definition(root, "pcm", name, &pcm_conf);
if (err < 0) {
- SNDERR("Unknown PCM %s", name);
+ snd_error(PCM, "Unknown PCM %s", name);
return err;
}
if (snd_config_get_string(pcm_conf, &str) >= 0)
npfds = __snd_pcm_poll_descriptors_count(pcm);
if (npfds <= 0 || npfds >= 16) {
- SNDERR("Invalid poll_fds %d", npfds);
+ snd_error(PCM, "Invalid poll_fds %d", npfds);
return -EIO;
}
pfd = alloca(sizeof(*pfd) * npfds);
if (err < 0)
return err;
if (err != npfds) {
- SNDMSG("invalid poll descriptors %d", err);
+ snd_check(PCM, "invalid poll descriptors %d", err);
return -EIO;
}
if (timeout == SND_PCM_WAIT_IO)
else if (timeout == SND_PCM_WAIT_DRAIN)
timeout = __snd_pcm_wait_drain_timeout(pcm);
else if (timeout < -1)
- SNDMSG("invalid snd_pcm_wait timeout argument %d", timeout);
+ snd_check(PCM, "invalid snd_pcm_wait timeout argument %d", timeout);
do {
__snd_pcm_unlock(pcm->fast_op_arg);
err_poll = poll(pfd, npfds, timeout);
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
- SNDMSG("PCM not set up");
+ snd_check(PCM, "PCM not set up");
return -EIO;
}
snd_pcm_lock(pcm->fast_op_arg);
assert(pcm && availp && delayp);
if (CHECK_SANITY(! pcm->setup)) {
- SNDMSG("PCM not set up");
+ snd_check(PCM, "PCM not set up");
return -EIO;
}
snd_pcm_lock(pcm->fast_op_arg);
break;
}
default:
- SNDMSG("invalid format width %d", width);
+ snd_check(PCM, "invalid format width %d", width);
return -EINVAL;
}
return 0;
break;
}
default:
- SNDMSG("invalid format width %d", width);
+ snd_check(PCM, "invalid format width %d", width);
return -EINVAL;
}
return 0;
assert(dst_areas);
assert(src_areas);
if (! channels) {
- SNDMSG("invalid channels %d", channels);
+ snd_check(PCM, "invalid channels %d", channels);
return -EINVAL;
}
if (! frames) {
- SNDMSG("invalid frames %ld", frames);
+ snd_check(PCM, "invalid frames %ld", frames);
return -EINVAL;
}
while (channels > 0) {
{
assert(params);
if (CHECK_SANITY(params->info == ~0U)) {
- SNDMSG("invalid PCM info field");
+ snd_check(PCM, "invalid PCM info field");
return 0; /* FIXME: should be a negative error? */
}
return !!(params->info & SNDRV_PCM_INFO_MMAP_VALID);
{
assert(params);
if (CHECK_SANITY(params->info == ~0U)) {
- SNDMSG("invalid PCM info field");
+ snd_check(PCM, "invalid PCM info field");
return 0; /* FIXME: should be a negative error? */
}
return !!(params->info & SNDRV_PCM_INFO_DOUBLE);
{
assert(params);
if (CHECK_SANITY(params->info == ~0U)) {
- SNDMSG("invalid PCM info field");
+ snd_check(PCM, "invalid PCM info field");
return 0; /* FIXME: should be a negative error? */
}
return !!(params->info & SNDRV_PCM_INFO_BATCH);
{
assert(params);
if (CHECK_SANITY(params->info == ~0U)) {
- SNDMSG("invalid PCM info field");
+ snd_check(PCM, "invalid PCM info field");
return 0; /* FIXME: should be a negative error? */
}
return !!(params->info & SNDRV_PCM_INFO_BLOCK_TRANSFER);
{
assert(params);
if (CHECK_SANITY(params->info == ~0U)) {
- SNDMSG("invalid PCM info field");
+ snd_check(PCM, "invalid PCM info field");
return 0; /* FIXME: should be a negative error? */
}
return !!(params->info & SND_PCM_INFO_MONOTONIC);
{
assert(params);
if (CHECK_SANITY(params->info == ~0U)) {
- SNDMSG("invalid PCM info field");
+ snd_check(PCM, "invalid PCM info field");
return 0; /* FIXME: should be a negative error? */
}
return !!(params->info & SNDRV_PCM_INFO_OVERRANGE);
{
assert(params);
if (CHECK_SANITY(params->info == ~0U)) {
- SNDMSG("invalid PCM info field");
+ snd_check(PCM, "invalid PCM info field");
return 0; /* FIXME: should be a negative error? */
}
return !!(params->info & SNDRV_PCM_INFO_PAUSE);
{
assert(params);
if (CHECK_SANITY(params->info == ~0U)) {
- SNDMSG("invalid PCM info field");
+ snd_check(PCM, "invalid PCM info field");
return 0; /* FIXME: should be a negative error? */
}
return !!(params->info & SNDRV_PCM_INFO_RESUME);
{
assert(params);
if (CHECK_SANITY(params->info == ~0U)) {
- SNDMSG("invalid PCM info field");
+ snd_check(PCM, "invalid PCM info field");
return 0; /* FIXME: should be a negative error? */
}
return !!(params->info & SNDRV_PCM_INFO_HALF_DUPLEX);
{
assert(params);
if (CHECK_SANITY(params->info == ~0U)) {
- SNDMSG("invalid PCM info field");
+ snd_check(PCM, "invalid PCM info field");
return 0; /* FIXME: should be a negative error? */
}
return !!(params->info & SNDRV_PCM_INFO_JOINT_DUPLEX);
{
assert(params);
if (CHECK_SANITY(params->info == ~0U)) {
- SNDMSG("invalid PCM info field");
+ snd_check(PCM, "invalid PCM info field");
return 0; /* FIXME: should be a negative error? */
}
return !!(params->info & SNDRV_PCM_INFO_SYNC_START);
{
assert(params);
if (CHECK_SANITY(params->info == ~0U)) {
- SNDMSG("invalid PCM info field");
+ snd_check(PCM, "invalid PCM info field");
return 0; /* FIXME: should be a negative error? */
}
return !!(params->info & SNDRV_PCM_INFO_NO_PERIOD_WAKEUP);
{
assert(params);
if (CHECK_SANITY(params->info == ~0U)) {
- SNDMSG("invalid PCM info field");
+ snd_check(PCM, "invalid PCM info field");
return 0; /* FIXME: should be a negative error? */
}
return !!(params->info & SNDRV_PCM_INFO_PERFECT_DRAIN);
{
assert(params);
if (CHECK_SANITY(params->info == ~0U)) {
- SNDMSG("invalid PCM info field");
+ snd_check(PCM, "invalid PCM info field");
return 0; /* FIXME: should be a negative error? */
}
switch (type) {
{
assert(params);
if (CHECK_SANITY(params->rate_den == 0)) {
- SNDMSG("invalid rate_den value");
+ snd_check(PCM, "invalid rate_den value");
return -EINVAL;
}
*rate_num = params->rate_num;
{
assert(params);
if (CHECK_SANITY(params->msbits == 0)) {
- SNDMSG("invalid msbits value");
+ snd_check(PCM, "invalid msbits value");
return -EINVAL;
}
return params->msbits;
{
assert(params);
if (CHECK_SANITY(params->info == ~0U)) {
- SNDMSG("invalid PCM info field");
+ snd_check(PCM, "invalid PCM info field");
return -EINVAL;
}
return params->fifo_size;
{
assert(pcm && params);
if (CHECK_SANITY(! pcm->setup)) {
- SNDMSG("PCM not set up");
+ snd_check(PCM, "PCM not set up");
return -EIO;
}
__snd_pcm_lock(pcm); /* forced lock due to pcm field changes */
params->start_threshold = pcm->boundary;
break;
default:
- SNDMSG("invalid start mode value %d", val);
+ snd_check(PCM, "invalid start mode value %d", val);
return -EINVAL;
}
return 0;
params->stop_threshold = pcm->boundary;
break;
default:
- SNDMSG("invalid xrun mode value %d", val);
+ snd_check(PCM, "invalid xrun mode value %d", val);
return -EINVAL;
}
return 0;
{
assert(pcm && params);
if (CHECK_SANITY(val > SND_PCM_TSTAMP_LAST)) {
- SNDMSG("invalid tstamp_mode value %d", val);
+ snd_check(PCM, "invalid tstamp_mode value %d", val);
return -EINVAL;
}
params->tstamp_mode = val;
{
assert(pcm && params);
if (CHECK_SANITY(val > SND_PCM_TSTAMP_TYPE_LAST)) {
- SNDMSG("invalid tstamp_type value %d", val);
+ snd_check(PCM, "invalid tstamp_type value %d", val);
return -EINVAL;
}
params->tstamp_type = val;
{
assert(pcm && params);
if (CHECK_SANITY(val >= pcm->buffer_size)) {
- SNDMSG("invalid silent_threshold value %ld (buffer_size = %ld)",
- val, pcm->buffer_size);
+ snd_check(PCM, "invalid silent_threshold value %ld (buffer_size = %ld)",
+ val, pcm->buffer_size);
+
return -EINVAL;
}
params->silence_threshold = val;
{
assert(pcm && params);
if (CHECK_SANITY(val < pcm->boundary && val > pcm->buffer_size)) {
- SNDMSG("invalid silence_size %ld (boundary %ld, buffer_size %ld)",
- val, pcm->boundary, pcm->buffer_size);
+ snd_check(PCM, "invalid silence_size %ld (boundary %ld, buffer_size %ld)",
+ val, pcm->boundary, pcm->buffer_size);
+
return -EINVAL;
}
params->silence_size = val;
{
assert(pcm);
if (CHECK_SANITY(offset != *pcm->appl.ptr % pcm->buffer_size)) {
- SNDMSG("commit offset (%ld) doesn't match with appl_ptr (%ld) %% buf_size (%ld)",
- offset, *pcm->appl.ptr, pcm->buffer_size);
+ snd_check(PCM, "commit offset (%ld) doesn't match with appl_ptr (%ld) %% buf_size (%ld)",
+ offset, *pcm->appl.ptr, pcm->buffer_size);
+
return -EPIPE;
}
if (CHECK_SANITY(frames > snd_pcm_mmap_avail(pcm))) {
- SNDMSG("commit frames (%ld) overflow (avail = %ld)", frames,
- snd_pcm_mmap_avail(pcm));
+ snd_check(PCM, "commit frames (%ld) overflow (avail = %ld)", frames,
+ snd_pcm_mmap_avail(pcm));
+
return -EPIPE;
}
if (pcm->fast_ops->mmap_commit)
if (snd_config_get_string(conf, &str) >= 0) {
err = snd_config_search_definition(root, "pcm_slave", str, &conf);
if (err < 0) {
- SNDERR("Invalid slave definition");
+ snd_error(PCM, "Invalid slave definition");
return -EINVAL;
}
to_free = 1;
}
if (snd_config_get_type(conf) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("Invalid slave definition");
+ snd_error(PCM, "Invalid slave definition");
err = -EINVAL;
goto _err;
}
err = snd_config_get_string(n, &str);
if (err < 0) {
_invalid:
- SNDERR("invalid type for %s", id);
+ snd_error(PCM, "invalid type for %s", id);
goto _err;
}
if ((fields[k].flags & SCONF_UNCHANGED) &&
}
f = snd_pcm_format_value(str);
if (f == SND_PCM_FORMAT_UNKNOWN) {
- SNDERR("unknown format %s", str);
+ snd_error(PCM, "unknown format %s", str);
err = -EINVAL;
goto _err;
}
}
if (k < count)
continue;
- SNDERR("Unknown field %s", id);
+ snd_error(PCM, "Unknown field %s", id);
err = -EINVAL;
goto _err;
}
if (!pcm_conf) {
- SNDERR("missing field pcm");
+ snd_error(PCM, "missing field pcm");
err = -EINVAL;
goto _err;
}
for (k = 0; k < count; ++k) {
if ((fields[k].flags & SCONF_MANDATORY) && !fields[k].present) {
- SNDERR("missing field %s", names[fields[k].index]);
+ snd_error(PCM, "missing field %s", names[fields[k].index]);
err = -EINVAL;
goto _err;
}
else
s = "overrun";
if (!silent)
- SNDERR("%s occurred", s);
+ snd_error(PCM, "%s occurred", s);
err = snd_pcm_prepare(pcm);
if (err < 0) {
- SNDERR("cannot recovery from %s, prepare failed: %s", s, snd_strerror(err));
+ snd_error(PCM, "cannot recovery from %s, prepare failed: %s", s, snd_strerror(err));
return err;
}
return 0;
if (err < 0) {
err = snd_pcm_prepare(pcm);
if (err < 0) {
- SNDERR("cannot recovery from suspend, prepare failed: %s", snd_strerror(err));
+ snd_error(PCM, "cannot recovery from suspend, prepare failed: %s", snd_strerror(err));
return err;
}
}
/* choose all parameters */
err = snd_pcm_hw_params_any(pcm, ¶ms);
if (err < 0) {
- SNDERR("Broken configuration for %s: no configurations available",
- s);
+ snd_error(PCM, "Broken configuration for %s: no configurations available",
+ s);
+
return err;
}
/* set software resampling */
err = snd_pcm_hw_params_set_rate_resample(pcm, ¶ms, soft_resample);
if (err < 0) {
- SNDERR("Resampling setup failed for %s: %s",
- s, snd_strerror(err));
+ snd_error(PCM, "Resampling setup failed for %s: %s",
+ s, snd_strerror(err));
+
return err;
}
/* set the selected read/write format */
err = snd_pcm_hw_params_set_access(pcm, ¶ms, access);
if (err < 0) {
- SNDERR("Access type not available for %s: %s",
- s, snd_strerror(err));
+ snd_error(PCM, "Access type not available for %s: %s",
+ s, snd_strerror(err));
+
return err;
}
/* set the sample format */
err = snd_pcm_hw_params_set_format(pcm, ¶ms, format);
if (err < 0) {
- SNDERR("Sample format not available for %s: %s",
- s, snd_strerror(err));
+ snd_error(PCM, "Sample format not available for %s: %s",
+ s, snd_strerror(err));
+
return err;
}
/* set the count of channels */
err = snd_pcm_hw_params_set_channels(pcm, ¶ms, channels);
if (err < 0) {
- SNDERR("Channels count (%i) not available for %s: %s",
- channels, s, snd_strerror(err));
+ snd_error(PCM, "Channels count (%i) not available for %s: %s",
+ channels, s, snd_strerror(err));
+
return err;
}
/* set the stream rate */
err = INTERNAL(snd_pcm_hw_params_set_rate_near)(pcm, ¶ms, &rrate,
0);
if (err < 0) {
- SNDERR("Rate %iHz not available for playback: %s",
- rate, snd_strerror(err));
+ snd_error(PCM, "Rate %iHz not available for playback: %s",
+ rate, snd_strerror(err));
+
return err;
}
if (rrate != rate) {
- SNDERR("Rate doesn't match (requested %iHz, get %iHz)",
- rate, rrate);
+ snd_error(PCM, "Rate doesn't match (requested %iHz, get %iHz)",
+ rate, rrate);
+
return -EINVAL;
}
/* set the buffer time */
err = INTERNAL(snd_pcm_hw_params_set_period_time_near)(pcm,
¶ms, &period_time, NULL);
if (err < 0) {
- SNDERR("Unable to set period time %i for %s: %s",
- period_time, s, snd_strerror(err));
+ snd_error(PCM, "Unable to set period time %i for %s: %s",
+ period_time, s, snd_strerror(err));
+
return err;
}
err = INTERNAL(snd_pcm_hw_params_get_period_size)(¶ms,
&period_size, NULL);
if (err < 0) {
- SNDERR("Unable to get period size for %s: %s",
- s, snd_strerror(err));
+ snd_error(PCM, "Unable to get period size for %s: %s",
+ s, snd_strerror(err));
+
return err;
}
buffer_size = period_size * 4;
err = INTERNAL(snd_pcm_hw_params_set_buffer_size_near)(pcm,
¶ms, &buffer_size);
if (err < 0) {
- SNDERR("Unable to set buffer size %lu %s: %s",
- buffer_size, s, snd_strerror(err));
+ snd_error(PCM, "Unable to set buffer size %lu %s: %s",
+ buffer_size, s, snd_strerror(err));
+
return err;
}
err = INTERNAL(snd_pcm_hw_params_get_buffer_size)(¶ms,
&buffer_size);
if (err < 0) {
- SNDERR("Unable to get buffer size for %s: %s",
- s, snd_strerror(err));
+ snd_error(PCM, "Unable to get buffer size for %s: %s",
+ s, snd_strerror(err));
+
return err;
}
} else {
err = INTERNAL(snd_pcm_hw_params_get_buffer_size)(¶ms,
&buffer_size);
if (err < 0) {
- SNDERR("Unable to get buffer size for %s: %s",
- s, snd_strerror(err));
+ snd_error(PCM, "Unable to get buffer size for %s: %s",
+ s, snd_strerror(err));
+
return err;
}
err = INTERNAL(snd_pcm_hw_params_get_buffer_time)(¶ms,
&latency, NULL);
if (err < 0) {
- SNDERR("Unable to get buffer time (latency) for %s: %s",
- s, snd_strerror(err));
+ snd_error(PCM, "Unable to get buffer time (latency) for %s: %s",
+ s, snd_strerror(err));
+
return err;
}
/* set the period time */
err = INTERNAL(snd_pcm_hw_params_set_period_time_near)(pcm,
¶ms, &period_time, NULL);
if (err < 0) {
- SNDERR("Unable to set period time %i for %s: %s",
- period_time, s, snd_strerror(err));
+ snd_error(PCM, "Unable to set period time %i for %s: %s",
+ period_time, s, snd_strerror(err));
+
return err;
}
err = INTERNAL(snd_pcm_hw_params_get_period_size)(¶ms,
&period_size, NULL);
if (err < 0) {
- SNDERR("Unable to get period size for %s: %s",
- s, snd_strerror(err));
+ snd_error(PCM, "Unable to get period size for %s: %s",
+ s, snd_strerror(err));
+
return err;
}
}
/* write the parameters to device */
err = snd_pcm_hw_params(pcm, ¶ms);
if (err < 0) {
- SNDERR("Unable to set hw params for %s: %s",
- s, snd_strerror(err));
+ snd_error(PCM, "Unable to set hw params for %s: %s",
+ s, snd_strerror(err));
+
return err;
}
/* get the current swparams */
err = snd_pcm_sw_params_current(pcm, &swparams);
if (err < 0) {
- SNDERR("Unable to determine current swparams for %s: %s",
- s, snd_strerror(err));
+ snd_error(PCM, "Unable to determine current swparams for %s: %s",
+ s, snd_strerror(err));
+
return err;
}
/*
err = snd_pcm_sw_params_set_start_threshold(pcm, &swparams,
(buffer_size / period_size) * period_size);
if (err < 0) {
- SNDERR("Unable to set start threshold mode for %s: %s",
- s, snd_strerror(err));
+ snd_error(PCM, "Unable to set start threshold mode for %s: %s",
+ s, snd_strerror(err));
+
return err;
}
/*
*/
err = snd_pcm_sw_params_set_avail_min(pcm, &swparams, period_size);
if (err < 0) {
- SNDERR("Unable to set avail min for %s: %s",
- s, snd_strerror(err));
+ snd_error(PCM, "Unable to set avail min for %s: %s",
+ s, snd_strerror(err));
+
return err;
}
/* write the parameters to the playback device */
err = snd_pcm_sw_params(pcm, &swparams);
if (err < 0) {
- SNDERR("Unable to set sw params for %s: %s",
- s, snd_strerror(err));
+ snd_error(PCM, "Unable to set sw params for %s: %s",
+ s, snd_strerror(err));
+
return err;
}
return 0;
slave = n;
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!slave) {
- SNDERR("slave is not defined");
+ snd_error(PCM, "slave is not defined");
return -EINVAL;
}
err = snd_pcm_slave_conf(root, slave, &sconf, 1,
if (snd_pcm_format_linear(sformat) != 1 &&
sformat != SND_PCM_FORMAT_IMA_ADPCM) {
snd_config_delete(sconf);
- SNDERR("invalid slave format");
+ snd_error(PCM, "invalid slave format");
return -EINVAL;
}
err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);
slave = n;
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!slave) {
- SNDERR("slave is not defined");
+ snd_error(PCM, "slave is not defined");
return -EINVAL;
}
err = snd_pcm_slave_conf(root, slave, &sconf, 1,
if (snd_pcm_format_linear(sformat) != 1 &&
sformat != SND_PCM_FORMAT_A_LAW) {
snd_config_delete(sconf);
- SNDERR("invalid slave format");
+ snd_error(PCM, "invalid slave format");
return -EINVAL;
}
err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);
slave = n;
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (! slave) {
- SNDERR("%s slave is not defined",
- stream == SND_PCM_STREAM_PLAYBACK ? "playback" : "capture");
+ snd_error(PCM, "%s slave is not defined",
+ stream == SND_PCM_STREAM_PLAYBACK ? "playback" : "capture");
+
return -EINVAL;
}
err = snd_pcm_slave_conf(root, slave, &sconf, 0);
slave = n;
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!slave) {
- SNDERR("slave is not defined");
+ snd_error(PCM, "slave is not defined");
return -EINVAL;
}
err = snd_pcm_slave_conf(root, slave, &sconf, 0);
sock = socket(PF_LOCAL, SOCK_STREAM, 0);
if (sock < 0) {
int result = -errno;
- SYSERR("socket failed");
+ snd_errornum(PCM, "socket failed");
return result;
}
if (server) {
if (bind(sock, (struct sockaddr *) addr, size) < 0) {
int result = -errno;
- SYSERR("bind failed: %s", filename);
+ snd_errornum(PCM, "bind failed: %s", filename);
close(sock);
return result;
} else {
if (chmod(filename, ipc_perm) < 0) {
int result = -errno;
- SYSERR("chmod failed: %s", filename);
+ snd_errornum(PCM, "chmod failed: %s", filename);
close(sock);
unlink(filename);
return result;
if (chown(filename, -1, ipc_gid) < 0) {
#if 0 /* it's not fatal */
int result = -errno;
- SYSERR("chown failed: %s", filename);
+ snd_errornum(PCM, "chown failed: %s", filename);
close(sock);
unlink(filename);
return result;
} else {
if (connect(sock, (struct sockaddr *) addr, size) < 0) {
int result = -errno;
- SYSERR("connect failed: %s", filename);
+ snd_errornum(PCM, "connect failed: %s", filename);
close(sock);
return result;
}
semerr = snd_pcm_direct_semaphore_down(direct,
DIRECT_IPC_SEM_CLIENT);
if (semerr < 0) {
- SNDERR("SEMDOWN FAILED with err %d", semerr);
+ snd_error(PCM, "SEMDOWN FAILED with err %d", semerr);
return semerr;
}
semerr = snd_pcm_direct_semaphore_up(direct,
DIRECT_IPC_SEM_CLIENT);
if (semerr < 0) {
- SNDERR("SEMUP FAILED with err %d", semerr);
+ snd_error(PCM, "SEMUP FAILED with err %d", semerr);
return semerr;
}
return 0;
ret = snd_pcm_prepare(direct->spcm);
if (ret < 0) {
- SNDERR("recover: unable to prepare slave");
+ snd_error(PCM, "recover: unable to prepare slave");
semerr = snd_pcm_direct_semaphore_up(direct,
DIRECT_IPC_SEM_CLIENT);
if (semerr < 0) {
- SNDERR("SEMUP FAILED with err %d", semerr);
+ snd_error(PCM, "SEMUP FAILED with err %d", semerr);
return semerr;
}
return ret;
ret = snd_pcm_start(direct->spcm);
if (ret < 0) {
- SNDERR("recover: unable to start slave");
+ snd_error(PCM, "recover: unable to start slave");
semerr = snd_pcm_direct_semaphore_up(direct,
DIRECT_IPC_SEM_CLIENT);
if (semerr < 0) {
- SNDERR("SEMUP FAILED with err %d", semerr);
+ snd_error(PCM, "SEMUP FAILED with err %d", semerr);
return semerr;
}
return ret;
semerr = snd_pcm_direct_semaphore_up(direct,
DIRECT_IPC_SEM_CLIENT);
if (semerr < 0) {
- SNDERR("SEMUP FAILED with err %d", semerr);
+ snd_error(PCM, "SEMUP FAILED with err %d", semerr);
return semerr;
}
return 0;
unsigned int space)
{
if (pcm->poll_fd < 0) {
- SNDMSG("poll_fd < 0");
+ snd_check(PCM, "poll_fd < 0");
return -EIO;
}
if (space >= 1 && pfds) {
return 0;
i = hw_param_interval(params, var);
if (snd_interval_empty(i)) {
- SNDERR("dshare interval %i empty?", (int)var);
+ snd_error(PCM, "dshare interval %i empty?", (int)var);
return -EINVAL;
}
if (snd_interval_refine(i, src))
#endif
if (params->rmask & (1<<SND_PCM_HW_PARAM_ACCESS)) {
if (snd_mask_empty(hw_param_mask(params, SND_PCM_HW_PARAM_ACCESS))) {
- SNDERR("dshare access mask empty?");
+ snd_error(PCM, "dshare access mask empty?");
return -EINVAL;
}
if (snd_mask_refine(hw_param_mask(params, SND_PCM_HW_PARAM_ACCESS), &access))
}
if (params->rmask & (1<<SND_PCM_HW_PARAM_FORMAT)) {
if (snd_mask_empty(hw_param_mask(params, SND_PCM_HW_PARAM_FORMAT))) {
- SNDERR("dshare format mask empty?");
+ snd_error(PCM, "dshare format mask empty?");
return -EINVAL;
}
if (snd_mask_refine_set(hw_param_mask(params, SND_PCM_HW_PARAM_FORMAT),
//snd_mask_none(hw_param_mask(params, SND_PCM_HW_PARAM_SUBFORMAT));
if (params->rmask & (1<<SND_PCM_HW_PARAM_CHANNELS)) {
if (snd_interval_empty(hw_param_interval(params, SND_PCM_HW_PARAM_CHANNELS))) {
- SNDERR("dshare channels mask empty?");
+ snd_error(PCM, "dshare channels mask empty?");
return -EINVAL;
}
err = snd_interval_refine_set(hw_param_interval(params, SND_PCM_HW_PARAM_CHANNELS), dshare->channels);
__again:
if (loops-- <= 0) {
- SNDERR("unable to find a valid configuration for slave");
+ snd_error(PCM, "unable to find a valid configuration for slave");
return -EINVAL;
}
ret = snd_pcm_hw_params_any(spcm, &hw_params);
if (ret < 0) {
- SNDERR("snd_pcm_hw_params_any failed");
+ snd_error(PCM, "snd_pcm_hw_params_any failed");
return ret;
}
ret = snd_pcm_hw_params_set_access(spcm, &hw_params,
ret = snd_pcm_hw_params_set_access(spcm, &hw_params,
SND_PCM_ACCESS_MMAP_NONINTERLEAVED);
if (ret < 0) {
- SNDERR("slave plugin does not support mmap interleaved or mmap noninterleaved access");
+ snd_error(PCM, "slave plugin does not support mmap interleaved or mmap noninterleaved access");
return ret;
}
}
&hw_params, &format);
}
if (ret < 0) {
- SNDERR("requested or auto-format is not available");
+ snd_error(PCM, "requested or auto-format is not available");
return ret;
}
params->format = format;
ret = INTERNAL(snd_pcm_hw_params_set_channels_near)(spcm, &hw_params,
(unsigned int *)¶ms->channels);
if (ret < 0) {
- SNDERR("requested count of channels is not available");
+ snd_error(PCM, "requested count of channels is not available");
return ret;
}
ret = INTERNAL(snd_pcm_hw_params_set_rate_near)(spcm, &hw_params,
(unsigned int *)¶ms->rate, 0);
if (ret < 0) {
- SNDERR("requested rate is not available");
+ snd_error(PCM, "requested rate is not available");
return ret;
}
ret = INTERNAL(snd_pcm_hw_params_set_buffer_time_near)(spcm,
&hw_params, (unsigned int *)¶ms->buffer_time, 0);
if (ret < 0) {
- SNDERR("unable to set buffer time");
+ snd_error(PCM, "unable to set buffer time");
return ret;
}
} else if (params->buffer_size > 0) {
ret = INTERNAL(snd_pcm_hw_params_set_buffer_size_near)(spcm,
&hw_params, (snd_pcm_uframes_t *)¶ms->buffer_size);
if (ret < 0) {
- SNDERR("unable to set buffer size");
+ snd_error(PCM, "unable to set buffer size");
return ret;
}
} else {
ret = INTERNAL(snd_pcm_hw_params_set_period_time_near)(spcm,
&hw_params, (unsigned int *)¶ms->period_time, 0);
if (ret < 0) {
- SNDERR("unable to set period_time");
+ snd_error(PCM, "unable to set period_time");
return ret;
}
} else if (params->period_size > 0) {
&hw_params, (snd_pcm_uframes_t *)¶ms->period_size,
0);
if (ret < 0) {
- SNDERR("unable to set period_size");
+ snd_error(PCM, "unable to set period_size");
return ret;
}
}
ret = INTERNAL(snd_pcm_hw_params_set_periods_near)(spcm,
&hw_params, ¶ms->periods, 0);
if (ret < 0) {
- SNDERR("unable to set requested periods");
+ snd_error(PCM, "unable to set requested periods");
return ret;
}
if (params->periods == 1) {
params->period_size /= 2;
goto __again;
}
- SNDERR("unable to use stream with periods == 1");
+ snd_error(PCM, "unable to use stream with periods == 1");
return ret;
}
}
ret = snd_pcm_hw_params(spcm, &hw_params);
if (ret < 0) {
- SNDERR("unable to install hw params");
+ snd_error(PCM, "unable to install hw params");
return ret;
}
ret = snd_pcm_sw_params_current(spcm, &sw_params);
if (ret < 0) {
- SNDERR("unable to get current sw_params");
+ snd_error(PCM, "unable to get current sw_params");
return ret;
}
ret = snd_pcm_sw_params_get_boundary(&sw_params, &boundary);
if (ret < 0) {
- SNDERR("unable to get boundary");
+ snd_error(PCM, "unable to get boundary");
return ret;
}
ret = snd_pcm_sw_params_set_stop_threshold(spcm, &sw_params, boundary);
if (ret < 0) {
- SNDERR("unable to set stop threshold");
+ snd_error(PCM, "unable to set stop threshold");
return ret;
}
ret = snd_pcm_sw_params_set_tstamp_mode(spcm, &sw_params,
SND_PCM_TSTAMP_ENABLE);
if (ret < 0) {
- SNDERR("unable to tstamp mode MMAP");
+ snd_error(PCM, "unable to tstamp mode MMAP");
return ret;
}
ret = snd_pcm_sw_params_set_tstamp_type(spcm, &sw_params,
dmix->tstamp_type);
if (ret < 0) {
- SNDERR("unable to set tstamp type");
+ snd_error(PCM, "unable to set tstamp type");
return ret;
}
}
ret = snd_pcm_sw_params_set_silence_threshold(spcm, &sw_params, 0);
if (ret < 0) {
- SNDERR("unable to set silence threshold");
+ snd_error(PCM, "unable to set silence threshold");
return ret;
}
ret = snd_pcm_sw_params_set_silence_size(spcm, &sw_params, boundary);
if (ret < 0) {
- SNDERR("unable to set silence threshold (please upgrade to 0.9.0rc8+ driver)");
+ snd_error(PCM, "unable to set silence threshold (please upgrade to 0.9.0rc8+ driver)");
return ret;
}
ret = snd_pcm_sw_params(spcm, &sw_params);
if (ret < 0) {
- SNDERR("unable to install sw params (please upgrade to 0.9.0rc8+ driver)");
+ snd_error(PCM, "unable to install sw params (please upgrade to 0.9.0rc8+ driver)");
return ret;
}
ret = snd_pcm_start(spcm);
if (ret < 0) {
- SNDERR("unable to start PCM stream");
+ snd_error(PCM, "unable to start PCM stream");
return ret;
}
if (snd_pcm_poll_descriptors_count(spcm) != 1) {
- SNDERR("unable to use hardware pcm with fd more than one!!!");
+ snd_error(PCM, "unable to use hardware pcm with fd more than one!!!");
return ret;
}
snd_pcm_poll_descriptors(spcm, &fd, 1);
dmix->timer_ticks = 1;
ret = snd_pcm_info(dmix->spcm, &info);
if (ret < 0) {
- SNDERR("unable to info for slave pcm");
+ snd_error(PCM, "unable to info for slave pcm");
return ret;
}
sprintf(name, "hw:CLASS=%i,SCLASS=0,CARD=%i,DEV=%i,SUBDEV=%i",
ret = snd_timer_open(&dmix->timer, name,
SND_TIMER_OPEN_NONBLOCK);
if (ret < 0) {
- SNDERR("unable to open timer '%s'", name);
+ snd_error(PCM, "unable to open timer '%s'", name);
return ret;
}
}
if (snd_timer_poll_descriptors_count(dmix->timer) != 1) {
- SNDERR("unable to use timer '%s' with more than one fd!", name);
+ snd_error(PCM, "unable to use timer '%s' with more than one fd!", name);
return ret;
}
snd_timer_poll_descriptors(dmix->timer, &dmix->timer_fd, 1);
ret = snd_pcm_hw_open_fd(spcmp, client_name, dmix->hw_fd, 0);
if (ret < 0) {
- SNDERR("unable to open hardware");
+ snd_error(PCM, "unable to open hardware");
return ret;
}
ret = snd_pcm_mmap(spcm);
if (ret < 0) {
- SNDERR("unable to mmap channels");
+ snd_error(PCM, "unable to mmap channels");
return ret;
}
return 0;
ret = snd_pcm_mmap(spcm);
if (ret < 0) {
- SNDERR("unable to mmap channels");
+ snd_error(PCM, "unable to mmap channels");
return ret;
}
return 0;
}
ret = snd_timer_params(dmix->timer, ¶ms);
if (ret < 0) {
- SNDERR("unable to set timer parameters");
+ snd_error(PCM, "unable to set timer parameters");
return ret;
}
return 0;
if (cfg == NULL)
return 0;
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("invalid type for bindings");
+ snd_error(PCM, "invalid type for bindings");
return -EINVAL;
}
snd_config_for_each(i, next, cfg) {
continue;
err = safe_strtol(id, &cchannel);
if (err < 0 || cchannel < 0) {
- SNDERR("invalid client channel in binding: %s", id);
+ snd_error(PCM, "invalid client channel in binding: %s", id);
return -EINVAL;
}
if ((unsigned)cchannel >= count)
if (count == 0)
return 0;
if (count > 1024) {
- SNDERR("client channel out of range");
+ snd_error(PCM, "client channel out of range");
return -EINVAL;
}
bindings = malloc(count * sizeof(unsigned int));
continue;
safe_strtol(id, &cchannel);
if (snd_config_get_integer(n, &schannel) < 0) {
- SNDERR("unable to get slave channel (should be integer type) in binding: %s", id);
+ snd_error(PCM, "unable to get slave channel (should be integer type) in binding: %s", id);
free(bindings);
return -EINVAL;
}
if (schannel < 0 || schannel >= params->channels) {
- SNDERR("invalid slave channel number %ld in binding to %ld",
- schannel, cchannel);
+ snd_error(PCM, "invalid slave channel number %ld in binding to %ld",
+ schannel, cchannel);
+
free(bindings);
return -EINVAL;
}
if (chn == chn1)
continue;
if (bindings[chn] == dmix->bindings[chn1]) {
- SNDERR("unable to route channels %d,%d to same destination %d", chn, chn1, bindings[chn]);
+ snd_error(PCM, "unable to route channels %d,%d to same destination %d", chn, chn1, bindings[chn]);
free(bindings);
return -EINVAL;
}
if (snd_config_get_string(sconf, &str) >= 0) {
if (hop > SND_CONF_MAX_HOPS) {
- SNDERR("Too many definition levels (looped?)");
+ snd_error(PCM, "Too many definition levels (looped?)");
return -EINVAL;
}
err = snd_config_search_definition(root, "pcm", str, &pcm_conf);
if (err < 0) {
- SNDERR("Unknown slave PCM %s", str);
+ snd_error(PCM, "Unknown slave PCM %s", str);
return err;
}
err = _snd_pcm_direct_get_slave_ipc_offset(root, pcm_conf,
if (strcmp(id, "type") == 0) {
err = snd_config_get_string(n, &str);
if (err < 0) {
- SNDERR("Invalid value for PCM type definition");
+ snd_error(PCM, "Invalid value for PCM type definition");
return -EINVAL;
}
if (strcmp(str, "hw")) {
- SNDERR("Invalid type '%s' for slave PCM", str);
+ snd_error(PCM, "Invalid type '%s' for slave PCM", str);
return -EINVAL;
}
continue;
if (strcmp(id, "device") == 0) {
err = snd_config_get_integer(n, &device);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
return err;
}
continue;
if (strcmp(id, "subdevice") == 0) {
err = snd_config_get_integer(n, &subdevice);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
return err;
}
continue;
long key;
err = snd_config_get_integer(n, &key);
if (err < 0) {
- SNDERR("The field ipc_key must be an integer type");
+ snd_error(PCM, "The field ipc_key must be an integer type");
return err;
}
long perm;
err = snd_config_get_integer(n, &perm);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
return err;
}
if ((perm & ~0777) != 0) {
- SNDERR("The field ipc_perm must be a valid file permission");
+ snd_error(PCM, "The field ipc_perm must be a valid file permission");
return -EINVAL;
}
rec->ipc_perm = perm;
const char *str;
err = snd_config_get_string(n, &str);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
if (strcmp(str, "no") == 0 || strcmp(str, "off") == 0)
else if (strcmp(str, "auto") == 0)
rec->hw_ptr_alignment = SND_PCM_HW_PTR_ALIGNMENT_AUTO;
else {
- SNDERR("The field hw_ptr_alignment is invalid : %s", str);
+ snd_error(PCM, "The field hw_ptr_alignment is invalid : %s", str);
return -EINVAL;
}
const char *str;
err = snd_config_get_string(n, &str);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
if (strcmp(str, "default") == 0)
else if (strcmp(str, "monotonic_raw") == 0)
rec->tstamp_type = SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW;
else {
- SNDERR("The field tstamp_type is invalid : %s", str);
+ snd_error(PCM, "The field tstamp_type is invalid : %s", str);
return -EINVAL;
}
continue;
char *endp;
err = snd_config_get_ascii(n, &group);
if (err < 0) {
- SNDERR("The field ipc_gid must be a valid group");
+ snd_error(PCM, "The field ipc_gid must be a valid group");
return err;
}
if (! *group) {
return -ENOMEM;
int st = getgrnam_r(group, &grp, buffer, len, &pgrp);
if (st != 0 || !pgrp) {
- SNDERR("The field ipc_gid must be a valid group (create group %s)", group);
+ snd_error(PCM, "The field ipc_gid must be a valid group (create group %s)", group);
free(buffer);
return -EINVAL;
}
}
if (strcmp(id, "ipc_key_add_uid") == 0) {
if ((err = snd_config_get_bool(n)) < 0) {
- SNDERR("The field ipc_key_add_uid must be a boolean type");
+ snd_error(PCM, "The field ipc_key_add_uid must be a boolean type");
return err;
}
ipc_key_add_uid = err;
rec->direct_memory_access = err;
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!rec->slave) {
- SNDERR("slave is not defined");
+ snd_error(PCM, "slave is not defined");
return -EINVAL;
}
if (!rec->ipc_key) {
- SNDERR("Unique IPC key is not defined");
+ snd_error(PCM, "Unique IPC key is not defined");
return -EINVAL;
}
if (ipc_key_add_uid)
while (1) {
ret = snd_pcm_direct_semaphore_create_or_connect(dmix);
if (ret < 0) {
- SNDERR("unable to create IPC semaphore");
+ snd_error(PCM, "unable to create IPC semaphore");
goto _err_nosem_free;
}
ret = snd_pcm_direct_semaphore_down(dmix, DIRECT_IPC_SEM_CLIENT);
ret = snd_pcm_direct_shm_create_or_connect(dmix);
if (ret < 0) {
- SNDERR("unable to create IPC shm instance");
+ snd_error(PCM, "unable to create IPC shm instance");
snd_pcm_direct_semaphore_up(dmix, DIRECT_IPC_SEM_CLIENT);
goto _err_nosem_free;
} else {
static inline int snd_pcm_direct_semaphore_final(snd_pcm_direct_t *dmix, int sem_num)
{
if (dmix->locked[sem_num] != 1) {
- SNDMSG("invalid semaphore count to finalize %d: %d", sem_num, dmix->locked[sem_num]);
+ snd_check(PCM, "invalid semaphore count to finalize %d: %d", sem_num, dmix->locked[sem_num]);
return -EBUSY;
}
return snd_pcm_direct_semaphore_up(dmix, sem_num);
assert(pcmp);
if (stream != SND_PCM_STREAM_PLAYBACK) {
- SNDERR("The dmix plugin supports only playback stream");
+ snd_error(PCM, "The dmix plugin supports only playback stream");
return -EINVAL;
}
ret = snd_pcm_open_slave(&spcm, root, sconf, stream,
mode | SND_PCM_NONBLOCK, NULL);
if (ret < 0) {
- SNDERR("unable to open slave");
+ snd_error(PCM, "unable to open slave");
goto _err;
}
if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) {
- SNDERR("dmix plugin can be only connected to hw plugin");
+ snd_error(PCM, "dmix plugin can be only connected to hw plugin");
ret = -EINVAL;
goto _err;
}
ret = snd_pcm_direct_initialize_slave(dmix, spcm, params);
if (ret < 0) {
- SNDERR("unable to initialize slave");
+ snd_error(PCM, "unable to initialize slave");
goto _err;
}
ret = snd_pcm_direct_server_create(dmix);
if (ret < 0) {
- SNDERR("unable to create server");
+ snd_error(PCM, "unable to create server");
goto _err;
}
}
snd_pcm_direct_semaphore_up(dmix, DIRECT_IPC_SEM_CLIENT);
ret = snd_pcm_direct_client_connect(dmix);
if (ret < 0) {
- SNDERR("unable to connect client");
+ snd_error(PCM, "unable to connect client");
goto _err_nosem;
}
first_instance = 1;
goto retry;
}
- SNDERR("unable to open slave");
+ snd_error(PCM, "unable to open slave");
goto _err;
}
if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) {
- SNDERR("dmix plugin can be only connected to hw plugin");
+ snd_error(PCM, "dmix plugin can be only connected to hw plugin");
ret = -EINVAL;
goto _err;
}
ret = snd_pcm_direct_initialize_secondary_slave(dmix, spcm, params);
if (ret < 0) {
- SNDERR("unable to initialize slave");
+ snd_error(PCM, "unable to initialize slave");
goto _err;
}
}
ret = shm_sum_create_or_connect(dmix);
if (ret < 0) {
- SNDERR("unable to initialize sum ring buffer");
+ snd_error(PCM, "unable to initialize sum ring buffer");
goto _err;
}
ret = snd_pcm_direct_initialize_poll_fd(dmix);
if (ret < 0) {
- SNDERR("unable to initialize poll_fd");
+ snd_error(PCM, "unable to initialize poll_fd");
goto _err;
}
params.format = SND_PCM_FORMAT_UNKNOWN;
else if (!(dmix_supported_format & (1ULL << params.format))) {
/* sorry, limited features */
- SNDERR("Unsupported format");
+ snd_error(PCM, "Unsupported format");
snd_config_delete(sconf);
return -EINVAL;
}
assert(pcmp);
if (stream != SND_PCM_STREAM_PLAYBACK) {
- SNDERR("The dshare plugin supports only playback stream");
+ snd_error(PCM, "The dshare plugin supports only playback stream");
return -EINVAL;
}
ret = snd_pcm_open_slave(&spcm, root, sconf, stream,
mode | SND_PCM_NONBLOCK, NULL);
if (ret < 0) {
- SNDERR("unable to open slave");
+ snd_error(PCM, "unable to open slave");
goto _err;
}
if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) {
- SNDERR("dshare plugin can be only connected to hw plugin");
+ snd_error(PCM, "dshare plugin can be only connected to hw plugin");
goto _err;
}
ret = snd_pcm_direct_initialize_slave(dshare, spcm, params);
if (ret < 0) {
- SNDERR("unable to initialize slave");
+ snd_error(PCM, "unable to initialize slave");
goto _err;
}
if (dshare->shmptr->use_server) {
ret = snd_pcm_direct_server_create(dshare);
if (ret < 0) {
- SNDERR("unable to create server");
+ snd_error(PCM, "unable to create server");
goto _err;
}
}
snd_pcm_direct_semaphore_up(dshare, DIRECT_IPC_SEM_CLIENT);
ret = snd_pcm_direct_client_connect(dshare);
if (ret < 0) {
- SNDERR("unable to connect client");
+ snd_error(PCM, "unable to connect client");
goto _err_nosem;
}
first_instance = 1;
goto retry;
}
- SNDERR("unable to open slave");
+ snd_error(PCM, "unable to open slave");
goto _err;
}
if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) {
- SNDERR("dshare plugin can be only connected to hw plugin");
+ snd_error(PCM, "dshare plugin can be only connected to hw plugin");
ret = -EINVAL;
goto _err;
}
ret = snd_pcm_direct_initialize_secondary_slave(dshare, spcm, params);
if (ret < 0) {
- SNDERR("unable to initialize slave");
+ snd_error(PCM, "unable to initialize slave");
goto _err;
}
}
dshare->u.dshare.chn_mask |= (1ULL << dchn);
}
if (dshare->shmptr->u.dshare.chn_mask & dshare->u.dshare.chn_mask) {
- SNDERR("destination channel specified in bindings is already used");
+ snd_error(PCM, "destination channel specified in bindings is already used");
dshare->u.dshare.chn_mask = 0;
ret = -EINVAL;
goto _err;
ret = snd_pcm_direct_initialize_poll_fd(dshare);
if (ret < 0) {
- SNDERR("unable to initialize poll_fd");
+ snd_error(PCM, "unable to initialize poll_fd");
goto _err;
}
assert(pcmp);
if (stream != SND_PCM_STREAM_CAPTURE) {
- SNDERR("The dsnoop plugin supports only capture stream");
+ snd_error(PCM, "The dsnoop plugin supports only capture stream");
return -EINVAL;
}
ret = snd_pcm_open_slave(&spcm, root, sconf, stream,
mode | SND_PCM_NONBLOCK, NULL);
if (ret < 0) {
- SNDERR("unable to open slave");
+ snd_error(PCM, "unable to open slave");
goto _err;
}
if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) {
- SNDERR("dsnoop plugin can be only connected to hw plugin");
+ snd_error(PCM, "dsnoop plugin can be only connected to hw plugin");
goto _err;
}
ret = snd_pcm_direct_initialize_slave(dsnoop, spcm, params);
if (ret < 0) {
- SNDERR("unable to initialize slave");
+ snd_error(PCM, "unable to initialize slave");
goto _err;
}
if (dsnoop->shmptr->use_server) {
ret = snd_pcm_direct_server_create(dsnoop);
if (ret < 0) {
- SNDERR("unable to create server");
+ snd_error(PCM, "unable to create server");
goto _err;
}
}
snd_pcm_direct_semaphore_up(dsnoop, DIRECT_IPC_SEM_CLIENT);
ret = snd_pcm_direct_client_connect(dsnoop);
if (ret < 0) {
- SNDERR("unable to connect client");
+ snd_error(PCM, "unable to connect client");
goto _err_nosem;
}
first_instance = 1;
goto retry;
}
- SNDERR("unable to open slave");
+ snd_error(PCM, "unable to open slave");
goto _err;
}
if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) {
- SNDERR("dsnoop plugin can be only connected to hw plugin");
+ snd_error(PCM, "dsnoop plugin can be only connected to hw plugin");
ret = -EINVAL;
goto _err;
}
ret = snd_pcm_direct_initialize_secondary_slave(dsnoop, spcm, params);
if (ret < 0) {
- SNDERR("unable to initialize slave");
+ snd_error(PCM, "unable to initialize slave");
goto _err;
}
}
ret = snd_pcm_direct_initialize_poll_fd(dsnoop);
if (ret < 0) {
- SNDERR("unable to initialize poll_fd");
+ snd_error(PCM, "unable to initialize poll_fd");
goto _err;
}
slave = n;
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!slave) {
- SNDERR("slave is not defined");
+ snd_error(PCM, "slave is not defined");
return -EINVAL;
}
err = snd_pcm_slave_conf(root, slave, &sconf, 0);
....
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (! slave) {
- SNDERR("No slave defined for myplug");
+ snd_error(PCM, "No slave defined for myplug");
return -EINVAL;
}
/* We support 1.0.0 to current */
if (extplug->version < 0x010000 ||
extplug->version > SND_PCM_EXTPLUG_VERSION) {
- SNDERR("extplug: Plugin version mismatch: 0x%x",
- extplug->version);
+ snd_error(PCM, "extplug: Plugin version mismatch: 0x%x",
+ extplug->version);
+
return -ENXIO;
}
{
extplug_priv_t *ext = extplug->pcm->private_data;
if (type < 0 || type >= SND_PCM_EXTPLUG_HW_PARAMS) {
- SNDERR("EXTPLUG: invalid parameter type %d", type);
+ snd_error(PCM, "EXTPLUG: invalid parameter type %d", type);
return -EINVAL;
}
return snd_ext_parm_set_list(&ext->sparams[type], num_list, list);
{
extplug_priv_t *ext = extplug->pcm->private_data;
if (type < 0 || type >= SND_PCM_EXTPLUG_HW_PARAMS) {
- SNDERR("EXTPLUG: invalid parameter type %d", type);
+ snd_error(PCM, "EXTPLUG: invalid parameter type %d", type);
return -EINVAL;
}
if (is_mask_type(type)) {
- SNDERR("EXTPLUG: invalid parameter type %d", type);
+ snd_error(PCM, "EXTPLUG: invalid parameter type %d", type);
return -EINVAL;
}
return snd_ext_parm_set_minmax(&ext->sparams[type], min, max);
{
extplug_priv_t *ext = extplug->pcm->private_data;
if (type < 0 || type >= SND_PCM_EXTPLUG_HW_PARAMS) {
- SNDERR("EXTPLUG: invalid parameter type %d", type);
+ snd_error(PCM, "EXTPLUG: invalid parameter type %d", type);
return -EINVAL;
}
return snd_ext_parm_set_list(&ext->params[type], num_list, list);
{
extplug_priv_t *ext = extplug->pcm->private_data;
if (type < 0 || type >= SND_PCM_EXTPLUG_HW_PARAMS) {
- SNDERR("EXTPLUG: invalid parameter type %d", type);
+ snd_error(PCM, "EXTPLUG: invalid parameter type %d", type);
return -EINVAL;
}
if (is_mask_type(type)) {
- SNDERR("EXTPLUG: invalid parameter type %d", type);
+ snd_error(PCM, "EXTPLUG: invalid parameter type %d", type);
return -EINVAL;
}
return snd_ext_parm_set_minmax(&ext->params[type], min, max);
extplug_priv_t *ext = extplug->pcm->private_data;
if (type < 0 || type >= SND_PCM_EXTPLUG_HW_PARAMS) {
- SNDERR("EXTPLUG: invalid parameter type %d", type);
+ snd_error(PCM, "EXTPLUG: invalid parameter type %d", type);
return -EINVAL;
}
ext->params[type].keep_link = keep_link ? 1 : 0;
/* clearing */
pipe = popen(file->final_fname + 1, "w");
if (!pipe) {
- SYSERR("running %s for writing failed",
- file->final_fname);
+ snd_errornum(PCM, "running %s for writing failed",
+ file->final_fname);
+
return -errno;
}
fd = fileno(pipe);
}
}
if (fd < 0) {
- SYSERR("open %s for writing failed",
- file->final_fname);
+ snd_errornum(PCM, "open %s for writing failed",
+ file->final_fname);
+
free(tmpfname);
return -errno;
}
return -ENOMEM;
if (file->rbuf_size < frames) {
- SYSERR("requested more frames than pcm buffer");
+ snd_errornum(PCM, "requested more frames than pcm buffer");
return -ENOMEM;
}
return bytes;
bytes = read(file->ifd, file->rbuf, bytes);
if (bytes < 0) {
- SYSERR("read from file failed, error: %d", bytes);
+ snd_errornum(PCM, "read from file failed, error: %d", bytes);
return bytes;
}
* be used to signal XRUN on playback device
*/
if (res < 0)
- SYSERR("%s write header failed, file data may be corrupt", file->fname);
+ snd_errornum(PCM, "%s write header failed, file data may be corrupt", file->fname);
else
- SNDERR("%s write header incomplete, file data may be corrupt", file->fname);
+ snd_error(PCM, "%s write header incomplete, file data may be corrupt", file->fname);
memset(&file->wav_header, 0, sizeof(struct wav_fmt));
if (err < 0) {
file->wbuf_used_bytes = 0;
file->file_ptr_bytes = 0;
- SYSERR("%s write failed, file data may be corrupt", file->fname);
+ snd_errornum(PCM, "%s write failed, file data may be corrupt", file->fname);
return err;
}
bytes -= err;
if (file->fd < 0) {
err = snd_pcm_file_open_output_file(file);
if (err < 0) {
- SYSERR("failed opening output file %s", file->fname);
+ snd_errornum(PCM, "failed opening output file %s", file->fname);
return err;
}
}
else if (!strcmp(fmt, "wav"))
format = SND_PCM_FILE_FORMAT_WAV;
else {
- SNDERR("file format %s is unknown", fmt);
+ snd_error(PCM, "file format %s is unknown", fmt);
return -EINVAL;
}
file = calloc(1, sizeof(snd_pcm_file_t));
if (ifname && (stream == SND_PCM_STREAM_CAPTURE)) {
ifd = open(ifname, O_RDONLY); /* TODO: mind blocking mode */
if (ifd < 0) {
- SYSERR("open %s for reading failed", ifname);
+ snd_errornum(PCM, "open %s for reading failed", ifname);
free(file->fname);
free(file);
return -errno;
if (strcmp(id, "format") == 0) {
err = snd_config_get_string(n, &format);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
continue;
if (err < 0) {
err = snd_config_get_integer(n, &fd);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
}
if (err < 0) {
err = snd_config_get_integer(n, &ifd);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
}
if (strcmp(id, "perm") == 0) {
err = snd_config_get_integer(n, &perm);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
return err;
}
if ((perm & ~0777) != 0) {
- SNDERR("The field perm must be a valid file permission");
+ snd_error(PCM, "The field perm must be a valid file permission");
return -EINVAL;
}
continue;
trunc = err;
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!format) {
if (snd_config_search(root, "defaults.pcm.file_format", &n) >= 0) {
err = snd_config_get_string(n, &format);
if (err < 0) {
- SNDERR("Invalid file format");
+ snd_error(PCM, "Invalid file format");
return -EINVAL;
}
}
}
if (!slave) {
- SNDERR("slave is not defined");
+ snd_error(PCM, "slave is not defined");
return -EINVAL;
}
err = snd_pcm_slave_conf(root, slave, &sconf, 0);
return err;
if ((!fname || strlen(fname) == 0) && fd < 0) {
snd_config_delete(sconf);
- SNDERR("file is not defined");
+ snd_error(PCM, "file is not defined");
return -EINVAL;
}
err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);
void *h = NULL;
if (snd_config_get_type(conf) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("Invalid hook definition");
+ snd_error(PCM, "Invalid hook definition");
return -EINVAL;
}
snd_config_for_each(i, next, conf) {
args = n;
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!type) {
- SNDERR("type is not defined");
+ snd_error(PCM, "type is not defined");
return -EINVAL;
}
err = snd_config_get_id(type, &id);
if (err < 0) {
- SNDERR("unable to get id");
+ snd_error(PCM, "unable to get id");
return err;
}
err = snd_config_get_string(type, &str);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
return err;
}
err = snd_config_search_definition(root, "pcm_hook_type", str, &type);
if (err >= 0) {
if (snd_config_get_type(type) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("Invalid type for PCM type %s definition", str);
+ snd_error(PCM, "Invalid type for PCM type %s definition", str);
err = -EINVAL;
goto _err;
}
if (strcmp(id, "lib") == 0) {
err = snd_config_get_string(n, &lib);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
goto _err;
}
continue;
if (strcmp(id, "install") == 0) {
err = snd_config_get_string(n, &install);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
goto _err;
}
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(PCM, "Unknown field %s", id);
err = -EINVAL;
goto _err;
}
install_func = h ? snd_dlsym(h, install, SND_DLSYM_VERSION(SND_PCM_DLSYM_VERSION)) : NULL;
err = 0;
if (!h) {
- SNDERR("Cannot open shared library %s (%s)",
- lib ? lib : "[builtin]", errbuf);
+ snd_error(PCM, "Cannot open shared library %s (%s)",
+ lib ? lib : "[builtin]", errbuf);
+
err = -ENOENT;
} else if (!install_func) {
- SNDERR("symbol %s is not defined inside %s", install,
- lib ? lib : "[builtin]");
+ snd_error(PCM, "symbol %s is not defined inside %s", install,
+ lib ? lib : "[builtin]");
+
snd_dlclose(h);
err = -ENXIO;
}
if (args && snd_config_get_string(args, &str) >= 0) {
err = snd_config_search_definition(root, "hook_args", str, &args);
if (err < 0)
- SNDERR("unknown hook_args %s", str);
+ snd_error(PCM, "unknown hook_args %s", str);
else
err = install_func(pcm, args);
snd_config_delete(args);
}
if (strcmp(id, "hooks") == 0) {
if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
hooks = n;
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!slave) {
- SNDERR("slave is not defined");
+ snd_error(PCM, "slave is not defined");
return -EINVAL;
}
err = snd_pcm_slave_conf(root, slave, &sconf, 0);
if (snd_config_get_string(n, &str) >= 0) {
err = snd_config_search_definition(root, "pcm_hook", str, &n);
if (err < 0) {
- SNDERR("unknown pcm_hook %s", str);
+ snd_error(PCM, "unknown pcm_hook %s", str);
} else {
err = snd_pcm_hook_add_conf(rpcm, root, n);
snd_config_delete(n);
return err;
card = snd_pcm_info_get_card(&info);
if (card < 0) {
- SNDERR("No card for this PCM");
+ snd_error(PCM, "No card for this PCM");
return -EINVAL;
}
sprintf(ctl_name, "hw:%d", card);
err = snd_ctl_open(&ctl, ctl_name, 0);
if (err < 0) {
- SNDERR("Cannot open CTL %s", ctl_name);
+ snd_error(PCM, "Cannot open CTL %s", ctl_name);
return err;
}
err = snd_config_imake_pointer(&pcm_conf, "pcm_handle", pcm);
hw->sync_ptr->flags = flags;
if (ioctl(hw->fd, SNDRV_PCM_IOCTL_SYNC_PTR, hw->sync_ptr) < 0) {
err = -errno;
- SYSMSG("SNDRV_PCM_IOCTL_SYNC_PTR failed (%i)", err);
+ snd_checknum(PCM, "SNDRV_PCM_IOCTL_SYNC_PTR failed (%i)", err);
return err;
}
return 0;
if ((flags = fcntl(fd, F_GETFL)) < 0) {
err = -errno;
- SYSMSG("F_GETFL failed (%i)", err);
+ snd_checknum(PCM, "F_GETFL failed (%i)", err);
return err;
}
if (nonblock)
flags &= ~O_NONBLOCK;
if (fcntl(fd, F_SETFL, flags) < 0) {
err = -errno;
- SYSMSG("F_SETFL for O_NONBLOCK failed (%i)", err);
+ snd_checknum(PCM, "F_SETFL for O_NONBLOCK failed (%i)", err);
return err;
}
return 0;
if ((flags = fcntl(fd, F_GETFL)) < 0) {
err = -errno;
- SYSMSG("F_GETFL failed (%i)", err);
+ snd_checknum(PCM, "F_GETFL failed (%i)", err);
return err;
}
if (sig >= 0)
flags &= ~O_ASYNC;
if (fcntl(fd, F_SETFL, flags) < 0) {
err = -errno;
- SYSMSG("F_SETFL for O_ASYNC failed (%i)", err);
+ snd_checknum(PCM, "F_SETFL for O_ASYNC failed (%i)", err);
return err;
}
if (sig < 0)
return 0;
if (fcntl(fd, F_SETSIG, (long)sig) < 0) {
err = -errno;
- SYSMSG("F_SETSIG failed (%i)", err);
+ snd_checknum(PCM, "F_SETSIG failed (%i)", err);
return err;
}
if (fcntl(fd, F_SETOWN, (long)pid) < 0) {
err = -errno;
- SYSMSG("F_SETOWN failed (%i)", err);
+ snd_checknum(PCM, "F_SETOWN failed (%i)", err);
return err;
}
return 0;
int fd = hw->fd, err;
if (ioctl(fd, SNDRV_PCM_IOCTL_INFO, info) < 0) {
err = -errno;
- SYSMSG("SNDRV_PCM_IOCTL_INFO failed (%i)", err);
+ snd_checknum(PCM, "SNDRV_PCM_IOCTL_INFO failed (%i)", err);
return err;
}
/* may be configurable (optional) */
int err;
if (hw_params_call(hw, params) < 0) {
err = -errno;
- SYSMSG("SNDRV_PCM_IOCTL_HW_PARAMS failed (%i)", err);
+ snd_checknum(PCM, "SNDRV_PCM_IOCTL_HW_PARAMS failed (%i)", err);
return err;
}
params->info &= ~0xf0000000;
snd_pcm_hw_change_timer(pcm, 0);
if (ioctl(fd, SNDRV_PCM_IOCTL_HW_FREE) < 0) {
err = -errno;
- SYSMSG("SNDRV_PCM_IOCTL_HW_FREE failed (%i)", err);
+ snd_checknum(PCM, "SNDRV_PCM_IOCTL_HW_FREE failed (%i)", err);
return err;
}
return 0;
}
if (params->tstamp_type == SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW &&
hw->version < SNDRV_PROTOCOL_VERSION(2, 0, 12)) {
- SYSMSG("Kernel doesn't support SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW");
+ snd_checknum(PCM, "Kernel doesn't support SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW");
err = -EINVAL;
goto out;
}
if (params->tstamp_type == SND_PCM_TSTAMP_TYPE_MONOTONIC &&
hw->version < SNDRV_PROTOCOL_VERSION(2, 0, 5)) {
- SYSMSG("Kernel doesn't support SND_PCM_TSTAMP_TYPE_MONOTONIC");
+ snd_checknum(PCM, "Kernel doesn't support SND_PCM_TSTAMP_TYPE_MONOTONIC");
err = -EINVAL;
goto out;
}
if (ioctl(fd, SNDRV_PCM_IOCTL_SW_PARAMS, params) < 0) {
err = -errno;
- SYSMSG("SNDRV_PCM_IOCTL_SW_PARAMS failed (%i)", err);
+ snd_checknum(PCM, "SNDRV_PCM_IOCTL_SW_PARAMS failed (%i)", err);
goto out;
}
hw->prepare_reset_sw_params = false;
SND_PCM_TSTAMP_TYPE_MONOTONIC;
if (ioctl(fd, SNDRV_PCM_IOCTL_TSTAMP, &on) < 0) {
err = -errno;
- SNDMSG("TSTAMP failed");
+ snd_check(PCM, "TSTAMP failed");
goto out;
}
}
i.channel = info->channel;
if (ioctl(fd, SNDRV_PCM_IOCTL_CHANNEL_INFO, &i) < 0) {
err = -errno;
- SYSMSG("SNDRV_PCM_IOCTL_CHANNEL_INFO failed (%i)", err);
+ snd_checknum(PCM, "SNDRV_PCM_IOCTL_CHANNEL_INFO failed (%i)", err);
return err;
}
info->channel = i.channel;
if (SNDRV_PROTOCOL_VERSION(2, 0, 13) > hw->version) {
if (ioctl(fd, SNDRV_PCM_IOCTL_STATUS, status) < 0) {
err = -errno;
- SYSMSG("SNDRV_PCM_IOCTL_STATUS failed (%i)", err);
+ snd_checknum(PCM, "SNDRV_PCM_IOCTL_STATUS failed (%i)", err);
return err;
}
} else {
if (ioctl(fd, SNDRV_PCM_IOCTL_STATUS_EXT, status) < 0) {
err = -errno;
- SYSMSG("SNDRV_PCM_IOCTL_STATUS_EXT failed (%i)", err);
+ snd_checknum(PCM, "SNDRV_PCM_IOCTL_STATUS_EXT failed (%i)", err);
return err;
}
}
int fd = hw->fd, err;
if (ioctl(fd, SNDRV_PCM_IOCTL_DELAY, delayp) < 0) {
err = -errno;
- SYSMSG("SNDRV_PCM_IOCTL_DELAY failed (%i)", err);
+ snd_checknum(PCM, "SNDRV_PCM_IOCTL_DELAY failed (%i)", err);
return err;
}
return 0;
} else {
if (ioctl(fd, SNDRV_PCM_IOCTL_HWSYNC) < 0) {
err = -errno;
- SYSMSG("SNDRV_PCM_IOCTL_HWSYNC failed (%i)", err);
+ snd_checknum(PCM, "SNDRV_PCM_IOCTL_HWSYNC failed (%i)", err);
return err;
}
}
snd_pcm_sw_params_current_no_lock(pcm, &sw_params);
if (ioctl(hw->fd, SNDRV_PCM_IOCTL_SW_PARAMS, &sw_params) < 0) {
err = -errno;
- SYSMSG("SNDRV_PCM_IOCTL_SW_PARAMS failed (%i)", err);
+ snd_checknum(PCM, "SNDRV_PCM_IOCTL_SW_PARAMS failed (%i)", err);
return err;
}
hw->prepare_reset_sw_params = false;
}
if (ioctl(fd, SNDRV_PCM_IOCTL_PREPARE) < 0) {
err = -errno;
- SYSMSG("SNDRV_PCM_IOCTL_PREPARE failed (%i)", err);
+ snd_checknum(PCM, "SNDRV_PCM_IOCTL_PREPARE failed (%i)", err);
return err;
}
return query_status_and_control_data(hw);
int fd = hw->fd, err;
if (ioctl(fd, SNDRV_PCM_IOCTL_RESET) < 0) {
err = -errno;
- SYSMSG("SNDRV_PCM_IOCTL_RESET failed (%i)", err);
+ snd_checknum(PCM, "SNDRV_PCM_IOCTL_RESET failed (%i)", err);
return err;
}
return query_status_and_control_data(hw);
issue_applptr(hw);
if (ioctl(hw->fd, SNDRV_PCM_IOCTL_START) < 0) {
err = -errno;
- SYSMSG("SNDRV_PCM_IOCTL_START failed (%i)", err);
+ snd_checknum(PCM, "SNDRV_PCM_IOCTL_START failed (%i)", err);
#if 0
if (err == -EBADFD)
- SNDERR("PCM state = %s", snd_pcm_state_name(snd_pcm_hw_state(pcm)));
+ snd_error(PCM, "PCM state = %s", snd_pcm_state_name(snd_pcm_hw_state(pcm)));
#endif
return err;
}
int err;
if (ioctl(hw->fd, SNDRV_PCM_IOCTL_DROP) < 0) {
err = -errno;
- SYSMSG("SNDRV_PCM_IOCTL_DROP failed (%i)", err);
+ snd_checknum(PCM, "SNDRV_PCM_IOCTL_DROP failed (%i)", err);
return err;
} else {
}
sw_params.silence_size = silence_size;
if (ioctl(hw->fd, SNDRV_PCM_IOCTL_SW_PARAMS, &sw_params) < 0) {
err = -errno;
- SYSMSG("SNDRV_PCM_IOCTL_SW_PARAMS failed (%i)", err);
+ snd_checknum(PCM, "SNDRV_PCM_IOCTL_SW_PARAMS failed (%i)", err);
return err;
}
hw->prepare_reset_sw_params = true;
__skip_silence:
if (ioctl(hw->fd, SNDRV_PCM_IOCTL_DRAIN) < 0) {
err = -errno;
- SYSMSG("SNDRV_PCM_IOCTL_DRAIN failed (%i)", err);
+ snd_checknum(PCM, "SNDRV_PCM_IOCTL_DRAIN failed (%i)", err);
return err;
}
return 0;
int err;
if (ioctl(hw->fd, SNDRV_PCM_IOCTL_PAUSE, enable) < 0) {
err = -errno;
- SYSMSG("SNDRV_PCM_IOCTL_PAUSE failed (%i)", err);
+ snd_checknum(PCM, "SNDRV_PCM_IOCTL_PAUSE failed (%i)", err);
return err;
}
return 0;
int err;
if (ioctl(hw->fd, SNDRV_PCM_IOCTL_REWIND, &frames) < 0) {
err = -errno;
- SYSMSG("SNDRV_PCM_IOCTL_REWIND failed (%i)", err);
+ snd_checknum(PCM, "SNDRV_PCM_IOCTL_REWIND failed (%i)", err);
return err;
}
err = query_status_and_control_data(hw);
if (SNDRV_PROTOCOL_VERSION(2, 0, 4) <= hw->version) {
if (ioctl(hw->fd, SNDRV_PCM_IOCTL_FORWARD, &frames) < 0) {
err = -errno;
- SYSMSG("SNDRV_PCM_IOCTL_FORWARD failed (%i)", err);
+ snd_checknum(PCM, "SNDRV_PCM_IOCTL_FORWARD failed (%i)", err);
return err;
}
err = query_status_and_control_data(hw);
int fd = hw->fd, err;
if (ioctl(fd, SNDRV_PCM_IOCTL_RESUME) < 0) {
err = -errno;
- SYSMSG("SNDRV_PCM_IOCTL_RESUME failed (%i)", err);
+ snd_checknum(PCM, "SNDRV_PCM_IOCTL_RESUME failed (%i)", err);
return err;
}
return 0;
snd_pcm_hw_t *hw1 = pcm1->private_data;
snd_pcm_hw_t *hw2 = pcm2->private_data;
if (ioctl(hw1->fd, SNDRV_PCM_IOCTL_LINK, hw2->fd) < 0) {
- SYSMSG("SNDRV_PCM_IOCTL_LINK failed (%i)", -errno);
+ snd_checknum(PCM, "SNDRV_PCM_IOCTL_LINK failed (%i)", -errno);
return -errno;
}
return 0;
static int snd_pcm_hw_link_slaves(snd_pcm_t *pcm, snd_pcm_t *master)
{
if (master->type != SND_PCM_TYPE_HW) {
- SYSMSG("Invalid type for SNDRV_PCM_IOCTL_LINK (%i)", master->type);
+ snd_checknum(PCM, "Invalid type for SNDRV_PCM_IOCTL_LINK (%i)", master->type);
return -EINVAL;
}
return hw_link(master, pcm);
snd_pcm_hw_t *hw = pcm->private_data;
if (ioctl(hw->fd, SNDRV_PCM_IOCTL_UNLINK) < 0) {
- SYSMSG("SNDRV_PCM_IOCTL_UNLINK failed (%i)", -errno);
+ snd_checknum(PCM, "SNDRV_PCM_IOCTL_UNLINK failed (%i)", -errno);
return -errno;
}
return 0;
if (!hw->mmap_status_fallbacked) {
if (munmap((void *)hw->mmap_status,
page_align(sizeof(*hw->mmap_status))) < 0)
- SYSMSG("status munmap failed (%u)", errno);
+ snd_checknum(PCM, "status munmap failed (%u)", errno);
}
}
if (!hw->mmap_control_fallbacked) {
if (munmap((void *)hw->mmap_control,
page_align(sizeof(*hw->mmap_control))) < 0)
- SYSMSG("control munmap failed (%u)", errno);
+ snd_checknum(PCM, "control munmap failed (%u)", errno);
}
}
int err = 0;
if (close(hw->fd)) {
err = -errno;
- SYSMSG("close failed (%i)", err);
+ snd_checknum(PCM, "close failed (%i)", err);
}
unmap_status_and_control_data(hw);
ret = snd_ctl_hw_open(&ctl, NULL, card, 0);
if (ret < 0) {
- SYSMSG("Cannot open the associated CTL");
+ snd_checknum(PCM, "Cannot open the associated CTL");
return NULL;
}
ret = snd_ctl_elem_tlv_read(ctl, &id, tlv, sizeof(tlv));
snd_ctl_close(ctl);
if (ret < 0) {
- SYSMSG("Cannot read Channel Map TLV");
+ snd_checknum(PCM, "Cannot read Channel Map TLV");
return NULL;
}
type = tlv[SNDRV_CTL_TLVO_TYPE];
if (type != SND_CTL_TLVT_CONTAINER) {
if (!is_chmap_type(type)) {
- SYSMSG("Invalid TLV type %d", type);
+ snd_checknum(PCM, "Invalid TLV type %d", type);
return NULL;
}
start = tlv;
nums = 0;
for (p = start; size > 0; ) {
if (!is_chmap_type(p[0])) {
- SYSMSG("Invalid TLV type %d", p[0]);
+ snd_checknum(PCM, "Invalid TLV type %d", p[0]);
return NULL;
}
nums++;
case SNDRV_PCM_STATE_SUSPENDED:
break;
default:
- SYSMSG("Invalid PCM state for chmap_get: %s",
- snd_pcm_state_name(FAST_PCM_STATE(hw)));
+ snd_checknum(PCM, "Invalid PCM state for chmap_get: %s",
+ snd_pcm_state_name(FAST_PCM_STATE(hw)));
+
return NULL;
}
map = malloc(pcm->channels * sizeof(map->pos[0]) + sizeof(*map));
ret = snd_ctl_hw_open(&ctl, NULL, hw->card, 0);
if (ret < 0) {
free(map);
- SYSMSG("Cannot open the associated CTL");
+ snd_checknum(PCM, "Cannot open the associated CTL");
chmap_caps_set_error(hw, CHMAP_CTL_GET);
return NULL;
}
snd_ctl_close(ctl);
if (ret < 0) {
free(map);
- SYSMSG("Cannot read Channel Map ctl");
+ snd_checknum(PCM, "Cannot read Channel Map ctl");
chmap_caps_set_error(hw, CHMAP_CTL_GET);
return NULL;
}
return -ENXIO;
if (map->channels > 128) {
- SYSMSG("Invalid number of channels %d", map->channels);
+ snd_checknum(PCM, "Invalid number of channels %d", map->channels);
return -EINVAL;
}
if (FAST_PCM_STATE(hw) != SNDRV_PCM_STATE_PREPARED) {
- SYSMSG("Invalid PCM state for chmap_set: %s",
- snd_pcm_state_name(FAST_PCM_STATE(hw)));
+ snd_checknum(PCM, "Invalid PCM state for chmap_set: %s",
+ snd_pcm_state_name(FAST_PCM_STATE(hw)));
+
return -EBADFD;
}
ret = snd_ctl_hw_open(&ctl, NULL, hw->card, 0);
if (ret < 0) {
- SYSMSG("Cannot open the associated CTL");
+ snd_checknum(PCM, "Cannot open the associated CTL");
chmap_caps_set_error(hw, CHMAP_CTL_SET);
return ret;
}
ret = -ENXIO;
}
if (ret < 0)
- SYSMSG("Cannot write Channel Map ctl");
+ snd_checknum(PCM, "Cannot write Channel Map ctl");
return ret;
}
char *name;
int err = snd_card_get_name(hw->card, &name);
if (err < 0) {
- SNDERR("cannot get card name");
+ snd_error(PCM, "cannot get card name");
return;
}
snd_output_printf(out, "Hardware PCM card %d '%s' device %d subdevice %d\n",
memset(&info, 0, sizeof(info));
if (ioctl(fd, SNDRV_PCM_IOCTL_INFO, &info) < 0) {
ret = -errno;
- SYSMSG("SNDRV_PCM_IOCTL_INFO failed (%i)", ret);
+ snd_checknum(PCM, "SNDRV_PCM_IOCTL_INFO failed (%i)", ret);
close(fd);
return ret;
if (ioctl(fd, SNDRV_PCM_IOCTL_PVERSION, &ver) < 0) {
ret = -errno;
- SYSMSG("SNDRV_PCM_IOCTL_PVERSION failed (%i)", ret);
+ snd_checknum(PCM, "SNDRV_PCM_IOCTL_PVERSION failed (%i)", ret);
close(fd);
return ret;
}
unsigned int user_ver = SNDRV_PCM_VERSION;
if (ioctl(fd, SNDRV_PCM_IOCTL_USER_PVERSION, &user_ver) < 0) {
ret = -errno;
- SNDMSG("USER_PVERSION failed");
+ snd_check(PCM, "USER_PVERSION failed");
return ret;
}
}
int on = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC;
if (ioctl(fd, SNDRV_PCM_IOCTL_TTSTAMP, &on) < 0) {
ret = -errno;
- SNDMSG("TTSTAMP failed");
+ snd_check(PCM, "TTSTAMP failed");
return ret;
}
}
int on = 1;
if (ioctl(fd, SNDRV_PCM_IOCTL_TSTAMP, &on) < 0) {
ret = -errno;
- SNDMSG("TSTAMP failed");
+ snd_check(PCM, "TSTAMP failed");
return ret;
}
}
filefmt = SNDRV_FILE_PCM_STREAM_CAPTURE;
break;
default:
- SNDERR("invalid stream %d", stream);
+ snd_error(PCM, "invalid stream %d", stream);
return -EINVAL;
}
sprintf(filename, filefmt, card, device);
fd = snd_open_device(filename, fmode);
if (fd < 0) {
ret = -errno;
- SYSMSG("open '%s' failed (%i)", filename, ret);
+ snd_checknum(PCM, "open '%s' failed (%i)", filename, ret);
goto _err;
}
if (subdevice >= 0) {
memset(&info, 0, sizeof(info));
if (ioctl(fd, SNDRV_PCM_IOCTL_INFO, &info) < 0) {
ret = -errno;
- SYSMSG("SNDRV_PCM_IOCTL_INFO failed (%i)", ret);
+ snd_checknum(PCM, "SNDRV_PCM_IOCTL_INFO failed (%i)", ret);
goto _err;
}
if (info.subdevice != (unsigned int) subdevice) {
if (strcmp(id, "device") == 0) {
err = snd_config_get_integer(n, &device);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
goto fail;
}
continue;
if (strcmp(id, "subdevice") == 0) {
err = snd_config_get_integer(n, &subdevice);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
goto fail;
}
continue;
snd_config_t *m;
err = snd_config_search(n, "0", &m);
if (err < 0) {
- SNDERR("array expected for rate compound");
+ snd_error(PCM, "array expected for rate compound");
goto fail;
}
err = snd_config_get_integer(m, &val);
if (err < 0) {
- SNDERR("Invalid type for rate.0");
+ snd_error(PCM, "Invalid type for rate.0");
goto fail;
}
min_rate = max_rate = val;
if (err >= 0) {
err = snd_config_get_integer(m, &val);
if (err < 0) {
- SNDERR("Invalid type for rate.0");
+ snd_error(PCM, "Invalid type for rate.0");
goto fail;
}
max_rate = val;
} else {
err = snd_config_get_integer(n, &val);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
goto fail;
}
min_rate = max_rate = val;
long val;
err = snd_config_get_integer(n, &val);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
goto fail;
}
min_rate = val;
long val;
err = snd_config_get_integer(n, &val);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
goto fail;
}
max_rate = val;
if (strcmp(id, "format") == 0) {
err = snd_config_get_string(n, &str);
if (err < 0) {
- SNDERR("invalid type for %s", id);
+ snd_error(PCM, "invalid type for %s", id);
goto fail;
}
format = snd_pcm_format_value(str);
long val;
err = snd_config_get_integer(n, &val);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
goto fail;
}
channels = val;
snd_pcm_free_chmaps(chmap);
chmap = _snd_pcm_parse_config_chmaps(n);
if (!chmap) {
- SNDERR("Invalid channel map for %s", id);
+ snd_error(PCM, "Invalid channel map for %s", id);
err = -EINVAL;
goto fail;
}
long val;
err = snd_config_get_integer(n, &val);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
goto fail;
}
drain_silence = val;
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(PCM, "Unknown field %s", id);
err = -EINVAL;
goto fail;
}
if (card < 0) {
- SNDERR("card is not defined");
+ snd_error(PCM, "card is not defined");
err = -EINVAL;
goto fail;
}
if ((min_rate < 0) || (max_rate < min_rate)) {
- SNDERR("min_rate - max_rate configuration invalid");
+ snd_error(PCM, "min_rate - max_rate configuration invalid");
err = -EINVAL;
goto fail;
}
}
if (strcmp(id, "status") == 0) {
if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
status = n;
}
if (strcmp(id, "preamble") == 0) {
if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
preamble = n;
hdmi_mode = err;
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
memset(status_bits, 0, sizeof(status_bits));
long val;
snd_config_t *n = snd_config_iterator_entry(i);
if (snd_config_get_type(n) != SND_CONFIG_TYPE_INTEGER) {
- SNDERR("invalid IEC958 status bits");
+ snd_error(PCM, "invalid IEC958 status bits");
return -EINVAL;
}
err = snd_config_get_integer(n, &val);
if (err < 0) {
- SNDERR("invalid IEC958 status bits");
+ snd_error(PCM, "invalid IEC958 status bits");
return err;
}
status_bits[bytes] = val;
else if (strcmp(id, "w") == 0 || strcmp(id, "y") == 0)
idx = PREAMBLE_Y;
else {
- SNDERR("invalid IEC958 preamble type %s", id);
+ snd_error(PCM, "invalid IEC958 preamble type %s", id);
return -EINVAL;
}
err = snd_config_get_integer(n, &val);
if (err < 0) {
- SNDERR("invalid IEC958 preamble value");
+ snd_error(PCM, "invalid IEC958 preamble value");
return err;
}
preamble_vals[idx] = val;
}
}
if (!slave) {
- SNDERR("slave is not defined");
+ snd_error(PCM, "slave is not defined");
return -EINVAL;
}
err = snd_pcm_slave_conf(root, slave, &sconf, 1,
sformat != SND_PCM_FORMAT_IEC958_SUBFRAME_LE &&
sformat != SND_PCM_FORMAT_IEC958_SUBFRAME_BE) {
snd_config_delete(sconf);
- SNDERR("invalid slave format");
+ snd_error(PCM, "invalid slave format");
return -EINVAL;
}
err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);
/* We support 1.0.0 to current */
if (ioplug->version < 0x010000 ||
ioplug->version > SND_PCM_IOPLUG_VERSION) {
- SNDERR("ioplug: Plugin version mismatch: 0x%x",
- ioplug->version);
+ snd_error(PCM, "ioplug: Plugin version mismatch: 0x%x",
+ ioplug->version);
+
return -ENXIO;
}
{
ioplug_priv_t *io = ioplug->pcm->private_data;
if (type < 0 || type >= SND_PCM_IOPLUG_HW_PARAMS) {
- SNDERR("IOPLUG: invalid parameter type %d", type);
+ snd_error(PCM, "IOPLUG: invalid parameter type %d", type);
return -EINVAL;
}
if (type == SND_PCM_IOPLUG_HW_PERIODS)
{
ioplug_priv_t *io = ioplug->pcm->private_data;
if (type < 0 || type >= SND_PCM_IOPLUG_HW_PARAMS) {
- SNDERR("IOPLUG: invalid parameter type %d", type);
+ snd_error(PCM, "IOPLUG: invalid parameter type %d", type);
return -EINVAL;
}
if (type == SND_PCM_IOPLUG_HW_ACCESS || type == SND_PCM_IOPLUG_HW_FORMAT) {
- SNDERR("IOPLUG: invalid parameter type %d", type);
+ snd_error(PCM, "IOPLUG: invalid parameter type %d", type);
return -EINVAL;
}
if (type == SND_PCM_IOPLUG_HW_PERIODS)
else {
err = snd_pcm_ladspa_find_port(&port, plugin, io->pdesc | LADSPA_PORT_AUDIO, idx);
if (err < 0) {
- SNDERR("unable to find audio %s port %u plugin '%s'", io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", idx, plugin->desc->Name);
+ snd_error(PCM, "unable to find audio %s port %u plugin '%s'", io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", idx, plugin->desc->Name);
return err;
}
}
continue;
err = snd_pcm_ladspa_add_to_carray(&eps->channels, idx1, idx);
if (err < 0) {
- SNDERR("unable to add channel %u for audio %s plugin '%s'", idx, io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name);
+ snd_error(PCM, "unable to add channel %u for audio %s plugin '%s'", idx, io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name);
return err;
}
err = snd_pcm_ladspa_add_to_array(&eps->ports, idx1, port);
if (err < 0) {
- SNDERR("unable to add port %u for audio %s plugin '%s'", port, io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name);
+ snd_error(PCM, "unable to add port %u for audio %s plugin '%s'", port, io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name);
return err;
}
idx1++;
} else {
err = snd_pcm_ladspa_find_port(&port, plugin, io->pdesc | LADSPA_PORT_AUDIO, 0);
if (err < 0) {
- SNDERR("unable to find audio %s port %u plugin '%s'", io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", (unsigned int)0, plugin->desc->Name);
+ snd_error(PCM, "unable to find audio %s port %u plugin '%s'", io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", (unsigned int)0, plugin->desc->Name);
return err;
}
}
err = snd_pcm_ladspa_add_to_carray(&eps->channels, 0, idx);
if (err < 0) {
- SNDERR("unable to add channel %u for audio %s plugin '%s'", idx, io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name);
+ snd_error(PCM, "unable to add channel %u for audio %s plugin '%s'", idx, io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name);
return err;
}
err = snd_pcm_ladspa_add_to_array(&eps->ports, 0, port);
if (err < 0) {
- SNDERR("unable to add port %u for audio %s plugin '%s'", port, io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name);
+ snd_error(PCM, "unable to add port %u for audio %s plugin '%s'", port, io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name);
return err;
}
return 0;
for (idx = midx = 0; idx < plugin->desc->PortCount; idx++)
if ((plugin->desc->PortDescriptors[idx] & (io->pdesc | LADSPA_PORT_AUDIO)) == (io->pdesc | LADSPA_PORT_AUDIO)) {
if (eps->channels.array[midx] == NO_ASSIGN) {
- SNDERR("%s port for plugin %s depth %u is not connected", io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name, depth);
+ snd_error(PCM, "%s port for plugin %s depth %u is not connected", io->pdesc & LADSPA_PORT_INPUT ? "input" : "output", plugin->desc->Name, depth);
err++;
}
midx++;
}
if (err > 0) {
- SNDERR("%i connection errors total", err);
+ snd_error(PCM, "%i connection errors total", err);
return -EINVAL;
}
return 0;
instance->handle = plugin->desc->instantiate(plugin->desc, pcm->rate);
instance->depth = depth;
if (instance->handle == NULL) {
- SNDERR("Unable to create instance of LADSPA plugin '%s'", plugin->desc->Name);
+ snd_error(PCM, "Unable to create instance of LADSPA plugin '%s'", plugin->desc->Name);
free(instance);
return -EINVAL;
}
if (plugin->policy == SND_PCM_LADSPA_POLICY_DUPLICATE) {
err = snd_pcm_ladspa_connect_plugin_duplicate(plugin, &plugin->input, &plugin->output, instance, idx);
if (err < 0) {
- SNDERR("Unable to connect duplicate port of plugin '%s' channel %u depth %u", plugin->desc->Name, idx, instance->depth);
+ snd_error(PCM, "Unable to connect duplicate port of plugin '%s' channel %u depth %u", plugin->desc->Name, idx, instance->depth);
return err;
}
} else {
err = snd_pcm_ladspa_connect_plugin(plugin, instance);
if (err < 0) {
- SNDERR("Unable to connect plugin '%s' depth %u", plugin->desc->Name, depth);
+ snd_error(PCM, "Unable to connect plugin '%s' depth %u", plugin->desc->Name, depth);
return err;
}
}
int err;
if (snd_config_get_type(controls) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("controls definition must be a compound");
+ snd_error(PCM, "controls definition must be a compound");
return -EINVAL;
}
err = snd_pcm_ladspa_find_sport(&port, lplug, io->pdesc | LADSPA_PORT_CONTROL, id);
}
if (err < 0) {
- SNDERR("Unable to find an control port (%s)", id);
+ snd_error(PCM, "Unable to find an control port (%s)", id);
return err;
}
if (snd_config_get_ireal(n, &dval) < 0) {
- SNDERR("Control port %s has not an float or integer value", id);
+ snd_error(PCM, "Control port %s has not an float or integer value", id);
return err;
}
err = snd_pcm_ladspa_find_port_idx(&uval, lplug, io->pdesc | LADSPA_PORT_CONTROL, port);
if (err < 0) {
- SNDERR("internal error");
+ snd_error(PCM, "internal error");
return err;
}
io->controls_initialized[uval] = 1;
int err;
if (snd_config_get_type(bindings) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("bindings definition must be a compound");
+ snd_error(PCM, "bindings definition must be a compound");
return -EINVAL;
}
snd_config_for_each(i, next, bindings) {
continue;
err = safe_strtol(id, &channel);
if (err < 0 || channel < 0) {
- SNDERR("Invalid channel number: %s", id);
+ snd_error(PCM, "Invalid channel number: %s", id);
return -EINVAL;
}
if (lplug->policy == SND_PCM_LADSPA_POLICY_DUPLICATE && channel > 0) {
- SNDERR("Wrong channel specification for duplicate policy");
+ snd_error(PCM, "Wrong channel specification for duplicate policy");
return -EINVAL;
}
if (count < (unsigned int)(channel + 1))
if (err >= 0) {
err = snd_pcm_ladspa_find_port(&array[channel], lplug, io->pdesc | LADSPA_PORT_AUDIO, port);
if (err < 0) {
- SNDERR("Unable to find an audio port (%li) for channel %s", port, id);
+ snd_error(PCM, "Unable to find an audio port (%li) for channel %s", port, id);
return err;
}
continue;
}
err = snd_config_get_string(n, &sport);
if (err < 0) {
- SNDERR("Invalid LADSPA port field type for %s", id);
+ snd_error(PCM, "Invalid LADSPA port field type for %s", id);
return -EINVAL;
}
err = snd_pcm_ladspa_find_sport(&array[channel], lplug, io->pdesc | LADSPA_PORT_AUDIO, sport);
if (err < 0) {
- SNDERR("Unable to find an audio port (%s) for channel %s", sport, id);
+ snd_error(PCM, "Unable to find an audio port (%s) for channel %s", sport, id);
return err;
}
}
/* always add default controls for both input and output */
err = snd_pcm_ladspa_add_default_controls(lplug, io);
if (err < 0) {
- SNDERR("error adding default controls");
+ snd_error(PCM, "error adding default controls");
return err;
}
}
if (snd_config_get_type(conf) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("input or output definition must be a compound");
+ snd_error(PCM, "input or output definition must be a compound");
return -EINVAL;
}
snd_config_for_each(i, next, conf) {
const char *str;
err = snd_config_get_string(n, &str);
if (err < 0) {
- SNDERR("policy field must be a string");
+ snd_error(PCM, "policy field must be a string");
return err;
}
if (strcmp(str, "none") == 0)
else if (strcmp(str, "duplicate") == 0)
policy = SND_PCM_LADSPA_POLICY_DUPLICATE;
else {
- SNDERR("unknown policy definition");
+ snd_error(PCM, "unknown policy definition");
return -EINVAL;
}
continue;
}
}
if (label == NULL && ladspa_id <= 0) {
- SNDERR("no plugin label or id");
+ snd_error(PCM, "no plugin label or id");
return -EINVAL;
}
lplug = (snd_pcm_ladspa_plugin_t *)calloc(1, sizeof(snd_pcm_ladspa_plugin_t));
if (filename) {
err = snd_pcm_ladspa_check_file(lplug, filename, label, ladspa_id);
if (err < 0) {
- SNDERR("Unable to load plugin '%s' ID %li, filename '%s'", label, ladspa_id, filename);
+ snd_error(PCM, "Unable to load plugin '%s' ID %li, filename '%s'", label, ladspa_id, filename);
free(lplug);
return err;
}
} else {
err = snd_pcm_ladspa_look_for_plugin(lplug, path, label, ladspa_id);
if (err < 0) {
- SNDERR("Unable to find or load plugin '%s' ID %li, path '%s'", label, ladspa_id, path);
+ snd_error(PCM, "Unable to find or load plugin '%s' ID %li, path '%s'", label, ladspa_id, path);
free(lplug);
return err;
}
if (plugins == NULL) /* nothing TODO */
return 0;
if (snd_config_get_type(plugins) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("plugins must be defined inside a compound");
+ snd_error(PCM, "plugins must be defined inside a compound");
return -EINVAL;
}
do {
continue;
err = safe_strtol(id, &i);
if (err < 0) {
- SNDERR("id of field %s is not an integer", id);
+ snd_error(PCM, "id of field %s is not an integer", id);
return err;
}
if (i == idx) {
}
} while (hit);
if (list_empty(list)) {
- SNDERR("empty plugin list is not accepted");
+ snd_error(PCM, "empty plugin list is not accepted");
return -EINVAL;
}
return 0;
cplugins = n;
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!slave) {
- SNDERR("slave is not defined");
+ snd_error(PCM, "slave is not defined");
return -EINVAL;
}
if (plugins) {
if (pplugins || cplugins) {
- SNDERR("'plugins' definition cannot be combined with 'playback_plugins' or 'capture_plugins'");
+ snd_error(PCM, "'plugins' definition cannot be combined with 'playback_plugins' or 'capture_plugins'");
return -EINVAL;
}
pplugins = plugins;
slave = n;
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!slave) {
- SNDERR("slave is not defined");
+ snd_error(PCM, "slave is not defined");
return -EINVAL;
}
err = snd_pcm_slave_conf(root, slave, &sconf, 1,
if (snd_pcm_format_linear(sformat) != 1 &&
snd_pcm_format_float(sformat) != 1) {
snd_config_delete(sconf);
- SNDERR("slave format is not linear integer or linear float");
+ snd_error(PCM, "slave format is not linear integer or linear float");
return -EINVAL;
}
err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);
snd_pcm_t *slave ATTRIBUTE_UNUSED,
int close_slave ATTRIBUTE_UNUSED)
{
- SNDERR("please, upgrade your GCC to use lfloat plugin");
+ snd_error(PCM, "please, upgrade your GCC to use lfloat plugin");
return -EINVAL;
}
snd_pcm_stream_t stream ATTRIBUTE_UNUSED,
int mode ATTRIBUTE_UNUSED)
{
- SNDERR("please, upgrade your GCC to use lfloat plugin");
+ snd_error(PCM, "please, upgrade your GCC to use lfloat plugin");
return -EINVAL;
}
slave = n;
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!slave) {
- SNDERR("slave is not defined");
+ snd_error(PCM, "slave is not defined");
return -EINVAL;
}
err = snd_pcm_slave_conf(root, slave, &sconf, 1,
return err;
if (snd_pcm_format_linear(sformat) != 1) {
snd_config_delete(sconf);
- SNDERR("slave format is not linear");
+ snd_error(PCM, "slave format is not linear");
return -EINVAL;
}
err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);
int err;
if (snd_config_get_type(conf) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("Invalid type for scope %s", str);
+ snd_error(PCM, "Invalid type for scope %s", str);
err = -EINVAL;
goto _err;
}
err = snd_config_search(conf, "type", &c);
if (err < 0) {
- SNDERR("type is not defined");
+ snd_error(PCM, "type is not defined");
goto _err;
}
err = snd_config_get_id(c, &id);
if (err < 0) {
- SNDERR("unable to get id");
+ snd_error(PCM, "unable to get id");
goto _err;
}
err = snd_config_get_string(c, &str);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
goto _err;
}
err = snd_config_search_definition(root, "pcm_scope_type", str, &type_conf);
if (strcmp(id, "lib") == 0) {
err = snd_config_get_string(n, &lib);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
goto _err;
}
continue;
if (strcmp(id, "open") == 0) {
err = snd_config_get_string(n, &open_name);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
goto _err;
}
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(PCM, "Unknown field %s", id);
err = -EINVAL;
goto _err;
}
open_func = h ? dlsym(h, open_name) : NULL;
err = 0;
if (!h) {
- SNDERR("Cannot open shared library %s (%s)", lib, errbuf);
+ snd_error(PCM, "Cannot open shared library %s (%s)", lib, errbuf);
err = -ENOENT;
} else if (!open_func) {
- SNDERR("symbol %s is not defined inside %s", open_name, lib);
+ snd_error(PCM, "symbol %s is not defined inside %s", open_name, lib);
snd_dlclose(h);
err = -ENXIO;
}
if (strcmp(id, "frequency") == 0) {
err = snd_config_get_integer(n, &frequency);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
continue;
}
if (strcmp(id, "scopes") == 0) {
if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
scopes = n;
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!slave) {
- SNDERR("slave is not defined");
+ snd_error(PCM, "slave is not defined");
return -EINVAL;
}
err = snd_pcm_slave_conf(root, slave, &sconf, 0);
if (snd_config_get_string(n, &str) >= 0) {
err = snd_config_search_definition(root, "pcm_scope", str, &n);
if (err < 0) {
- SNDERR("unknown pcm_scope %s", str);
+ snd_error(PCM, "unknown pcm_scope %s", str);
} else {
err = snd_pcm_meter_add_scope_conf(*pcmp, id, root, n);
snd_config_delete(n);
if (strcmp(id, "iface") == 0 || strcmp(id, "interface") == 0) {
const char *ptr;
if ((err = snd_config_get_string(n, &ptr)) < 0) {
- SNDERR("field %s is not a string", id);
+ snd_error(PCM, "field %s is not a string", id);
goto _err;
}
if ((err = snd_config_get_ctl_iface_ascii(ptr)) < 0) {
- SNDERR("Invalid value for '%s'", id);
+ snd_error(PCM, "Invalid value for '%s'", id);
goto _err;
}
iface = err;
}
if (strcmp(id, "name") == 0) {
if ((err = snd_config_get_string(n, &name)) < 0) {
- SNDERR("field %s is not a string", id);
+ snd_error(PCM, "field %s is not a string", id);
goto _err;
}
continue;
}
if (strcmp(id, "index") == 0) {
if ((err = snd_config_get_integer(n, &index)) < 0) {
- SNDERR("field %s is not an integer", id);
+ snd_error(PCM, "field %s is not an integer", id);
goto _err;
}
continue;
}
if (strcmp(id, "device") == 0) {
if ((err = snd_config_get_integer(n, &device)) < 0) {
- SNDERR("field %s is not an integer", id);
+ snd_error(PCM, "field %s is not an integer", id);
goto _err;
}
continue;
}
if (strcmp(id, "subdevice") == 0) {
if ((err = snd_config_get_integer(n, &subdevice)) < 0) {
- SNDERR("field %s is not an integer", id);
+ snd_error(PCM, "field %s is not an integer", id);
goto _err;
}
continue;
if (cchannelsp && strcmp(id, "count") == 0) {
long v;
if ((err = snd_config_get_integer(n, &v)) < 0) {
- SNDERR("field %s is not an integer", id);
+ snd_error(PCM, "field %s is not an integer", id);
goto _err;
}
if (v < 1 || v > 2) {
- SNDERR("Invalid count %ld", v);
+ snd_error(PCM, "Invalid count %ld", v);
goto _err;
}
*cchannelsp = v;
}
if (hwctlp && strcmp(id, "hwctl") == 0) {
if ((err = snd_config_get_bool(n)) < 0) {
- SNDERR("The field %s must be a boolean type", id);
+ snd_error(PCM, "The field %s must be a boolean type", id);
return err;
}
*hwctlp = err;
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (name == NULL) {
- SNDERR("Missing control name");
+ snd_error(PCM, "Missing control name");
err = -EINVAL;
goto _err;
}
snd_pcm_uframes_t xfer = 0;
if (snd_pcm_mmap_playback_avail(pcm) < size) {
- SNDMSG("too short avail %ld to size %ld", snd_pcm_mmap_playback_avail(pcm), size);
+ snd_check(PCM, "too short avail %ld to size %ld", snd_pcm_mmap_playback_avail(pcm), size);
return -EPIPE;
}
while (size > 0) {
snd_pcm_uframes_t xfer = 0;
if (snd_pcm_mmap_capture_avail(pcm) < size) {
- SNDMSG("too short avail %ld to size %ld", snd_pcm_mmap_capture_avail(pcm), size);
+ snd_check(PCM, "too short avail %ld to size %ld", snd_pcm_mmap_capture_avail(pcm), size);
return -EPIPE;
}
while (size > 0) {
info->step = pcm->sample_bits;
break;
default:
- SNDMSG("invalid access type %d", pcm->access);
+ snd_check(PCM, "invalid access type %d", pcm->access);
return -EINVAL;
}
info->addr = 0;
unsigned int c;
assert(pcm);
if (CHECK_SANITY(! pcm->setup)) {
- SNDMSG("PCM not set up");
+ snd_check(PCM, "PCM not set up");
return -EIO;
}
if (CHECK_SANITY(pcm->mmap_channels || pcm->running_areas)) {
- SNDMSG("Already mmapped");
+ snd_check(PCM, "Already mmapped");
return -EBUSY;
}
if (pcm->ops->mmap)
case SND_PCM_AREA_MMAP:
ptr = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, i->u.mmap.fd, i->u.mmap.offset);
if (ptr == MAP_FAILED) {
- SYSERR("mmap failed");
+ snd_errornum(PCM, "mmap failed");
return -errno;
}
i->addr = ptr;
/* FIXME: safer permission? */
id = shmget(IPC_PRIVATE, size, 0666);
if (id < 0) {
- SYSERR("shmget failed");
+ snd_errornum(PCM, "shmget failed");
return -errno;
}
i->u.shm.shmid = id;
ptr = shmat(i->u.shm.shmid, 0, 0);
if (ptr == (void *) -1) {
- SYSERR("shmat failed");
+ snd_errornum(PCM, "shmat failed");
return -errno;
}
/* automatically remove segment if not used */
if (shmctl(id, IPC_RMID, NULL) < 0){
- SYSERR("shmctl mark remove failed");
+ snd_errornum(PCM, "shmctl mark remove failed");
return -errno;
}
i->u.shm.area = snd_shm_area_create(id, ptr);
if (i->u.shm.area == NULL) {
- SYSERR("snd_shm_area_create failed");
+ snd_errornum(PCM, "snd_shm_area_create failed");
return -ENOMEM;
}
if (pcm->access == SND_PCM_ACCESS_MMAP_INTERLEAVED ||
} else {
ptr = shmat(i->u.shm.shmid, 0, 0);
if (ptr == (void*) -1) {
- SYSERR("shmat failed");
+ snd_errornum(PCM, "shmat failed");
return -errno;
}
}
i->addr = ptr;
break;
#else
- SYSERR("shm support not available");
+ snd_errornum(PCM, "shm support not available");
return -ENOSYS;
#endif
case SND_PCM_AREA_LOCAL:
ptr = malloc(size);
if (ptr == NULL) {
- SYSERR("malloc failed");
+ snd_errornum(PCM, "malloc failed");
return -errno;
}
i->addr = ptr;
unsigned int c;
assert(pcm);
if (CHECK_SANITY(! pcm->mmap_channels)) {
- SNDMSG("Not mmapped");
+ snd_check(PCM, "Not mmapped");
return -ENXIO;
}
if (pcm->mmap_shadow) {
case SND_PCM_AREA_MMAP:
err = munmap(i->addr, size);
if (err < 0) {
- SYSERR("mmap failed");
+ snd_errornum(PCM, "mmap failed");
return -errno;
}
errno = 0;
}
break;
#else
- SYSERR("shm support not available");
+ snd_errornum(PCM, "shm support not available");
return -ENOSYS;
#endif
case SND_PCM_AREA_LOCAL:
break;
}
default:
- SNDMSG("invalid access type %d", pcm->access);
+ snd_check(PCM, "invalid access type %d", pcm->access);
return -EINVAL;
}
if (err < 0)
break;
}
default:
- SNDMSG("invalid access type %d", pcm->access);
+ snd_check(PCM, "invalid access type %d", pcm->access);
return -EINVAL;
}
if (err < 0)
slave = n;
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!slave) {
- SNDERR("slave is not defined");
+ snd_error(PCM, "slave is not defined");
return -EINVAL;
}
err = snd_pcm_slave_conf(root, slave, &sconf, 0);
slave = n;
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!slave) {
- SNDERR("slave is not defined");
+ snd_error(PCM, "slave is not defined");
return -EINVAL;
}
err = snd_pcm_slave_conf(root, slave, &sconf, 1,
if (snd_pcm_format_linear(sformat) != 1 &&
sformat != SND_PCM_FORMAT_MU_LAW) {
snd_config_delete(sconf);
- SNDERR("invalid slave format");
+ snd_error(PCM, "invalid slave format");
return -EINVAL;
}
err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);
for (k = 0; k < multi->slaves_count; ++k) {
err = snd_pcm_multi_hw_refine_sprepare(pcm, k, &sparams[k]);
if (err < 0) {
- SNDERR("Slave PCM #%d not usable", k);
+ snd_error(PCM, "Slave PCM #%d not usable", k);
return err;
}
}
continue;
if (strcmp(id, "slaves") == 0) {
if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
slaves = n;
}
if (strcmp(id, "bindings") == 0) {
if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
bindings = n;
}
if (strcmp(id, "master") == 0) {
if (snd_config_get_integer(n, &master_slave) < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!slaves) {
- SNDERR("slaves is not defined");
+ snd_error(PCM, "slaves is not defined");
return -EINVAL;
}
if (!bindings) {
- SNDERR("bindings is not defined");
+ snd_error(PCM, "bindings is not defined");
return -EINVAL;
}
snd_config_for_each(i, inext, slaves) {
++slaves_count;
}
if (master_slave < 0 || master_slave >= (long)slaves_count) {
- SNDERR("Master slave is out of range (0-%u)", slaves_count-1);
+ snd_error(PCM, "Master slave is out of range (0-%u)", slaves_count-1);
return -EINVAL;
}
snd_config_for_each(i, inext, bindings) {
continue;
err = safe_strtol(id, &cchannel);
if (err < 0 || cchannel < 0) {
- SNDERR("Invalid channel number: %s", id);
+ snd_error(PCM, "Invalid channel number: %s", id);
return -EINVAL;
}
if ((unsigned long)cchannel >= channels_count)
channels_count = cchannel + 1;
}
if (channels_count == 0) {
- SNDERR("No channels defined");
+ snd_error(PCM, "No channels defined");
return -EINVAL;
}
slaves_id = calloc(slaves_count, sizeof(*slaves_id));
continue;
err = safe_strtol(id, &cchannel);
if (err < 0 || cchannel < 0) {
- SNDERR("Invalid channel number: %s", id);
+ snd_error(PCM, "Invalid channel number: %s", id);
err = -EINVAL;
goto _free;
}
if (err < 0) {
err = snd_config_get_integer(n, &val);
if (err < 0) {
- SNDERR("Invalid value for %s", id);
+ snd_error(PCM, "Invalid value for %s", id);
goto _free;
}
sprintf(buf, "%ld", val);
if (strcmp(id, "channel") == 0) {
err = snd_config_get_integer(n, &schannel);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
goto _free;
}
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(PCM, "Unknown field %s", id);
err = -EINVAL;
goto _free;
}
if (slave < 0 || (unsigned int)slave >= slaves_count) {
- SNDERR("Invalid or missing sidx for channel %s", id);
+ snd_error(PCM, "Invalid or missing sidx for channel %s", id);
err = -EINVAL;
goto _free;
}
if (schannel < 0 ||
(unsigned int) schannel >= slaves_channels[slave]) {
- SNDERR("Invalid or missing schannel for channel %s", id);
+ snd_error(PCM, "Invalid or missing schannel for channel %s", id);
err = -EINVAL;
goto _free;
}
if (stream == SND_PCM_STREAM_PLAYBACK) {
fd = open("/dev/null", O_WRONLY);
if (fd < 0) {
- SYSERR("Cannot open /dev/null");
+ snd_errornum(PCM, "Cannot open /dev/null");
return -errno;
}
} else {
fd = open("/dev/full", O_RDONLY);
if (fd < 0) {
- SYSERR("Cannot open /dev/full");
+ snd_errornum(PCM, "Cannot open /dev/full");
return -errno;
}
}
snd_pcm_free_chmaps(chmap);
chmap = _snd_pcm_parse_config_chmaps(n);
if (!chmap) {
- SNDERR("Invalid channel map for %s", id);
+ snd_error(PCM, "Invalid channel map for %s", id);
return -EINVAL;
}
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(PCM, "Unknown field %s", id);
snd_pcm_free_chmaps(chmap);
return -EINVAL;
}
return err;
err = sprepare(pcm, &sparams);
if (err < 0) {
- SNDERR("Slave PCM not usable");
+ snd_error(PCM, "Slave PCM not usable");
return err;
}
#ifdef RULES_DEBUG
ttable[c * tt_ssize + c] = SND_PCM_PLUGIN_ROUTE_FULL;
break;
default:
- SNDERR("Invalid route policy");
+ snd_error(PCM, "Invalid route policy");
break;
}
}
}
if (snd_pcm_format_mask_empty(&sfmt_mask)) {
- SNDERR("Unable to find an usable slave format for '%s'", pcm->name);
+ snd_error(PCM, "Unable to find an usable slave format for '%s'", pcm->name);
for (format = 0; format <= SND_PCM_FORMAT_LAST; format++) {
if (!snd_pcm_format_mask_test(format_mask, format))
continue;
- SNDERR("Format: %s", snd_pcm_format_name(format));
+ snd_error(PCM, "Format: %s", snd_pcm_format_name(format));
}
for (format = 0; format <= SND_PCM_FORMAT_LAST; format++) {
if (!snd_pcm_format_mask_test(sformat_mask, format))
continue;
- SNDERR("Slave format: %s", snd_pcm_format_name(format));
+ snd_error(PCM, "Slave format: %s", snd_pcm_format_name(format));
}
return -EINVAL;
}
if (snd_pcm_hw_param_never_eq(params, SND_PCM_HW_PARAM_ACCESS, sparams)) {
err = check_access_change(params, sparams);
if (err < 0) {
- SNDERR("Unable to find an usable access for '%s'",
- pcm->name);
+ snd_error(PCM, "Unable to find an usable access for '%s'",
+ pcm->name);
+
return err;
}
}
}
if (snd_pcm_format_mask_empty(&fmt_mask)) {
- SNDERR("Unable to find an usable client format");
+ snd_error(PCM, "Unable to find an usable client format");
for (format = 0; format <= SND_PCM_FORMAT_LAST; format++) {
if (!snd_pcm_format_mask_test(format_mask, format))
continue;
- SNDERR("Format: %s", snd_pcm_format_name(format));
+ snd_error(PCM, "Format: %s", snd_pcm_format_name(format));
}
for (format = 0; format <= SND_PCM_FORMAT_LAST; format++) {
if (!snd_pcm_format_mask_test(sformat_mask, format))
continue;
- SNDERR("Slave format: %s", snd_pcm_format_name(format));
+ snd_error(PCM, "Slave format: %s", snd_pcm_format_name(format));
}
return -EINVAL;
}
if (strcmp(id, "ttable") == 0) {
route_policy = PLUG_ROUTE_POLICY_NONE;
if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
tt = n;
if (strcmp(id, "route_policy") == 0) {
const char *str;
if ((err = snd_config_get_string(n, &str)) < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
if (tt != NULL)
- SNDERR("Table is defined, route policy is ignored");
+ snd_error(PCM, "Table is defined, route policy is ignored");
if (!strcmp(str, "default"))
route_policy = PLUG_ROUTE_POLICY_DEFAULT;
else if (!strcmp(str, "average"))
continue;
}
#endif
- SNDERR("Unknown field %s", id);
+ snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!slave) {
- SNDERR("slave is not defined");
+ snd_error(PCM, "slave is not defined");
return -EINVAL;
}
err = snd_pcm_slave_conf(root, slave, &sconf, 3,
frames = plugin->write(pcm, areas, offset, frames,
slave_areas, slave_offset, &slave_frames);
if (CHECK_SANITY(slave_frames > snd_pcm_mmap_playback_avail(slave))) {
- SNDMSG("write overflow %ld > %ld", slave_frames,
- snd_pcm_mmap_playback_avail(slave));
+ snd_check(PCM, "write overflow %ld > %ld", slave_frames,
+ snd_pcm_mmap_playback_avail(slave));
+
err = -EPIPE;
goto error;
}
frames = (plugin->read)(pcm, areas, offset, frames,
slave_areas, slave_offset, &slave_frames);
if (CHECK_SANITY(slave_frames > snd_pcm_mmap_capture_avail(slave))) {
- SNDMSG("read overflow %ld > %ld", slave_frames,
- snd_pcm_mmap_playback_avail(slave));
+ snd_check(PCM, "read overflow %ld > %ld", slave_frames,
+ snd_pcm_mmap_playback_avail(slave));
+
err = -EPIPE;
goto error;
}
xfer += frames;
}
if (CHECK_SANITY(size)) {
- SNDMSG("short commit: %ld", size);
+ snd_check(PCM, "short commit: %ld", size);
return -EPIPE;
}
return xfer;
sinfo->period_size = slave->period_size;
if (CHECK_SANITY(rate->pareas)) {
- SNDMSG("rate plugin already in use");
+ snd_check(PCM, "rate plugin already in use");
return -EBUSY;
}
rate->orig_in_format = rate->info.in.format;
rate->orig_out_format = rate->info.out.format;
if (choose_preferred_format(rate) < 0) {
- SNDERR("No matching format in rate plugin");
+ snd_error(PCM, "No matching format in rate plugin");
err = -EINVAL;
goto error_pareas;
}
return result;
#if 0
if (slave_offset) {
- SNDERR("non-zero slave_offset %ld", slave_offset);
+ snd_error(PCM, "non-zero slave_offset %ld", slave_offset);
return -EIO;
}
#endif
return result;
#if 0
if (slave_offset) {
- SNDERR("non-zero slave_offset %ld", slave_offset);
+ snd_error(PCM, "non-zero slave_offset %ld", slave_offset);
return -EIO;
}
#endif
break;
}
if (!type) {
- SNDERR("No name given for rate converter");
+ snd_error(PCM, "No name given for rate converter");
snd_pcm_free(pcm);
free(rate);
return -EINVAL;
}
err = rate_open_func(rate, type, converter, 1);
} else {
- SNDERR("Invalid type for rate converter");
+ snd_error(PCM, "Invalid type for rate converter");
snd_pcm_free(pcm);
free(rate);
return -EINVAL;
}
if (err < 0) {
- SNDERR("Cannot find rate converter");
+ snd_error(PCM, "Cannot find rate converter");
snd_pcm_free(pcm);
free(rate);
return -ENOENT;
if (! rate->ops.init || ! (rate->ops.convert || rate->ops.convert_s16) ||
! rate->ops.input_frames || ! rate->ops.output_frames) {
- SNDERR("Inproper rate plugin %s initialization", type);
+ snd_error(PCM, "Inproper rate plugin %s initialization", type);
snd_pcm_free(pcm);
free(rate);
return err;
converter = n;
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!slave) {
- SNDERR("slave is not defined");
+ snd_error(PCM, "slave is not defined");
return -EINVAL;
}
if (sformat != SND_PCM_FORMAT_UNKNOWN &&
snd_pcm_format_linear(sformat) != 1) {
snd_config_delete(sconf);
- SNDERR("slave format is not linear");
+ snd_error(PCM, "slave format is not linear");
return -EINVAL;
}
err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);
dst += dst_step;
dst_frames1++;
if (CHECK_SANITY(dst_frames1 > dst_frames)) {
- SNDERR("dst_frames overflow");
+ snd_error(PCM, "dst_frames overflow");
break;
}
}
dst += dst_step;
dst_frames1++;
if (CHECK_SANITY(dst_frames1 > dst_frames)) {
- SNDERR("dst_frames overflow");
+ snd_error(PCM, "dst_frames overflow");
break;
}
}
cframes_new = input_frames(rate, info->out.period_size);
if ((cframes > info->in.period_size && cframes_new < info->in.period_size) ||
(cframes < info->in.period_size && cframes_new > info->in.period_size)) {
- SNDERR("invalid pcm period_size %ld -> %ld",
- info->in.period_size, info->out.period_size);
+ snd_error(PCM, "invalid pcm period_size %ld -> %ld",
+ info->in.period_size, info->out.period_size);
+
return -EIO;
}
cframes = cframes_new;
continue;
if (chmap->channels >= MAX_CHMAP_CHANNELS) {
- SNDERR("Too many channels in ttable chmap");
+ snd_error(PCM, "Too many channels in ttable chmap");
goto err;
}
chmap->pos[chmap->channels++] = ch;
}
if (*found_chmap == NULL) {
- SNDERR("Found no matching channel map");
+ snd_error(PCM, "Found no matching channel map");
return -EINVAL;
}
return 0;
continue;
err = safe_strtol(id, &cchannel);
if (err < 0) {
- SNDERR("Invalid client channel: %s", id);
+ snd_error(PCM, "Invalid client channel: %s", id);
return -EINVAL;
}
if (cchannel + 1 > csize)
continue;
err = strtochannel(id, chmap, &schannel, 1);
if (err < 0) {
- SNDERR("Invalid slave channel: %s", id);
+ snd_error(PCM, "Invalid slave channel: %s", id);
return -EINVAL;
}
if (schannel + 1 > ssize)
}
}
if (csize == 0 || ssize == 0) {
- SNDERR("Invalid null ttable configuration");
+ snd_error(PCM, "Invalid null ttable configuration");
return -EINVAL;
}
*tt_csize = csize;
err = safe_strtol(id, &cchannel);
if (err < 0 ||
cchannel < 0 || (unsigned int) cchannel > tt_csize) {
- SNDERR("Invalid client channel: %s", id);
+ snd_error(PCM, "Invalid client channel: %s", id);
return -EINVAL;
}
if (snd_config_get_type(in) != SND_CONFIG_TYPE_COMPOUND)
ss = strtochannel(id, chmap, scha, tt_ssize);
if (ss < 0) {
- SNDERR("Invalid slave channel: %s", id);
+ snd_error(PCM, "Invalid slave channel: %s", id);
return -EINVAL;
}
err = snd_config_get_ireal(jnode, &value);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
long schannel = scha[k];
if (schannel < 0 || (unsigned int) schannel > tt_ssize ||
(schannels > 0 && schannel >= schannels)) {
- SNDERR("Invalid slave channel: %s", id);
+ snd_error(PCM, "Invalid slave channel: %s", id);
return -EINVAL;
}
ttable[cchannel * tt_ssize + schannel] = value;
}
if (strcmp(id, "ttable") == 0) {
if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
snd_pcm_free_chmaps(chmaps);
return -EINVAL;
}
if (strcmp(id, "chmap") == 0) {
chmaps = _snd_pcm_parse_config_chmaps(n);
if (!chmaps) {
- SNDERR("Invalid channel map for %s", id);
+ snd_error(PCM, "Invalid channel map for %s", id);
return -EINVAL;
}
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!slave) {
- SNDERR("slave is not defined");
+ snd_error(PCM, "slave is not defined");
snd_pcm_free_chmaps(chmaps);
return -EINVAL;
}
if (!tt) {
- SNDERR("ttable is not defined");
+ snd_error(PCM, "ttable is not defined");
snd_pcm_free_chmaps(chmaps);
return -EINVAL;
}
if (sformat != SND_PCM_FORMAT_UNKNOWN &&
snd_pcm_format_linear(sformat) != 1) {
snd_config_delete(sconf);
- SNDERR("slave format is not linear");
+ snd_error(PCM, "slave format is not linear");
snd_pcm_free_chmaps(chmaps);
return -EINVAL;
}
}
err = snd_pcm_mmap_commit(spcm, snd_pcm_mmap_offset(spcm), frames);
if (err < 0) {
- SYSMSG("snd_pcm_mmap_commit error");
+ snd_checknum(PCM, "snd_pcm_mmap_commit error");
return INT_MAX;
}
if (err != frames)
- SYSMSG("commit returns %ld for size %ld", err, frames);
+ snd_checknum(PCM, "commit returns %ld for size %ld", err, frames);
slave_avail -= err;
} else {
if (safety_missing == 0)
running = 1;
break;
default:
- SNDERR("invalid shared PCM state %d", share->state);
+ snd_error(PCM, "invalid shared PCM state %d", share->state);
return INT_MAX;
}
pfd[0].events = POLLIN;
err = snd_pcm_poll_descriptors(spcm, &pfd[1], 1);
if (err != 1) {
- SNDERR("invalid poll descriptors %d", err);
+ snd_error(PCM, "invalid poll descriptors %d", err);
return NULL;
}
Pthread_mutex_lock(&slave->mutex);
err = pipe(slave->poll);
if (err < 0) {
- SYSERR("can't create a pipe");
+ snd_errornum(PCM, "can't create a pipe");
Pthread_mutex_unlock(&slave->mutex);
return NULL;
}
snd_pcm_sw_params_set_avail_min(spcm, &slave->sw_params, avail_min);
err = snd_pcm_sw_params(spcm, &slave->sw_params);
if (err < 0) {
- SYSERR("snd_pcm_sw_params error");
+ snd_errornum(PCM, "snd_pcm_sw_params error");
Pthread_mutex_unlock(&slave->mutex);
return NULL;
}
snd_pcm_sw_params_set_avail_min(spcm, &slave->sw_params, avail_min);
err = snd_pcm_sw_params(spcm, &slave->sw_params);
if (err < 0) {
- SYSERR("snd_pcm_sw_params error");
+ snd_errornum(PCM, "snd_pcm_sw_params error");
return;
}
}
spcm->buffer_size, 0);
_err:
if (err < 0) {
- SNDERR("slave is already running with incompatible setup");
+ snd_error(PCM, "slave is already running with incompatible setup");
err = -EBUSY;
goto _end;
}
snd_pcm_sframes_t err;
err = snd_pcm_mmap_commit(spcm, snd_pcm_mmap_offset(spcm), frames);
if (err < 0) {
- SYSMSG("snd_pcm_mmap_commit error");
+ snd_checknum(PCM, "snd_pcm_mmap_commit error");
return err;
}
if (err != frames) {
- SYSMSG("commit returns %ld for size %ld", err, frames);
+ snd_checknum(PCM, "commit returns %ld for size %ld", err, frames);
return err;
}
}
for (k = 0; k < channels; ++k) {
if (channels_map[k] >= sizeof(slave_map) / sizeof(slave_map[0])) {
- SNDERR("Invalid slave channel (%d) in binding", channels_map[k]);
+ snd_error(PCM, "Invalid slave channel (%d) in binding", channels_map[k]);
return -EINVAL;
}
if (slave_map[channels_map[k]]) {
- SNDERR("Repeated slave channel (%d) in binding", channels_map[k]);
+ snd_error(PCM, "Repeated slave channel (%d) in binding", channels_map[k]);
return -EINVAL;
}
slave_map[channels_map[k]] = 1;
snd_pcm_share_t *sh = list_entry(i, snd_pcm_share_t, list);
for (k = 0; k < sh->channels; ++k) {
if (slave_map[sh->slave_channels[k]]) {
- SNDERR("Slave channel %d is already in use", sh->slave_channels[k]);
+ snd_error(PCM, "Slave channel %d is already in use", sh->slave_channels[k]);
Pthread_mutex_unlock(&slave->mutex);
close(sd[0]);
close(sd[1]);
}
if (strcmp(id, "bindings") == 0) {
if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
bindings = n;
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!slave) {
- SNDERR("slave is not defined");
+ snd_error(PCM, "slave is not defined");
return -EINVAL;
}
err = snd_pcm_slave_conf(root, slave, &sconf, 5,
sname = err >= 0 && sname ? strdup(sname) : NULL;
snd_config_delete(sconf);
if (sname == NULL) {
- SNDERR("slave.pcm is not a string");
+ snd_error(PCM, "slave.pcm is not a string");
return err;
}
if (!bindings) {
- SNDERR("bindings is not defined");
+ snd_error(PCM, "bindings is not defined");
err = -EINVAL;
goto _free;
}
continue;
err = safe_strtol(id, &cchannel);
if (err < 0 || cchannel < 0) {
- SNDERR("Invalid client channel in binding: %s", id);
+ snd_error(PCM, "Invalid client channel in binding: %s", id);
err = -EINVAL;
goto _free;
}
channels = cchannel + 1;
}
if (channels == 0) {
- SNDERR("No bindings defined");
+ snd_error(PCM, "No bindings defined");
err = -EINVAL;
goto _free;
}
if (err != 1)
return -EBADFD;
if (ctrl->cmd) {
- SNDERR("Server has not done the cmd");
+ snd_error(PCM, "Server has not done the cmd");
return -EBADFD;
}
return ctrl->result;
mmap_size = page_ptr(shm_rbptr->offset, sizeof(snd_pcm_uframes_t), &offset, &mmap_offset);
ptr = mmap(NULL, mmap_size, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, fd, mmap_offset);
if (ptr == MAP_FAILED || ptr == NULL) {
- SYSERR("shm rbptr mmap failed");
+ snd_errornum(PCM, "shm rbptr mmap failed");
return -errno;
}
if (&pcm->hw == rbptr)
if (err != 1)
return -EBADFD;
if (ctrl->cmd) {
- SNDERR("Server has not done the cmd");
+ snd_error(PCM, "Server has not done the cmd");
return -EBADFD;
}
result = ctrl->result;
if (err != 1)
return -EBADFD;
if (ctrl->cmd) {
- SNDERR("Server has not done the cmd");
+ snd_error(PCM, "Server has not done the cmd");
return -EBADFD;
}
if (ctrl->hw.changed) {
}
err = close(i->u.mmap.fd);
if (err < 0) {
- SYSERR("close failed");
+ snd_errornum(PCM, "close failed");
return -errno;
}
}
sock = socket(PF_LOCAL, SOCK_STREAM, 0);
if (sock < 0) {
- SYSERR("socket failed");
+ snd_errornum(PCM, "socket failed");
return -errno;
}
memcpy(addr->sun_path, filename, l);
if (connect(sock, (struct sockaddr *) addr, size) < 0) {
- SYSERR("connect failed");
+ snd_errornum(PCM, "connect failed");
return -errno;
}
return sock;
result = make_local_socket(sockname);
if (result < 0) {
- SNDERR("server for socket %s is not running", sockname);
+ snd_error(PCM, "server for socket %s is not running", sockname);
goto _err;
}
sock = result;
req->namelen = snamelen;
err = write(sock, req, reqlen);
if (err < 0) {
- SYSERR("write error");
+ snd_errornum(PCM, "write error");
result = -errno;
goto _err;
}
if ((size_t) err != reqlen) {
- SNDERR("write size error");
+ snd_error(PCM, "write size error");
result = -EINVAL;
goto _err;
}
err = read(sock, &ans, sizeof(ans));
if (err < 0) {
- SYSERR("read error");
+ snd_errornum(PCM, "read error");
result = -errno;
goto _err;
}
if (err != sizeof(ans)) {
- SNDERR("read size error");
+ snd_error(PCM, "read size error");
result = -EINVAL;
goto _err;
}
ctrl = shmat(ans.cookie, 0, 0);
if (!ctrl) {
- SYSERR("shmat error");
+ snd_errornum(PCM, "shmat error");
result = -errno;
goto _err;
}
if (strcmp(id, "server") == 0) {
err = snd_config_get_string(n, &server);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
continue;
if (strcmp(id, "pcm") == 0) {
err = snd_config_get_string(n, &pcm_name);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!pcm_name) {
- SNDERR("pcm is not defined");
+ snd_error(PCM, "pcm is not defined");
return -EINVAL;
}
if (!server) {
- SNDERR("server is not defined");
+ snd_error(PCM, "server is not defined");
return -EINVAL;
}
err = snd_config_search_definition(root, "server", server, &sconfig);
if (err < 0) {
- SNDERR("Unknown server %s", server);
+ snd_error(PCM, "Unknown server %s", server);
return -EINVAL;
}
if (snd_config_get_type(sconfig) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("Invalid type for server %s definition", server);
+ snd_error(PCM, "Invalid type for server %s definition", server);
goto _err;
}
snd_config_for_each(i, next, sconfig) {
if (strcmp(id, "socket") == 0) {
err = snd_config_get_string(n, &sockname);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
goto _err;
}
continue;
if (strcmp(id, "port") == 0) {
err = snd_config_get_integer(n, &port);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
goto _err;
}
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(PCM, "Unknown field %s", id);
_err:
err = -EINVAL;
goto __error;
}
if (!sockname) {
- SNDERR("socket is not defined");
+ snd_error(PCM, "socket is not defined");
goto _err;
}
err = snd_pcm_shm_open(pcmp, name, sockname, pcm_name, stream, mode);
slave->format != SND_PCM_FORMAT_S24_LE &&
slave->format != SND_PCM_FORMAT_S32_LE &&
slave->format != SND_PCM_FORMAT_S32_BE) {
- SNDERR("softvol supports only S16_LE, S16_BE, S24_LE, S24_3LE, "
- "S32_LE or S32_BE");
+ snd_error(PCM, "softvol supports only S16_LE, S16_BE, S24_LE, S24_3LE, "
+ "S32_LE or S32_BE");
+
return -EINVAL;
}
svol->sformat = slave->format;
return err;
ctl_card = snd_pcm_info_get_card(&info);
if (ctl_card < 0) {
- SNDERR("No card defined for softvol control");
+ snd_error(PCM, "No card defined for softvol control");
return -EINVAL;
}
}
sprintf(tmp_name, "hw:%d", ctl_card);
err = snd_ctl_open(&svol->ctl, tmp_name, 0);
if (err < 0) {
- SNDERR("Cannot open CTL %s", tmp_name);
+ snd_error(PCM, "Cannot open CTL %s", tmp_name);
return err;
}
snd_ctl_elem_info_set_id(&cinfo, ctl_id);
if ((err = snd_ctl_elem_info(svol->ctl, &cinfo)) < 0) {
if (err != -ENOENT) {
- SNDERR("Cannot get info for CTL %s", tmp_name);
+ snd_error(PCM, "Cannot get info for CTL %s", tmp_name);
return err;
}
err = add_user_ctl(svol, &cinfo, cchannels);
if (err < 0) {
- SNDERR("Cannot add a control");
+ snd_error(PCM, "Cannot add a control");
return err;
}
} else {
(cinfo.access & SNDRV_CTL_ELEM_ACCESS_TLV_READ) != 0)) {
err = snd_ctl_elem_remove(svol->ctl, &cinfo.id);
if (err < 0) {
- SNDERR("Control %s mismatch", tmp_name);
+ snd_error(PCM, "Control %s mismatch", tmp_name);
return err;
}
/* clear cinfo including numid */
snd_ctl_elem_info_clear(&cinfo);
snd_ctl_elem_info_set_id(&cinfo, ctl_id);
if ((err = add_user_ctl(svol, &cinfo, cchannels)) < 0) {
- SNDERR("Cannot add a control");
+ snd_error(PCM, "Cannot add a control");
return err;
}
} else if (svol->max_val > 1) {
#ifndef HAVE_SOFT_FLOAT
svol->dB_value = calloc(resolution, sizeof(unsigned int));
if (! svol->dB_value) {
- SNDERR("cannot allocate dB table");
+ snd_error(PCM, "cannot allocate dB table");
return -ENOMEM;
}
svol->min_dB = min_dB;
if (svol->zero_dB_val)
svol->dB_value[svol->zero_dB_val] = 65535;
#else
- SNDERR("Cannot handle the given dB range and resolution");
+ snd_error(PCM, "Cannot handle the given dB range and resolution");
return -EINVAL;
#endif
}
}
if (strcmp(id, "name") == 0) {
if ((err = snd_config_get_string(n, &name)) < 0) {
- SNDERR("field %s is not a string", id);
+ snd_error(PCM, "field %s is not a string", id);
goto _err;
}
continue;
}
if (strcmp(id, "index") == 0) {
if ((err = snd_config_get_integer(n, &index)) < 0) {
- SNDERR("field %s is not an integer", id);
+ snd_error(PCM, "field %s is not an integer", id);
goto _err;
}
continue;
}
if (strcmp(id, "device") == 0) {
if ((err = snd_config_get_integer(n, &device)) < 0) {
- SNDERR("field %s is not an integer", id);
+ snd_error(PCM, "field %s is not an integer", id);
goto _err;
}
continue;
}
if (strcmp(id, "subdevice") == 0) {
if ((err = snd_config_get_integer(n, &subdevice)) < 0) {
- SNDERR("field %s is not an integer", id);
+ snd_error(PCM, "field %s is not an integer", id);
goto _err;
}
continue;
if (strcmp(id, "count") == 0) {
long v;
if ((err = snd_config_get_integer(n, &v)) < 0) {
- SNDERR("field %s is not an integer", id);
+ snd_error(PCM, "field %s is not an integer", id);
goto _err;
}
if (v < 1 || v > 2) {
- SNDERR("Invalid count %ld", v);
+ snd_error(PCM, "Invalid count %ld", v);
goto _err;
}
*cchannels = v;
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (name == NULL) {
- SNDERR("Missing control name");
+ snd_error(PCM, "Missing control name");
err = -EINVAL;
goto _err;
}
long v;
err = snd_config_get_integer(n, &v);
if (err < 0) {
- SNDERR("Invalid resolution value");
+ snd_error(PCM, "Invalid resolution value");
return err;
}
resolution = v;
if (strcmp(id, "min_dB") == 0) {
err = snd_config_get_ireal(n, &min_dB);
if (err < 0) {
- SNDERR("Invalid min_dB value");
+ snd_error(PCM, "Invalid min_dB value");
return err;
}
continue;
if (strcmp(id, "max_dB") == 0) {
err = snd_config_get_ireal(n, &max_dB);
if (err < 0) {
- SNDERR("Invalid max_dB value");
+ snd_error(PCM, "Invalid max_dB value");
return err;
}
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (!slave) {
- SNDERR("slave is not defined");
+ snd_error(PCM, "slave is not defined");
return -EINVAL;
}
if (!control) {
- SNDERR("control is not defined");
+ snd_error(PCM, "control is not defined");
return -EINVAL;
}
if (min_dB >= 0) {
- SNDERR("min_dB must be a negative value");
+ snd_error(PCM, "min_dB must be a negative value");
return -EINVAL;
}
if (max_dB <= min_dB || max_dB > MAX_DB_UPPER_LIMIT) {
- SNDERR("max_dB must be larger than min_dB and less than %d dB",
- MAX_DB_UPPER_LIMIT);
+ snd_error(PCM, "max_dB must be larger than min_dB and less than %d dB",
+ MAX_DB_UPPER_LIMIT);
+
return -EINVAL;
}
if (resolution <= 1 || resolution > 1024) {
- SNDERR("Invalid resolution value %d", resolution);
+ snd_error(PCM, "Invalid resolution value %d", resolution);
return -EINVAL;
}
if (mode & SND_PCM_NO_SOFTVOL) {
sformat != SND_PCM_FORMAT_S24_LE &&
sformat != SND_PCM_FORMAT_S32_LE &&
sformat != SND_PCM_FORMAT_S32_BE) {
- SNDERR("only S16_LE, S16_BE, S24_LE, S24_3LE, S32_LE or S32_BE format is supported");
+ snd_error(PCM, "only S16_LE, S16_BE, S24_LE, S24_3LE, S32_LE or S32_BE format is supported");
snd_config_delete(sconf);
return -EINVAL;
}
if (strcmp(id, "bar_width") == 0) {
err = snd_config_get_integer(n, &bar_width);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
continue;
if (strcmp(id, "decay_ms") == 0) {
err = snd_config_get_integer(n, &decay_ms);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
continue;
if (strcmp(id, "peak_ms") == 0) {
err = snd_config_get_integer(n, &peak_ms);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(PCM, "Invalid type for %s", id);
return -EINVAL;
}
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(PCM, "Unknown field %s", id);
return -EINVAL;
}
if (bar_width < 0)
#endif
if (snd_config_get_type(rawmidi_conf) != SND_CONFIG_TYPE_COMPOUND) {
if (name)
- SNDERR("Invalid type for RAWMIDI %s definition", name);
+ snd_error(RAWMIDI, "Invalid type for RAWMIDI %s definition", name);
else
- SNDERR("Invalid type for RAWMIDI definition");
+ snd_error(RAWMIDI, "Invalid type for RAWMIDI definition");
return -EINVAL;
}
err = snd_config_search(rawmidi_conf, "type", &conf);
if (err < 0) {
- SNDERR("type is not defined");
+ snd_error(RAWMIDI, "type is not defined");
return err;
}
err = snd_config_get_id(conf, &id);
if (err < 0) {
- SNDERR("unable to get id");
+ snd_error(RAWMIDI, "unable to get id");
return err;
}
err = snd_config_get_string(conf, &str);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(RAWMIDI, "Invalid type for %s", id);
return err;
}
err = snd_config_search_definition(rawmidi_root, "rawmidi_type", str, &type_conf);
if (err >= 0) {
if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("Invalid type for RAWMIDI type %s definition", str);
+ snd_error(RAWMIDI, "Invalid type for RAWMIDI type %s definition", str);
err = -EINVAL;
goto _err;
}
if (strcmp(id, "lib") == 0) {
err = snd_config_get_string(n, &lib);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(RAWMIDI, "Invalid type for %s", id);
goto _err;
}
continue;
if (strcmp(id, "open") == 0) {
err = snd_config_get_string(n, &open_name);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(RAWMIDI, "Invalid type for %s", id);
goto _err;
}
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(RAWMIDI, "Unknown field %s", id);
err = -EINVAL;
goto _err;
}
snd_config_t *rawmidi_conf;
err = snd_config_search_definition(root, "rawmidi", name, &rawmidi_conf);
if (err < 0) {
- SNDERR("Unknown RawMidi %s", name);
+ snd_error(RAWMIDI, "Unknown RawMidi %s", name);
return err;
}
err = snd_rawmidi_open_conf(inputp, outputp, name, root, rawmidi_conf, mode);
return 0;
if (close(hw->fd)) {
err = -errno;
- SYSMSG("close failed");
+ snd_checknum(RAWMIDI, "close failed");
}
free(hw->buf);
free(hw);
long flags;
if ((flags = fcntl(hw->fd, F_GETFL)) < 0) {
- SYSMSG("F_GETFL failed");
+ snd_checknum(RAWMIDI, "F_GETFL failed");
return -errno;
}
if (nonblock)
else
flags &= ~O_NONBLOCK;
if (fcntl(hw->fd, F_SETFL, flags) < 0) {
- SYSMSG("F_SETFL for O_NONBLOCK failed");
+ snd_checknum(RAWMIDI, "F_SETFL for O_NONBLOCK failed");
return -errno;
}
return 0;
snd_rawmidi_hw_t *hw = rmidi->private_data;
info->stream = rmidi->stream;
if (ioctl(hw->fd, SNDRV_RAWMIDI_IOCTL_INFO, info) < 0) {
- SYSMSG("SNDRV_RAWMIDI_IOCTL_INFO failed");
+ snd_checknum(RAWMIDI, "SNDRV_RAWMIDI_IOCTL_INFO failed");
return -errno;
}
return 0;
int tstamp;
params->stream = rmidi->stream;
if (ioctl(hw->fd, SNDRV_RAWMIDI_IOCTL_PARAMS, params) < 0) {
- SYSMSG("SNDRV_RAWMIDI_IOCTL_PARAMS failed");
+ snd_checknum(RAWMIDI, "SNDRV_RAWMIDI_IOCTL_PARAMS failed");
return -errno;
}
buf_reset(hw);
snd_rawmidi_hw_t *hw = rmidi->private_data;
status->stream = rmidi->stream;
if (ioctl(hw->fd, SNDRV_RAWMIDI_IOCTL_STATUS, status) < 0) {
- SYSMSG("SNDRV_RAWMIDI_IOCTL_STATUS failed");
+ snd_checknum(RAWMIDI, "SNDRV_RAWMIDI_IOCTL_STATUS failed");
return -errno;
}
return 0;
snd_rawmidi_hw_t *hw = rmidi->private_data;
int str = rmidi->stream;
if (ioctl(hw->fd, SNDRV_RAWMIDI_IOCTL_DROP, &str) < 0) {
- SYSMSG("SNDRV_RAWMIDI_IOCTL_DROP failed");
+ snd_checknum(RAWMIDI, "SNDRV_RAWMIDI_IOCTL_DROP failed");
return -errno;
}
buf_reset(hw);
snd_rawmidi_hw_t *hw = rmidi->private_data;
int str = rmidi->stream;
if (ioctl(hw->fd, SNDRV_RAWMIDI_IOCTL_DRAIN, &str) < 0) {
- SYSMSG("SNDRV_RAWMIDI_IOCTL_DRAIN failed");
+ snd_checknum(RAWMIDI, "SNDRV_RAWMIDI_IOCTL_DRAIN failed");
return -errno;
}
return 0;
fd = snd_open_device(filename, fmode);
if (fd < 0) {
snd_ctl_close(ctl);
- SYSMSG("open %s failed", filename);
+ snd_checknum(RAWMIDI, "open %s failed", filename);
return -errno;
}
}
if (ioctl(fd, SNDRV_RAWMIDI_IOCTL_PVERSION, &ver) < 0) {
ret = -errno;
- SYSMSG("SNDRV_RAWMIDI_IOCTL_PVERSION failed");
+ snd_checknum(RAWMIDI, "SNDRV_RAWMIDI_IOCTL_PVERSION failed");
close(fd);
snd_ctl_close(ctl);
return ret;
memset(&info, 0, sizeof(info));
info.stream = outputp ? SNDRV_RAWMIDI_STREAM_OUTPUT : SNDRV_RAWMIDI_STREAM_INPUT;
if (ioctl(fd, SNDRV_RAWMIDI_IOCTL_INFO, &info) < 0) {
- SYSMSG("SNDRV_RAWMIDI_IOCTL_INFO failed");
+ snd_checknum(RAWMIDI, "SNDRV_RAWMIDI_IOCTL_INFO failed");
ret = -errno;
close(fd);
snd_ctl_close(ctl);
void *h = NULL;
if (snd_config_get_type(seq_conf) != SND_CONFIG_TYPE_COMPOUND) {
if (name)
- SNDERR("Invalid type for SEQ %s definition", name);
+ snd_error(SEQUENCER, "Invalid type for SEQ %s definition", name);
else
- SNDERR("Invalid type for SEQ definition");
+ snd_error(SEQUENCER, "Invalid type for SEQ definition");
return -EINVAL;
}
err = snd_config_search(seq_conf, "type", &conf);
if (err < 0) {
- SNDERR("type is not defined");
+ snd_error(SEQUENCER, "type is not defined");
return err;
}
err = snd_config_get_id(conf, &id);
if (err < 0) {
- SNDERR("unable to get id");
+ snd_error(SEQUENCER, "unable to get id");
return err;
}
err = snd_config_get_string(conf, &str);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(SEQUENCER, "Invalid type for %s", id);
return err;
}
err = snd_config_search_definition(seq_root, "seq_type", str, &type_conf);
if (err >= 0) {
if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("Invalid type for SEQ type %s definition", str);
+ snd_error(SEQUENCER, "Invalid type for SEQ type %s definition", str);
goto _err;
}
snd_config_for_each(i, next, type_conf) {
if (strcmp(id, "lib") == 0) {
err = snd_config_get_string(n, &lib);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(SEQUENCER, "Invalid type for %s", id);
goto _err;
}
continue;
if (strcmp(id, "open") == 0) {
err = snd_config_get_string(n, &open_name);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(SEQUENCER, "Invalid type for %s", id);
goto _err;
}
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(SEQUENCER, "Unknown field %s", id);
err = -EINVAL;
goto _err;
}
open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_SEQ_DLSYM_VERSION));
err = 0;
if (!h) {
- SNDERR("Cannot open shared library %s (%s)", lib, errbuf);
+ snd_error(SEQUENCER, "Cannot open shared library %s (%s)", lib, errbuf);
err = -ENOENT;
} else if (!open_func) {
- SNDERR("symbol %s is not defined inside %s", open_name, lib);
+ snd_error(SEQUENCER, "symbol %s is not defined inside %s", open_name, lib);
snd_dlclose(h);
err = -ENXIO;
}
snd_config_t *seq_conf;
err = snd_config_search_definition(root, "seq", name, &seq_conf);
if (err < 0) {
- SNDERR("Unknown SEQ %s", name);
+ snd_error(SEQUENCER, "Unknown SEQ %s", name);
return err;
}
snd_config_set_hop(seq_conf, hop);
pfd.events = POLLIN;
err = poll(&pfd, 1, timeout);
if (err < 0) {
- SYSERR("poll");
+ snd_errornum(SEQUENCER, "poll");
return -errno;
}
if (pfd.revents & POLLIN)
if (close(hw->fd)) {
err = -errno;
- SYSERR("close failed\n");
+ snd_errornum(SEQUENCER, "close failed\n");
}
free(hw);
return err;
long flags;
if ((flags = fcntl(hw->fd, F_GETFL)) < 0) {
- SYSERR("F_GETFL failed");
+ snd_errornum(SEQUENCER, "F_GETFL failed");
return -errno;
}
if (nonblock)
else
flags &= ~O_NONBLOCK;
if (fcntl(hw->fd, F_SETFL, flags) < 0) {
- SYSERR("F_SETFL for O_NONBLOCK failed");
+ snd_errornum(SEQUENCER, "F_SETFL for O_NONBLOCK failed");
return -errno;
}
return 0;
snd_seq_hw_t *hw = seq->private_data;
int client;
if (ioctl(hw->fd, SNDRV_SEQ_IOCTL_CLIENT_ID, &client) < 0) {
- SYSERR("SNDRV_SEQ_IOCTL_CLIENT_ID failed");
+ snd_errornum(SEQUENCER, "SNDRV_SEQ_IOCTL_CLIENT_ID failed");
return -errno;
}
return client;
{
snd_seq_hw_t *hw = seq->private_data;
if (ioctl(hw->fd, SNDRV_SEQ_IOCTL_SYSTEM_INFO, info) < 0) {
- SYSERR("SNDRV_SEQ_IOCTL_SYSTEM_INFO failed");
+ snd_errornum(SEQUENCER, "SNDRV_SEQ_IOCTL_SYSTEM_INFO failed");
return -errno;
}
return 0;
}
#endif
if (fd < 0) {
- SYSERR("open %s failed", filename);
+ snd_errornum(SEQUENCER, "open %s failed", filename);
return -errno;
}
if (ioctl(fd, SNDRV_SEQ_IOCTL_PVERSION, &ver) < 0) {
- SYSERR("SNDRV_SEQ_IOCTL_PVERSION failed");
+ snd_errornum(SEQUENCER, "SNDRV_SEQ_IOCTL_PVERSION failed");
ret = -errno;
close(fd);
return ret;
return -EINVAL;
if (!(info->protocol_caps & info->protocol)) {
- SNDERR("Inconsistent UMP protocol_caps and protocol\n");
+ snd_error(SEQUENCER, "Inconsistent UMP protocol_caps and protocol\n");
return -EINVAL;
}
} else if (info->protocol & SND_UMP_EP_INFO_PROTO_MIDI1) {
version = SND_SEQ_CLIENT_UMP_MIDI_1_0;
} else {
- SNDERR("Invalid UMP protocol set 0x%x\n", info->protocol);
+ snd_error(SEQUENCER, "Invalid UMP protocol set 0x%x\n", info->protocol);
return -EINVAL;
}
err = snd_seq_set_client_midi_version(seq, version);
if (err < 0) {
- SNDERR("Failed to set to MIDI protocol 0x%x\n", version);
+ snd_error(SEQUENCER, "Failed to set to MIDI protocol 0x%x\n", version);
return err;
}
err = snd_seq_set_ump_endpoint_info(seq, seq->ump_ep);
if (err < 0) {
- SNDERR("Failed to set UMP EP info\n");
+ snd_error(SEQUENCER, "Failed to set UMP EP info\n");
goto error_free;
}
snd_seq_port_info_set_ump_group(pinfo, 0);
err = snd_seq_create_port(seq, pinfo);
if (err < 0) {
- SNDERR("Failed to create MIDI 2.0 port\n");
+ snd_error(SEQUENCER, "Failed to create MIDI 2.0 port\n");
goto error_free;
}
snd_seq_port_info_set_ump_group(pinfo, i + 1);
err = snd_seq_create_port(seq, pinfo);
if (err < 0) {
- SNDERR("Failed to create Group port %d\n", i + 1);
+ snd_error(SEQUENCER, "Failed to create Group port %d\n", i + 1);
goto error;
}
}
err = snd_seq_set_ump_block_info(seq, blkid, bp);
if (err < 0) {
- SNDERR("Failed to set UMP EP info\n");
+ snd_error(SEQUENCER, "Failed to set UMP EP info\n");
free(bp);
seq->ump_blks[blkid] = NULL;
return err;
ret = sendmsg(sock, &msghdr, 0 );
if (ret < 0) {
- SYSERR("sendmsg failed");
+ snd_errornum(CORE, "sendmsg failed");
return -errno;
}
return ret;
ret = recvmsg(sock, &msghdr, 0);
if (ret < 0) {
- SYSERR("recvmsg failed");
+ snd_errornum(CORE, "recvmsg failed");
return -errno;
}
*fd = *fds;
void *h = NULL;
if (snd_config_get_type(timer_conf) != SND_CONFIG_TYPE_COMPOUND) {
if (name)
- SNDERR("Invalid type for TIMER %s definition", name);
+ snd_error(TIMER, "Invalid type for TIMER %s definition", name);
else
- SNDERR("Invalid type for TIMER definition");
+ snd_error(TIMER, "Invalid type for TIMER definition");
return -EINVAL;
}
err = snd_config_search(timer_conf, "type", &conf);
if (err < 0) {
- SNDERR("type is not defined");
+ snd_error(TIMER, "type is not defined");
return err;
}
err = snd_config_get_id(conf, &id);
if (err < 0) {
- SNDERR("unable to get id");
+ snd_error(TIMER, "unable to get id");
return err;
}
err = snd_config_get_string(conf, &str);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(TIMER, "Invalid type for %s", id);
return err;
}
err = snd_config_search_definition(timer_root, "timer_type", str, &type_conf);
if (err >= 0) {
if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("Invalid type for TIMER type %s definition", str);
+ snd_error(TIMER, "Invalid type for TIMER type %s definition", str);
goto _err;
}
snd_config_for_each(i, next, type_conf) {
if (strcmp(id, "lib") == 0) {
err = snd_config_get_string(n, &lib);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(TIMER, "Invalid type for %s", id);
goto _err;
}
continue;
if (strcmp(id, "open") == 0) {
err = snd_config_get_string(n, &open_name);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(TIMER, "Invalid type for %s", id);
goto _err;
}
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(TIMER, "Unknown field %s", id);
err = -EINVAL;
goto _err;
}
open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_TIMER_DLSYM_VERSION));
err = 0;
if (!h) {
- SNDERR("Cannot open shared library %s (%s)", lib, errbuf);
+ snd_error(TIMER, "Cannot open shared library %s (%s)", lib, errbuf);
err = -ENOENT;
} else if (!open_func) {
- SNDERR("symbol %s is not defined inside %s", open_name, lib);
+ snd_error(TIMER, "symbol %s is not defined inside %s", open_name, lib);
snd_dlclose(h);
err = -ENXIO;
}
snd_config_t *timer_conf;
err = snd_config_search_definition(root, "timer", name, &timer_conf);
if (err < 0) {
- SNDERR("Unknown timer %s", name);
+ snd_error(TIMER, "Unknown timer %s", name);
return err;
}
err = snd_timer_open_conf(timer, name, root, timer_conf, mode);
snd_timer_t *snd_async_handler_get_timer(snd_async_handler_t *handler)
{
if (handler->type != SND_ASYNC_HANDLER_TIMER) {
- SNDMSG("invalid handler type %d", handler->type);
+ snd_check(TIMER, "invalid handler type %d", handler->type);
return NULL;
}
return handler->u.timer;
assert(timer);
fd = timer->poll_fd;
if ((flags = fcntl(fd, F_GETFL)) < 0) {
- SYSERR("F_GETFL failed");
+ snd_errornum(TIMER, "F_GETFL failed");
return -errno;
}
if (sig >= 0)
else
flags &= ~O_ASYNC;
if (fcntl(fd, F_SETFL, flags) < 0) {
- SYSERR("F_SETFL for O_ASYNC failed");
+ snd_errornum(TIMER, "F_SETFL for O_ASYNC failed");
return -errno;
}
if (sig < 0)
return 0;
#ifdef F_SETSIG
if (fcntl(fd, F_SETSIG, (long)sig) < 0) {
- SYSERR("F_SETSIG failed");
+ snd_errornum(TIMER, "F_SETSIG failed");
return -errno;
}
#endif
if (fcntl(fd, F_SETOWN, (long)pid) < 0) {
- SYSERR("F_SETOWN failed");
+ snd_errornum(TIMER, "F_SETOWN failed");
return -errno;
}
return 0;
ret = -errno;
__no_tread:
close(fd);
- SNDMSG("extended read is not supported (SNDRV_TIMER_IOCTL_TREAD)");
+ snd_check(TIMER, "extended read is not supported (SNDRV_TIMER_IOCTL_TREAD)");
return ret;
}
}
return err;
continue;
}
- SNDERR("Unexpected field %s", id);
+ snd_error(TIMER, "Unexpected field %s", id);
return -EINVAL;
}
return snd_timer_hw_open(timer, name, dev_class, dev_sclass, card, device, subdevice, mode);
void *h = NULL;
if (snd_config_get_type(timer_conf) != SND_CONFIG_TYPE_COMPOUND) {
if (name)
- SNDERR("Invalid type for TIMER %s definition", name);
+ snd_error(TIMER, "Invalid type for TIMER %s definition", name);
else
- SNDERR("Invalid type for TIMER definition");
+ snd_error(TIMER, "Invalid type for TIMER definition");
return -EINVAL;
}
err = snd_config_search(timer_conf, "type", &conf);
if (err < 0) {
- SNDERR("type is not defined");
+ snd_error(TIMER, "type is not defined");
return err;
}
err = snd_config_get_id(conf, &id);
if (err < 0) {
- SNDERR("unable to get id");
+ snd_error(TIMER, "unable to get id");
return err;
}
err = snd_config_get_string(conf, &str);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(TIMER, "Invalid type for %s", id);
return err;
}
err = snd_config_search_definition(timer_root, "timer_query_type", str, &type_conf);
if (err >= 0) {
if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("Invalid type for TIMER type %s definition", str);
+ snd_error(TIMER, "Invalid type for TIMER type %s definition", str);
err = -EINVAL;
goto _err;
}
if (strcmp(id, "lib") == 0) {
err = snd_config_get_string(n, &lib);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(TIMER, "Invalid type for %s", id);
goto _err;
}
continue;
if (strcmp(id, "open") == 0) {
err = snd_config_get_string(n, &open_name);
if (err < 0) {
- SNDERR("Invalid type for %s", id);
+ snd_error(TIMER, "Invalid type for %s", id);
goto _err;
}
continue;
}
- SNDERR("Unknown field %s", id);
+ snd_error(TIMER, "Unknown field %s", id);
err = -EINVAL;
goto _err;
}
open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_TIMER_QUERY_DLSYM_VERSION));
err = 0;
if (!h) {
- SNDERR("Cannot open shared library %s (%s)", lib, errbuf);
+ snd_error(TIMER, "Cannot open shared library %s (%s)", lib, errbuf);
err = -ENOENT;
} else if (!open_func) {
- SNDERR("symbol %s is not defined inside %s", open_name, lib);
+ snd_error(TIMER, "symbol %s is not defined inside %s", open_name, lib);
snd_dlclose(h);
err = -ENXIO;
}
snd_config_t *timer_conf;
err = snd_config_search_definition(root, "timer_query", name, &timer_conf);
if (err < 0) {
- SNDERR("Unknown timer %s", name);
+ snd_error(TIMER, "Unknown timer %s", name);
return err;
}
err = snd_timer_query_open_conf(timer, name, root, timer_conf, mode);
continue;
if (_snd_conf_generic_id(id))
continue;
- SNDERR("Unexpected field %s", id);
+ snd_error(TIMER, "Unexpected field %s", id);
return -EINVAL;
}
return snd_timer_query_hw_open(timer, name, mode);
/* make sure file offset is aligned with the calculated HDR offset */
if (tplg->bin_pos != tplg->next_hdr_pos) {
- SNDERR("New header is at offset 0x%zx but file"
- " offset 0x%zx is %s by %ld bytes",
- tplg->next_hdr_pos, tplg->bin_pos,
- tplg->bin_pos > tplg->next_hdr_pos ? "ahead" : "behind",
- tplg->bin_pos - tplg->next_hdr_pos);
+ snd_error(TOPOLOGY, "New header is at offset 0x%zx but file"
+ " offset 0x%zx is %s by %ld bytes",
+
+ tplg->next_hdr_pos, tplg->bin_pos,
+
+ tplg->bin_pos > tplg->next_hdr_pos ? "ahead" : "behind",
+
+ tplg->bin_pos - tplg->next_hdr_pos);
+
return -EINVAL;
}
ret = write_block_header(tplg, tplg_type, elem->vendor_type,
tplg->version, elem->index, block_size, count);
if (ret < 0) {
- SNDERR("failed to write %s block %d",
- obj_name, ret);
+ snd_error(TOPOLOGY, "failed to write %s block %d",
+ obj_name, ret);
+
return ret;
}
/* make sure we have written the correct size */
if (total_size != size) {
- SNDERR("size mismatch. Expected %zu wrote %zu",
- size, total_size);
+ snd_error(TOPOLOGY, "size mismatch. Expected %zu wrote %zu",
+ size, total_size);
+
return -EIO;
}
tplg->version, 0,
sizeof(tplg->manifest) + tplg->manifest.priv.size, 1);
if (ret < 0) {
- SNDERR("failed to write manifest block");
+ snd_error(TOPOLOGY, "failed to write manifest block");
return ret;
}
/* write manifest */
ret = write_manifest_data(tplg);
if (ret < 0) {
- SNDERR("failed to write manifest %d", ret);
+ snd_error(TOPOLOGY, "failed to write manifest %d", ret);
return ret;
}
ret = write_elem_block(tplg, list, size,
tptr->tsoc, tptr->name);
if (ret < 0) {
- SNDERR("failed to write %s elements: %s",
- tptr->name, snd_strerror(-ret));
+ snd_error(TOPOLOGY, "failed to write %s elements: %s",
+ tptr->name, snd_strerror(-ret));
+
return ret;
}
}
tplg->bin_pos, tplg->bin_pos);
if (total_size != tplg->bin_pos) {
- SNDERR("total size mismatch (%zd != %zd)",
- total_size, tplg->bin_pos);
+ snd_error(TOPOLOGY, "total size mismatch (%zd != %zd)",
+ total_size, tplg->bin_pos);
+
return -EINVAL;
}
channel_id = lookup_channel(id);
if (channel_id < 0) {
- SNDERR("invalid channel %s", id);
+ snd_error(TOPOLOGY, "invalid channel %s", id);
return -EINVAL;
}
if (strcmp(id, "access") == 0) {
err = parse_access_values(n, hdr);
if (err < 0) {
- SNDERR("failed to parse access");
+ snd_error(TOPOLOGY, "failed to parse access");
return err;
}
continue;
}
if (!ref->elem) {
- SNDERR("cannot find '%s' referenced by"
- " control '%s'", ref->id, elem->id);
+ snd_error(TOPOLOGY, "cannot find '%s' referenced by"
+ " control '%s'", ref->id, elem->id);
+
return -EINVAL;
} else if (err < 0)
return err;
return err;
}
if (!ref->elem) {
- SNDERR("cannot find '%s' referenced by"
- " control '%s'", ref->id, elem->id);
+ snd_error(TOPOLOGY, "cannot find '%s' referenced by"
+ " control '%s'", ref->id, elem->id);
+
return -EINVAL;
}
}
else if (strcmp(id, "mute") == 0)
scale->mute = val;
else
- SNDERR("unknown id '%s'", id);
+ snd_error(TOPOLOGY, "unknown id '%s'", id);
}
return 0;
if (strcmp(id, "scale") == 0) {
err = tplg_parse_tlv_dbscale(n, elem);
if (err < 0) {
- SNDERR("failed to DBScale");
+ snd_error(TOPOLOGY, "failed to DBScale");
return err;
}
continue;
int err;
if (tlv->type != SNDRV_CTL_TLVT_DB_SCALE) {
- SNDERR("unknown TLV type");
+ snd_error(TOPOLOGY, "unknown TLV type");
return -EINVAL;
}
if (strcmp(id, "channel") == 0) {
if (ec->num_channels >= SND_SOC_TPLG_MAX_CHAN) {
- SNDERR("too many channels %s", elem->id);
+ snd_error(TOPOLOGY, "too many channels %s", elem->id);
return -EINVAL;
}
if (strcmp(id, "channel") == 0) {
if (mc->num_channels >= SND_SOC_TPLG_MAX_CHAN) {
- SNDERR("too many channels %s", elem->id);
+ snd_error(TOPOLOGY, "too many channels %s", elem->id);
return -EINVAL;
}
struct snd_soc_tplg_tlv_dbscale *scale;
if (!tlvt) {
- SNDERR("missing TLV data");
+ snd_error(TOPOLOGY, "missing TLV data");
return -EINVAL;
}
/* TODO: add support for other TLV types */
default:
- SNDERR("unsupported TLV type %d", tlv->type);
+ snd_error(TOPOLOGY, "unsupported TLV type %d", tlv->type);
break;
}
}
tplg_dbg(" Control Mixer: %s", mixer->hdr.name);
if (mixer->hdr.type != SND_SOC_TPLG_TYPE_MIXER) {
- SNDERR("invalid mixer type %d", mixer->hdr.type);
+ snd_error(TOPOLOGY, "invalid mixer type %d", mixer->hdr.type);
return -EINVAL;
}
tplg_dbg(" Control Enum: %s", enum_ctl->hdr.name);
if (enum_ctl->hdr.type != SND_SOC_TPLG_TYPE_ENUM) {
- SNDERR("invalid enum type %d", enum_ctl->hdr.type);
+ snd_error(TOPOLOGY, "invalid enum type %d", enum_ctl->hdr.type);
return -EINVAL;
}
tplg_dbg(" Control Bytes: %s", bytes_ctl->hdr.name);
if (bytes_ctl->hdr.type != SND_SOC_TPLG_TYPE_BYTES) {
- SNDERR("invalid bytes type %d", bytes_ctl->hdr.type);
+ snd_error(TOPOLOGY, "invalid bytes type %d", bytes_ctl->hdr.type);
return -EINVAL;
}
if (be->hdr.access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK) {
if ((be->hdr.access & SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE)
!= SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE) {
- SNDERR("Invalid TLV bytes control access 0x%x",
- be->hdr.access);
+ snd_error(TOPOLOGY, "Invalid TLV bytes control access 0x%x",
+ be->hdr.access);
+
tplg_elem_free(elem);
return -EINVAL;
}
int i;
if (size < sizeof(*mc)) {
- SNDERR("mixer: small size %d", size);
+ snd_error(TOPOLOGY, "mixer: small size %d", size);
return -EINVAL;
}
tplg_log(tplg, 'D', pos, "mixer: size %d TLV size %d private size %d",
mc->size, mc->hdr.tlv.size, mc->priv.size);
if (size != mc->size + mc->priv.size) {
- SNDERR("mixer: unexpected element size %d", size);
+ snd_error(TOPOLOGY, "mixer: unexpected element size %d", size);
return -EINVAL;
}
/* nothing */
} else if (mc->hdr.tlv.size == sizeof(struct snd_soc_tplg_ctl_tlv)) {
if (mc->hdr.tlv.type != SNDRV_CTL_TLVT_DB_SCALE) {
- SNDERR("mixer: unknown TLV type %d",
- mc->hdr.tlv.type);
+ snd_error(TOPOLOGY, "mixer: unknown TLV type %d",
+ mc->hdr.tlv.type);
+
return -EINVAL;
}
db = tplg_calloc(heap, sizeof(*db));
tplg_log(tplg, 'D', pos, "mixer: dB scale TLV: min %d step %d mute %d",
db->min, db->step, db->mute);
} else {
- SNDERR("mixer: wrong TLV size %d", mc->hdr.tlv.size);
+ snd_error(TOPOLOGY, "mixer: wrong TLV size %d", mc->hdr.tlv.size);
return -EINVAL;
}
next:
if (size < sizeof(*mc)) {
- SNDERR("mixer: small size %d", size);
+ snd_error(TOPOLOGY, "mixer: small size %d", size);
return -EINVAL;
}
INIT_LIST_HEAD(&heap);
mc = bin;
size2 = mc->size + mc->priv.size;
if (size2 > size) {
- SNDERR("mixer: wrong element size (%d, priv %d)",
- mc->size, mc->priv.size);
+ snd_error(TOPOLOGY, "mixer: wrong element size (%d, priv %d)",
+ mc->size, mc->priv.size);
+
return -EINVAL;
}
if (ec->num_channels > SND_TPLG_MAX_CHAN ||
ec->num_channels > SND_SOC_TPLG_MAX_CHAN) {
- SNDERR("enum: unexpected channel count %d", ec->num_channels);
+ snd_error(TOPOLOGY, "enum: unexpected channel count %d", ec->num_channels);
return -EINVAL;
}
if (ec->items > SND_SOC_TPLG_NUM_TEXTS) {
- SNDERR("enum: unexpected texts count %d", ec->items);
+ snd_error(TOPOLOGY, "enum: unexpected texts count %d", ec->items);
return -EINVAL;
}
next:
if (size < sizeof(*ec)) {
- SNDERR("enum: small size %d", size);
+ snd_error(TOPOLOGY, "enum: small size %d", size);
return -EINVAL;
}
INIT_LIST_HEAD(&heap);
ec = bin;
size2 = ec->size + ec->priv.size;
if (size2 > size) {
- SNDERR("enum: wrong element size (%d, priv %d)",
- ec->size, ec->priv.size);
+ snd_error(TOPOLOGY, "enum: wrong element size (%d, priv %d)",
+ ec->size, ec->priv.size);
+
return -EINVAL;
}
struct snd_soc_tplg_bytes_control *bc = bin;
if (size < sizeof(*bc)) {
- SNDERR("bytes: small size %d", size);
+ snd_error(TOPOLOGY, "bytes: small size %d", size);
return -EINVAL;
}
tplg_log(tplg, 'D', pos, "control bytes: size %d private size %d",
bc->size, bc->priv.size);
if (size != bc->size + bc->priv.size) {
- SNDERR("bytes: unexpected element size %d", size);
+ snd_error(TOPOLOGY, "bytes: unexpected element size %d", size);
return -EINVAL;
}
next:
if (size < sizeof(*bc)) {
- SNDERR("bytes: small size %d", size);
+ snd_error(TOPOLOGY, "bytes: small size %d", size);
return -EINVAL;
}
bc = bin;
size2 = bc->size + bc->priv.size;
if (size2 > size) {
- SNDERR("bytes: wrong element size (%d, priv %d)",
- bc->size, bc->priv.size);
+ snd_error(TOPOLOGY, "bytes: wrong element size (%d, priv %d)",
+ bc->size, bc->priv.size);
+
return -EINVAL;
}
}
if (!ref->elem) {
- SNDERR("cannot find '%s' referenced by widget '%s'",
- ref->id, elem->id);
+ snd_error(TOPOLOGY, "cannot find '%s' referenced by widget '%s'",
+ ref->id, elem->id);
+
return -EINVAL;
}
elem = list_entry(pos, struct tplg_elem, list);
if (!elem->widget || elem->type != SND_TPLG_TYPE_DAPM_WIDGET) {
- SNDERR("invalid widget '%s'", elem->id);
+ snd_error(TOPOLOGY, "invalid widget '%s'", elem->id);
return -EINVAL;
}
elem = list_entry(pos, struct tplg_elem, list);
if (!elem->route || elem->type != SND_TPLG_TYPE_DAPM_GRAPH) {
- SNDERR("invalid route '%s'", elem->id);
+ snd_error(TOPOLOGY, "invalid route '%s'", elem->id);
return -EINVAL;
}
/* validate sink */
if (strlen(route->sink) <= 0) {
- SNDERR("no sink");
+ snd_error(TOPOLOGY, "no sink");
return -EINVAL;
}
if (!tplg_elem_lookup(&tplg->widget_list, route->sink,
SND_TPLG_TYPE_DAPM_WIDGET, SND_TPLG_INDEX_ALL)) {
- SNDERR("undefined sink widget/stream '%s'", route->sink);
+ snd_error(TOPOLOGY, "undefined sink widget/stream '%s'", route->sink);
}
/* validate control name */
SND_TPLG_TYPE_MIXER, elem->index) &&
!tplg_elem_lookup(&tplg->enum_list, route->control,
SND_TPLG_TYPE_ENUM, elem->index)) {
- SNDERR("undefined mixer/enum control '%s'",
- route->control);
+ snd_error(TOPOLOGY, "undefined mixer/enum control '%s'",
+ route->control);
+
}
}
/* validate source */
if (strlen(route->source) <= 0) {
- SNDERR("no source");
+ snd_error(TOPOLOGY, "no source");
return -EINVAL;
}
if (!tplg_elem_lookup(&tplg->widget_list, route->source,
SND_TPLG_TYPE_DAPM_WIDGET, SND_TPLG_INDEX_ALL)) {
- SNDERR("undefined source widget/stream '%s'",
- route->source);
+ snd_error(TOPOLOGY, "undefined source widget/stream '%s'",
+ route->source);
+
}
/* add graph to manifest */
len = strlen(buf);
if (len <= 2) {
- SNDERR("invalid route \"%s\"", buf);
+ snd_error(TOPOLOGY, "invalid route \"%s\"", buf);
return -EINVAL;
}
if (buf[i] == ',')
goto second;
}
- SNDERR("invalid route \"%s\"", buf);
+ snd_error(TOPOLOGY, "invalid route \"%s\"", buf);
return -EINVAL;
second:
goto done;
}
- SNDERR("invalid route \"%s\"", buf);
+ snd_error(TOPOLOGY, "invalid route \"%s\"", buf);
return -EINVAL;
done:
int index = -1;
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("compound is expected for dapm graph definition");
+ snd_error(TOPOLOGY, "compound is expected for dapm graph definition");
return -EINVAL;
}
if (strcmp(id, "lines") == 0) {
if (index < 0) {
- SNDERR("failed to parse dapm graph %s, missing index",
- graph_id);
+ snd_error(TOPOLOGY, "failed to parse dapm graph %s, missing index",
+ graph_id);
+
return -EINVAL;
}
err = tplg_parse_routes(tplg, n, index);
if (err < 0) {
- SNDERR("failed to parse dapm graph %s",
- graph_id);
+ snd_error(TOPOLOGY, "failed to parse dapm graph %s",
+ graph_id);
+
return err;
}
continue;
widget_type = lookup_widget(val);
if (widget_type < 0){
- SNDERR("widget '%s': Unsupported widget type %s",
- elem->id, val);
+ snd_error(TOPOLOGY, "widget '%s': Unsupported widget type %s",
+ elem->id, val);
+
return -EINVAL;
}
break;
default:
- SNDERR("widget %s: invalid type %d for ctl %d",
- wt->name, ct->type, i);
+ snd_error(TOPOLOGY, "widget %s: invalid type %d for ctl %d",
+ wt->name, ct->type, i);
+
ret = -EINVAL;
break;
}
w = bin;
if (size < sizeof(*w)) {
- SNDERR("dapm widget: small size %d", size);
+ snd_error(TOPOLOGY, "dapm widget: small size %d", size);
return -EINVAL;
}
if (sizeof(*w) != w->size) {
- SNDERR("dapm widget: unknown element size %d (expected %zd)",
- w->size, sizeof(*w));
+ snd_error(TOPOLOGY, "dapm widget: unknown element size %d (expected %zd)",
+ w->size, sizeof(*w));
+
return -EINVAL;
}
if (w->num_kcontrols > 16) {
- SNDERR("dapm widget: too many kcontrols %d",
- w->num_kcontrols);
+ snd_error(TOPOLOGY, "dapm widget: too many kcontrols %d",
+ w->num_kcontrols);
+
return -EINVAL;
}
wt->name, wt->sname);
if (sizeof(*w) + w->priv.size > size) {
- SNDERR("dapm widget: wrong private data size %d",
- w->priv.size);
+ snd_error(TOPOLOGY, "dapm widget: wrong private data size %d",
+ w->priv.size);
+
return -EINVAL;
}
size2 = mc->size + mc->priv.size;
tplg_log(tplg, 'D', pos, "kcontrol mixer size %zd", size2);
if (size2 > size) {
- SNDERR("dapm widget: small mixer size %d",
- size2);
+ snd_error(TOPOLOGY, "dapm widget: small mixer size %d",
+ size2);
+
err = -EINVAL;
goto retval;
}
size2 = ec->size + ec->priv.size;
tplg_log(tplg, 'D', pos, "kcontrol enum size %zd", size2);
if (size2 > size) {
- SNDERR("dapm widget: small enum size %d",
- size2);
+ snd_error(TOPOLOGY, "dapm widget: small enum size %d",
+ size2);
+
err = -EINVAL;
goto retval;
}
size2 = bc->size + bc->priv.size;
tplg_log(tplg, 'D', pos, "kcontrol bytes size %zd", size2);
if (size2 > size) {
- SNDERR("dapm widget: small bytes size %d",
- size2);
+ snd_error(TOPOLOGY, "dapm widget: small bytes size %d",
+ size2);
+
err = -EINVAL;
goto retval;
}
bin, size2);
break;
default:
- SNDERR("dapm widget: wrong control type %d",
- chdr->type);
+ snd_error(TOPOLOGY, "dapm widget: wrong control type %d",
+ chdr->type);
+
err = -EINVAL;
goto retval;
}
for (ge = gt->elem; size > 0; ge++) {
g = bin;
if (size < sizeof(*g)) {
- SNDERR("dapm graph: small size %d", size);
+ snd_error(TOPOLOGY, "dapm graph: small size %d", size);
return -EINVAL;
}
ge->src = g->source;
priv = &elem->pcm->priv;
break;
default:
- SNDERR("'%s': no support for private data for type %d",
- elem->id, elem->type);
+ snd_error(TOPOLOGY, "'%s': no support for private data for type %d",
+ elem->id, elem->type);
+
}
return priv;
}
if (cfg_type != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("compound type expected for %s", elem->id);
+ snd_error(TOPOLOGY, "compound type expected for %s", elem->id);
return -EINVAL;
}
fp = fopen(filename, "r");
if (fp == NULL) {
- SNDERR("invalid data file path '%s'", filename);
+ snd_error(TOPOLOGY, "invalid data file path '%s'", filename);
return -errno;
}
size = ftell(fp);
fseek(fp, 0L, SEEK_SET);
if (size <= 0) {
- SNDERR("invalid data file size %zu", size);
+ snd_error(TOPOLOGY, "invalid data file size %zu", size);
ret = -EINVAL;
goto err;
}
if (size > TPLG_MAX_PRIV_SIZE) {
- SNDERR("data file too big %zu", size);
+ snd_error(TOPOLOGY, "data file too big %zu", size);
ret = -EINVAL;
goto err;
}
elem->size = sizeof(*priv) + size;
if (fclose(fp) == EOF) {
- SNDERR("Cannot close data file.");
+ snd_error(TOPOLOGY, "Cannot close data file.");
return -errno;
}
return 0;
if ((errno == ERANGE && val == ULONG_MAX)
|| (errno != 0 && val == 0)
|| (val > UCHAR_MAX)) {
- SNDERR("invalid value for uuid");
+ snd_error(TOPOLOGY, "invalid value for uuid");
ret = -EINVAL;
goto out;
}
if ((errno == ERANGE && val == ULONG_MAX)
|| (errno != 0 && val == 0)
|| (val > UCHAR_MAX)) {
- SNDERR("invalid value for uuid");
+ snd_error(TOPOLOGY, "invalid value for uuid");
ret = -EINVAL;
goto out;
}
}
if (values < 16) {
- SNDERR("less than 16 integers for uuid");
+ snd_error(TOPOLOGY, "less than 16 integers for uuid");
ret = -EINVAL;
}
num = get_hex_num(value);
if (num <= 0) {
- SNDERR("malformed hex variable list %s", value);
+ snd_error(TOPOLOGY, "malformed hex variable list %s", value);
return -EINVAL;
}
priv = elem->data;
if (size > TPLG_MAX_PRIV_SIZE) {
- SNDERR("data too big %d", size);
+ snd_error(TOPOLOGY, "data too big %d", size);
return -EINVAL;
}
return tokens->token[i].value;
}
- SNDERR("cannot find token id '%s'", token_id);
+ snd_error(TOPOLOGY, "cannot find token id '%s'", token_id);
return -1;
}
* tuple_set->num_tuples;
size += set_size;
if (size > TPLG_MAX_PRIV_SIZE) {
- SNDERR("data too big %d", size);
+ snd_error(TOPOLOGY, "data too big %d", size);
return -EINVAL;
}
ref->id, SND_TPLG_TYPE_TUPLE, elem->index);
tuples = ref->elem;
if (!tuples) {
- SNDERR("cannot find tuples %s", ref->id);
+ snd_error(TOPOLOGY, "cannot find tuples %s", ref->id);
return -EINVAL;
}
tokens = get_tokens(tplg, tuples);
if (!tokens) {
- SNDERR("cannot find token for %s", ref->id);
+ snd_error(TOPOLOGY, "cannot find token for %s", ref->id);
return -EINVAL;
}
type = get_tuple_type(id);
if (type < 0) {
- SNDERR("invalid tuple type '%s'", id);
+ snd_error(TOPOLOGY, "invalid tuple type '%s'", id);
return type;
}
case SND_SOC_TPLG_TUPLE_TYPE_WORD:
ival = tplg_get_unsigned(n, &tuple_val, 0);
if (ival < 0) {
- SNDERR("tuple %s: %s", id, snd_strerror(ival));
+ snd_error(TOPOLOGY, "tuple %s: %s", id, snd_strerror(ival));
goto err;
}
&& tuple_val > USHRT_MAX) ||
(type == SND_SOC_TPLG_TUPLE_TYPE_BYTE
&& tuple_val > UCHAR_MAX)) {
- SNDERR("tuple %s: invalid value", id);
+ snd_error(TOPOLOGY, "tuple %s: invalid value", id);
goto err;
}
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
if (snd_config_get_id(cfg, &id) >= 0)
- SNDERR("compound type expected for %s", id);
+ snd_error(TOPOLOGY, "compound type expected for %s", id);
return -EINVAL;
}
snd_config_for_each(i, next, cfg) {
n = snd_config_iterator_entry(i);
if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("compound type expected for %s, is %d",
- id, snd_config_get_type(n));
+ snd_error(TOPOLOGY, "compound type expected for %s, is %d",
+ id, snd_config_get_type(n));
+
return -EINVAL;
}
int err;
if (!list_empty(&tplg->manifest_list)) {
- SNDERR("already has manifest data");
+ snd_error(TOPOLOGY, "already has manifest data");
return -EINVAL;
}
if (strcmp(id, "file") == 0) {
err = tplg_parse_data_file(n, elem);
if (err < 0) {
- SNDERR("failed to parse data file");
+ snd_error(TOPOLOGY, "failed to parse data file");
return err;
}
continue;
if (strcmp(id, "bytes") == 0) {
err = tplg_parse_data_hex(n, elem, 1);
if (err < 0) {
- SNDERR("failed to parse data bytes");
+ snd_error(TOPOLOGY, "failed to parse data bytes");
return err;
}
continue;
if (strcmp(id, "shorts") == 0) {
err = tplg_parse_data_hex(n, elem, 2);
if (err < 0) {
- SNDERR("failed to parse data shorts");
+ snd_error(TOPOLOGY, "failed to parse data shorts");
return err;
}
continue;
if (strcmp(id, "words") == 0) {
err = tplg_parse_data_hex(n, elem, 4);
if (err < 0) {
- SNDERR("failed to parse data words");
+ snd_error(TOPOLOGY, "failed to parse data words");
return err;
}
continue;
ref_elem = tplg_elem_lookup(&tplg->pdata_list,
ref->id, SND_TPLG_TYPE_DATA, elem->index);
if (!ref_elem) {
- SNDERR("cannot find data '%s' referenced by"
- " element '%s'", ref->id, elem->id);
+ snd_error(TOPOLOGY, "cannot find data '%s' referenced by"
+ " element '%s'", ref->id, elem->id);
+
return -EINVAL;
}
size_t off;
if (hdr->index != 0) {
- SNDERR("manifest - wrong index %d", hdr->index);
+ snd_error(TOPOLOGY, "manifest - wrong index %d", hdr->index);
return -EINVAL;
}
if (sizeof(*m) > size) {
- SNDERR("manifest - wrong size %zd (minimal %zd)",
- size, sizeof(*m));
+ snd_error(TOPOLOGY, "manifest - wrong size %zd (minimal %zd)",
+ size, sizeof(*m));
+
return -EINVAL;
}
if (m->size != sizeof(*m)) {
- SNDERR("manifest - wrong sructure size %d", m->size);
+ snd_error(TOPOLOGY, "manifest - wrong sructure size %d", m->size);
return -EINVAL;
}
off = offsetof(struct snd_soc_tplg_manifest, priv);
if (off + m->priv.size > size) {
- SNDERR("manifest - wrong private size %d", m->priv.size);
+ snd_error(TOPOLOGY, "manifest - wrong private size %d", m->priv.size);
return -EINVAL;
}
va = bin;
if (size < sizeof(*va) || size < va->size) {
- SNDERR("tuples: wrong size %zd", size);
+ snd_error(TOPOLOGY, "tuples: wrong size %zd", size);
return -EINVAL;
}
case SND_SOC_TPLG_TUPLE_TYPE_SHORT:
break;
default:
- SNDERR("tuples: unknown array type %d", va->type);
+ snd_error(TOPOLOGY, "tuples: unknown array type %d", va->type);
return -EINVAL;
}
j = tplg_get_tuple_size(va->type) * va->num_elems;
if (j + sizeof(*va) != va->size) {
- SNDERR("tuples: wrong vendor array size %d "
- "(expected %d for %d count %d)",
+ snd_error(TOPOLOGY, "tuples: wrong vendor array size %d "
+ "(expected %d for %d count %d)",
+
va->size, j + sizeof(*va), va->type, va->num_elems);
return -EINVAL;
}
if (va->num_elems > 4096) {
- SNDERR("tuples: tuples overflow %d", va->num_elems);
+ snd_error(TOPOLOGY, "tuples: tuples overflow %d", va->num_elems);
return -EINVAL;
}
int err;
if (size < sizeof(*va)) {
- SNDERR("tuples: small size %zd", size);
+ snd_error(TOPOLOGY, "tuples: small size %zd", size);
return -EINVAL;
}
next:
va = bin;
if (size < sizeof(*va)) {
- SNDERR("tuples: unexpected vendor arry size %zd", size);
+ snd_error(TOPOLOGY, "tuples: unexpected vendor arry size %zd", size);
return -EINVAL;
}
if (tuples->num_sets >= tuples->alloc_sets) {
- SNDERR("tuples: index overflow (%d)", tuples->num_sets);
+ snd_error(TOPOLOGY, "tuples: index overflow (%d)", tuples->num_sets);
return -EINVAL;
}
next:
tp = bin;
if (off + size < tp->size) {
- SNDERR("data: unexpected element size %zd", size);
+ snd_error(TOPOLOGY, "data: unexpected element size %zd", size);
return -EINVAL;
}
void *bin ATTRIBUTE_UNUSED,
size_t size ATTRIBUTE_UNUSED)
{
- SNDERR("data type not expected");
+ snd_error(TOPOLOGY, "data type not expected");
return -EINVAL;
}
}
if (size - pos < sizeof(*hdr)) {
tplg_log(tplg, 'D', pos, "block: small size");
- SNDERR("incomplete header data to decode");
+ snd_error(TOPOLOGY, "incomplete header data to decode");
return -EINVAL;
}
hdr = b;
if (hdr->magic != SND_SOC_TPLG_MAGIC) {
- SNDERR("bad block magic %08x", hdr->magic);
+ snd_error(TOPOLOGY, "bad block magic %08x", hdr->magic);
return -EINVAL;
}
tplg_log(tplg, 'D', pos, "block: abi %d size %d payload size %d",
hdr->abi, hdr->size, hdr->payload_size);
if (hdr->abi != SND_SOC_TPLG_ABI_VERSION) {
- SNDERR("unsupported ABI version %d", hdr->abi);
+ snd_error(TOPOLOGY, "unsupported ABI version %d", hdr->abi);
return -EINVAL;
}
if (hdr->size != sizeof(*hdr)) {
- SNDERR("header size mismatch");
+ snd_error(TOPOLOGY, "header size mismatch");
return -EINVAL;
}
if (size - pos < hdr->size + hdr->payload_size) {
- SNDERR("incomplete payload data to decode");
+ snd_error(TOPOLOGY, "incomplete payload data to decode");
return -EINVAL;
}
if (hdr->payload_size < 8) {
- SNDERR("wrong payload size %d", hdr->payload_size);
+ snd_error(TOPOLOGY, "wrong payload size %d", hdr->payload_size);
return -EINVAL;
}
/* first block must be manifest */
if (b == bin) {
if (hdr->type != SND_SOC_TPLG_TYPE_MANIFEST) {
- SNDERR("first block must be manifest (value %d)", hdr->type);
+ snd_error(TOPOLOGY, "first block must be manifest (value %d)", hdr->type);
return -EINVAL;
}
err = snd_tplg_set_version(tplg, hdr->version);
break;
}
if (index >= tplg_table_items || tptr->decod == NULL) {
- SNDERR("unknown block type %d", hdr->type);
+ snd_error(TOPOLOGY, "unknown block type %d", hdr->type);
return -EINVAL;
}
tplg_log(tplg, 'D', pos, "block: type %d - %s", hdr->type, tptr->name);
for (index = 0; index < tplg_table_items; index++)
if (tplg_table[index].tsoc == asoc_type)
return tplg_table[index].type;
- SNDERR("uknown asoc type %d", asoc_type);
+ snd_error(TOPOLOGY, "uknown asoc type %d", asoc_type);
return -EINVAL;
}
/* cant find string name in our table so we use its ID number */
i = safe_strtol(c, &ret);
if (i < 0) {
- SNDERR("wrong kcontrol ops value string '%s'", c);
+ snd_error(TOPOLOGY, "wrong kcontrol ops value string '%s'", c);
return i;
}
return -EINVAL;
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("compound type expected for %s", id);
+ snd_error(TOPOLOGY, "compound type expected for %s", id);
return -EINVAL;
}
n = snd_config_iterator_entry(i);
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("compound type expected for %s, is %d",
- id, snd_config_get_type(cfg));
+ snd_error(TOPOLOGY, "compound type expected for %s, is %d",
+ id, snd_config_get_type(cfg));
+
return -EINVAL;
}
int err;
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
- SNDERR("compound type expected at top level");
+ snd_error(TOPOLOGY, "compound type expected at top level");
return -EINVAL;
}
}
if (parser == NULL) {
- SNDERR("unknown section %s", id);
+ snd_error(TOPOLOGY, "unknown section %s", id);
continue;
}
ret = snd_config_load(top, in);
if (ret < 0) {
- SNDERR("could not load configuration");
+ snd_error(TOPOLOGY, "could not load configuration");
snd_config_delete(top);
return ret;
}
ret = tplg_parse_config(tplg, top);
snd_config_delete(top);
if (ret < 0) {
- SNDERR("failed to parse topology");
+ snd_error(TOPOLOGY, "failed to parse topology");
return ret;
}
err = snd_input_buffer_open(&in, buf, size);
if (err < 0) {
- SNDERR("could not create input buffer");
+ snd_error(TOPOLOGY, "could not create input buffer");
return err;
}
err = tplg_build_integ(tplg);
if (err < 0) {
- SNDERR("failed to check topology integrity");
+ snd_error(TOPOLOGY, "failed to check topology integrity");
return err;
}
err = tplg_write_data(tplg);
if (err < 0) {
- SNDERR("failed to write data %d", err);
+ snd_error(TOPOLOGY, "failed to write data %d", err);
return err;
}
return 0;
fp = fopen(infile, "r");
if (fp == NULL) {
- SNDERR("could not open configuration file %s", infile);
+ snd_error(TOPOLOGY, "could not open configuration file %s", infile);
return -errno;
}
err = snd_input_stdio_attach(&in, fp, 1);
if (err < 0) {
fclose(fp);
- SNDERR("could not attach stdio %s", infile);
+ snd_error(TOPOLOGY, "could not attach stdio %s", infile);
return err;
}
case SND_TPLG_TYPE_CC:
return tplg_add_link_object(tplg, t);
default:
- SNDERR("invalid object type %d", t->type);
+ snd_error(TOPOLOGY, "invalid object type %d", t->type);
return -EINVAL;
};
}
fd = open(outfile, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
if (fd < 0) {
- SNDERR("failed to open %s err %d", outfile, -errno);
+ snd_error(TOPOLOGY, "failed to open %s err %d", outfile, -errno);
return -errno;
}
r = write(fd, tplg->bin, tplg->bin_size);
close(fd);
if (r < 0) {
err = -errno;
- SNDERR("write error: %s", strerror(errno));
+ snd_error(TOPOLOGY, "write error: %s", strerror(errno));
return err;
}
if ((size_t)r != tplg->bin_size) {
- SNDERR("partial write (%zd != %zd)", r, tplg->bin_size);
+ snd_error(TOPOLOGY, "partial write (%zd != %zd)", r, tplg->bin_size);
return -EIO;
}
return 0;
snd_tplg_t *tplg;
if (!is_little_endian()) {
- SNDERR("cannot support big-endian machines");
+ snd_error(TOPOLOGY, "cannot support big-endian machines");
return NULL;
}
return err;
}
if (!ref->elem) {
- SNDERR("cannot find '%s' referenced by"
- " PCM '%s'", ref->id, elem->id);
+ snd_error(TOPOLOGY, "cannot find '%s' referenced by"
+ " PCM '%s'", ref->id, elem->id);
+
return -EINVAL;
}
}
elem = list_entry(pos, struct tplg_elem, list);
if (elem->type != type) {
- SNDERR("invalid elem '%s'", elem->id);
+ snd_error(TOPOLOGY, "invalid elem '%s'", elem->id);
return -EINVAL;
}
elem = list_entry(pos, struct tplg_elem, list);
if (elem->type != type) {
- SNDERR("invalid elem '%s'", elem->id);
+ snd_error(TOPOLOGY, "invalid elem '%s'", elem->id);
return -EINVAL;
}
ref->elem = tplg_elem_lookup(&tplg->hw_cfg_list,
ref->id, SND_TPLG_TYPE_HW_CONFIG, elem->index);
if (!ref->elem) {
- SNDERR("cannot find HW config '%s'"
- " referenced by link '%s'",
- ref->id, elem->id);
+ snd_error(TOPOLOGY, "cannot find HW config '%s'"
+ " referenced by link '%s'",
+ ref->id, elem->id);
+
return -EINVAL;
}
while ((s != NULL) && (i < SND_SOC_TPLG_MAX_FORMATS)) {
format = snd_pcm_format_value(s);
if (format == SND_PCM_FORMAT_UNKNOWN) {
- SNDERR("unsupported stream format %s", s);
+ snd_error(TOPOLOGY, "unsupported stream format %s", s);
return -EINVAL;
}
rate = get_rate_value(s);
if (rate == SND_PCM_RATE_UNKNOWN) {
- SNDERR("unsupported stream rate %s", s);
+ snd_error(TOPOLOGY, "unsupported stream rate %s", s);
return -EINVAL;
}
if (strcmp(id, "id") == 0) {
if (tplg_get_unsigned(n, &dai_id, 0)) {
- SNDERR("invalid fe dai ID");
+ snd_error(TOPOLOGY, "invalid fe dai ID");
return -EINVAL;
}
if (strcasecmp(audio_hw_formats[i].name, val) == 0)
return audio_hw_formats[i].type;
- SNDERR("invalid audio HW format %s", val);
+ snd_error(TOPOLOGY, "invalid audio HW format %s", val);
return -EINVAL;
}
provider_legacy = false;
if (strcmp(id, "bclk_master") == 0) {
- SNDERR("deprecated option %s, please use 'bclk'", id);
+ snd_error(TOPOLOGY, "deprecated option %s, please use 'bclk'", id);
provider_legacy = true;
}
/* For backwards capability,
* "master" == "codec is slave"
*/
- SNDERR("deprecated bclk value '%s'", val);
+ snd_error(TOPOLOGY, "deprecated bclk value '%s'", val);
hw_cfg->bclk_provider = SND_SOC_TPLG_BCLK_CC;
} else if (!strcmp(val, "codec_slave")) {
- SNDERR("deprecated bclk value '%s', use 'codec_consumer'", val);
+ snd_error(TOPOLOGY, "deprecated bclk value '%s', use 'codec_consumer'", val);
hw_cfg->bclk_provider = SND_SOC_TPLG_BCLK_CC;
} else if (!strcmp(val, "codec_consumer")) {
hw_cfg->bclk_provider = SND_SOC_TPLG_BCLK_CC;
} else if (!strcmp(val, "codec_master")) {
- SNDERR("deprecated bclk value '%s', use 'codec_provider", val);
+ snd_error(TOPOLOGY, "deprecated bclk value '%s', use 'codec_provider", val);
hw_cfg->bclk_provider = SND_SOC_TPLG_BCLK_CP;
} else if (!strcmp(val, "codec_provider")) {
provider_legacy = false;
if (strcmp(id, "fsync_master") == 0) {
- SNDERR("deprecated option %s, please use 'fsync'", id);
+ snd_error(TOPOLOGY, "deprecated option %s, please use 'fsync'", id);
provider_legacy = true;
}
/* For backwards capability,
* "master" == "codec is slave"
*/
- SNDERR("deprecated fsync value '%s'", val);
+ snd_error(TOPOLOGY, "deprecated fsync value '%s'", val);
hw_cfg->fsync_provider = SND_SOC_TPLG_FSYNC_CC;
} else if (!strcmp(val, "codec_slave")) {
- SNDERR("deprecated fsync value '%s', use 'codec_consumer'", val);
+ snd_error(TOPOLOGY, "deprecated fsync value '%s', use 'codec_consumer'", val);
hw_cfg->fsync_provider = SND_SOC_TPLG_FSYNC_CC;
} else if (!strcmp(val, "codec_consumer")) {
hw_cfg->fsync_provider = SND_SOC_TPLG_FSYNC_CC;
} else if (!strcmp(val, "codec_master")) {
- SNDERR("deprecated fsync value '%s', use 'codec_provider'", val);
+ snd_error(TOPOLOGY, "deprecated fsync value '%s', use 'codec_provider'", val);
hw_cfg->fsync_provider = SND_SOC_TPLG_FSYNC_CP;
} else if (!strcmp(val, "codec_provider")) {
/* For backwards capability,
* "master" == "for codec, mclk is input"
*/
- SNDERR("deprecated mclk value '%s'", val);
+ snd_error(TOPOLOGY, "deprecated mclk value '%s'", val);
hw_cfg->mclk_direction = SND_SOC_TPLG_MCLK_CI;
} else if (!strcmp(val, "codec_mclk_in")) {
pcm = bin;
if (size < sizeof(*pcm)) {
- SNDERR("pcm: small size %d", size);
+ snd_error(TOPOLOGY, "pcm: small size %d", size);
return -EINVAL;
}
if (sizeof(*pcm) != pcm->size) {
- SNDERR("pcm: unknown element size %d (expected %zd)",
- pcm->size, sizeof(*pcm));
+ snd_error(TOPOLOGY, "pcm: unknown element size %d (expected %zd)",
+ pcm->size, sizeof(*pcm));
+
return -EINVAL;
}
if (pcm->num_streams > SND_SOC_TPLG_STREAM_CONFIG_MAX) {
- SNDERR("pcm: wrong number of streams %d", pcm->num_streams);
+ snd_error(TOPOLOGY, "pcm: wrong number of streams %d", pcm->num_streams);
return -EINVAL;
}
if (sizeof(*pcm) + pcm->priv.size > size) {
- SNDERR("pcm: wrong private data size %d", pcm->priv.size);
+ snd_error(TOPOLOGY, "pcm: wrong private data size %d", pcm->priv.size);
return -EINVAL;
}
for (i = 0; i < pcm->num_streams; i++) {
stream = &pt->stream[i];
if (pcm->stream[i].size != sizeof(pcm->stream[0])) {
- SNDERR("pcm: unknown stream structure size %d",
- pcm->stream[i].size);
+ snd_error(TOPOLOGY, "pcm: unknown stream structure size %d",
+ pcm->stream[i].size);
+
return -EINVAL;
}
stream->name = pcm->stream[i].name;
cap = &caps[i];
pt->caps[i] = cap;
if (pcm->caps[i].size != sizeof(pcm->caps[0])) {
- SNDERR("pcm: unknown caps structure size %d",
- pcm->caps[i].size);
+ snd_error(TOPOLOGY, "pcm: unknown caps structure size %d",
+ pcm->caps[i].size);
+
return -EINVAL;
}
cap->name = pcm->caps[i].name;
void *bin ATTRIBUTE_UNUSED,
size_t size ATTRIBUTE_UNUSED)
{
- SNDERR("not implemented");
+ snd_error(TOPOLOGY, "not implemented");
return -ENXIO;
}
void *bin ATTRIBUTE_UNUSED,
size_t size ATTRIBUTE_UNUSED)
{
- SNDERR("not implemented");
+ snd_error(TOPOLOGY, "not implemented");
return -ENXIO;
}
link = bin;
if (size < sizeof(*link)) {
- SNDERR("link: small size %d", size);
+ snd_error(TOPOLOGY, "link: small size %d", size);
return -EINVAL;
}
if (sizeof(*link) != link->size) {
- SNDERR("link: unknown element size %d (expected %zd)",
- link->size, sizeof(*link));
+ snd_error(TOPOLOGY, "link: unknown element size %d (expected %zd)",
+ link->size, sizeof(*link));
+
return -EINVAL;
}
if (link->num_streams > SND_SOC_TPLG_STREAM_CONFIG_MAX) {
- SNDERR("link: wrong number of streams %d", link->num_streams);
+ snd_error(TOPOLOGY, "link: wrong number of streams %d", link->num_streams);
return -EINVAL;
}
if (link->num_hw_configs > SND_SOC_TPLG_HW_CONFIG_MAX) {
- SNDERR("link: wrong number of streams %d", link->num_streams);
+ snd_error(TOPOLOGY, "link: wrong number of streams %d", link->num_streams);
return -EINVAL;
}
if (sizeof(*link) + link->priv.size > size) {
- SNDERR("link: wrong private data size %d", link->priv.size);
+ snd_error(TOPOLOGY, "link: wrong private data size %d", link->priv.size);
return -EINVAL;
}
for (i = 0; i < link->num_streams; i++) {
stream = &streams[i];
if (link->stream[i].size != sizeof(link->stream[0])) {
- SNDERR("link: unknown stream structure size %d",
- link->stream[i].size);
+ snd_error(TOPOLOGY, "link: unknown stream structure size %d",
+ link->stream[i].size);
+
return -EINVAL;
}
stream->name = link->stream[i].name;
for (i = 0; i < link->num_hw_configs; i++) {
hw = &hws[i];
if (link->hw_config[i].size != sizeof(link->hw_config[0])) {
- SNDERR("link: unknown hw_config structure size %d",
- link->hw_config[i].size);
+ snd_error(TOPOLOGY, "link: unknown hw_config structure size %d",
+ link->hw_config[i].size);
+
return -EINVAL;
}
hw->id = link->hw_config[i].id;
hw->rx_slots = link->hw_config[i].rx_slots;
hw->tx_channels = link->hw_config[i].tx_channels;
if (hw->tx_channels > SND_SOC_TPLG_MAX_CHAN) {
- SNDERR("link: wrong tx channels %d", hw->tx_channels);
+ snd_error(TOPOLOGY, "link: wrong tx channels %d", hw->tx_channels);
return -EINVAL;
}
for (j = 0; j < hw->tx_channels; j++)
hw->tx_chanmap[j] = link->hw_config[i].tx_chanmap[j];
hw->rx_channels = link->hw_config[i].rx_channels;
if (hw->rx_channels > SND_SOC_TPLG_MAX_CHAN) {
- SNDERR("link: wrong rx channels %d", hw->tx_channels);
+ snd_error(TOPOLOGY, "link: wrong rx channels %d", hw->tx_channels);
return -EINVAL;
}
for (j = 0; j < hw->rx_channels; j++)
if (gindex >= 0 && elem->index != gindex)
continue;
if (tptr->save == NULL && tptr->gsave == NULL) {
- SNDERR("unable to create %s block (no callback)",
- tptr->id);
+ snd_error(TOPOLOGY, "unable to create %s block (no callback)",
+ tptr->id);
+
err = -ENXIO;
goto _err;
}
}
err = tptr->save(tplg, elem, dst, count > 1 ? pfx2 : prefix);
if (err < 0) {
- SNDERR("failed to save %s elements: %s",
- tptr->id, snd_strerror(-err));
+ snd_error(TOPOLOGY, "failed to save %s elements: %s",
+ tptr->id, snd_strerror(-err));
+
goto _err;
}
}
/* always load configuration - check */
err = snd_input_buffer_open(&in, buf.dst, strlen(buf.dst));
if (err < 0) {
- SNDERR("could not create input buffer");
+ snd_error(TOPOLOGY, "could not create input buffer");
goto _err;
}
err = snd_config_load(top, in);
snd_input_close(in);
if (err < 0) {
- SNDERR("could not load configuration");
+ snd_error(TOPOLOGY, "could not load configuration");
snd_config_delete(top);
goto _err;
}
if (flags & SND_TPLG_SAVE_SORT) {
top2 = sort_config(NULL, top);
if (top2 == NULL) {
- SNDERR("could not sort configuration");
+ snd_error(TOPOLOGY, "could not sort configuration");
snd_config_delete(top);
err = -EINVAL;
goto _err;
err = save_config(&buf2, 0, NULL, top);
snd_config_delete(top);
if (err < 0) {
- SNDERR("could not save configuration");
+ snd_error(TOPOLOGY, "could not save configuration");
goto _err;
}
if (strcmp(id, "values") == 0) {
err = parse_text_values(n, elem);
if (err < 0) {
- SNDERR("error: failed to parse text values");
+ snd_error(TOPOLOGY, "error: failed to parse text values");
return err;
}
continue;