mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-10 13:30:01 -05:00
replace SNDMSG,SYSMSG,SNDERR,SYSERR with new log macros
... with interface identifiers Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
492df4bb94
commit
62c8e635dc
82 changed files with 1292 additions and 1201 deletions
|
|
@ -1056,7 +1056,7 @@ int main(int argc, char **argv)
|
|||
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) {
|
||||
|
|
|
|||
|
|
@ -931,7 +931,7 @@ static PyObject *new_helem(struct python_priv *priv, snd_hctl_elem_t *helem)
|
|||
}
|
||||
Py_XDECREF(obj1);
|
||||
} else {
|
||||
SNDERR("Unable to create InternalMixer object");
|
||||
snd_error(MIXER, "Unable to create InternalMixer object");
|
||||
return NULL;
|
||||
}
|
||||
if (obj2) {
|
||||
|
|
@ -1073,7 +1073,7 @@ static int alsa_mixer_simple_pyinit(struct python_priv *priv,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1083,7 +1083,7 @@ static int alsa_mixer_simple_pyinit(struct python_priv *priv,
|
|||
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;
|
||||
|
|
@ -1128,7 +1128,7 @@ int alsa_mixer_simple_finit(snd_mixer_class_t *class,
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,27 +65,27 @@ int mixer_simple_basic_dlopen(snd_mixer_class_t *class,
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ void snd_async_init(void)
|
|||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
@ -135,7 +135,7 @@ int snd_async_add_handler(snd_async_handler_t **handler, int fd,
|
|||
assert(!previous_action.sa_sigaction);
|
||||
err = sigaction(snd_async_signo, &act, &previous_action);
|
||||
if (err < 0) {
|
||||
SYSERR("sigaction");
|
||||
snd_errornum(CORE, "sigaction");
|
||||
return -errno;
|
||||
}
|
||||
}
|
||||
|
|
@ -189,7 +189,7 @@ int snd_async_del_handler(snd_async_handler_t *handler)
|
|||
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));
|
||||
|
|
|
|||
134
src/conf.c
134
src/conf.c
|
|
@ -819,7 +819,7 @@ static int get_char_skip_comments(input_t *input)
|
|||
|
||||
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;
|
||||
}
|
||||
|
|
@ -840,7 +840,7 @@ static int get_char_skip_comments(input_t *input)
|
|||
}
|
||||
|
||||
if (err < 0) {
|
||||
SNDERR("Cannot access file %s", str);
|
||||
snd_error(CORE, "Cannot access file %s", str);
|
||||
free(str);
|
||||
return err;
|
||||
}
|
||||
|
|
@ -1205,7 +1205,7 @@ static int parse_value(snd_config_t **_n, snd_config_t *parent, input_t *input,
|
|||
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 {
|
||||
|
|
@ -1221,7 +1221,7 @@ static int parse_value(snd_config_t **_n, snd_config_t *parent, input_t *input,
|
|||
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 {
|
||||
|
|
@ -1242,7 +1242,7 @@ static int parse_value(snd_config_t **_n, snd_config_t *parent, input_t *input,
|
|||
}
|
||||
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;
|
||||
}
|
||||
|
|
@ -1301,7 +1301,7 @@ static int parse_array_def(snd_config_t *parent, input_t *input, int *idx, int s
|
|||
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;
|
||||
}
|
||||
|
|
@ -1408,7 +1408,7 @@ static int parse_def(snd_config_t *parent, input_t *input, int skip, int overrid
|
|||
}
|
||||
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;
|
||||
|
|
@ -1419,7 +1419,7 @@ static int parse_def(snd_config_t *parent, input_t *input, int skip, int overrid
|
|||
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;
|
||||
}
|
||||
|
|
@ -1446,7 +1446,7 @@ static int parse_def(snd_config_t *parent, input_t *input, int skip, int overrid
|
|||
} else {
|
||||
n = NULL;
|
||||
if (mode == MERGE) {
|
||||
SNDERR("%s does not exists", id);
|
||||
snd_error(CORE, "%s does not exists", id);
|
||||
err = -ENOENT;
|
||||
goto __end;
|
||||
}
|
||||
|
|
@ -1460,7 +1460,7 @@ static int parse_def(snd_config_t *parent, input_t *input, int skip, int overrid
|
|||
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;
|
||||
}
|
||||
|
|
@ -1645,7 +1645,7 @@ int _snd_config_save_node_value(snd_config_t *n, snd_output_t *out,
|
|||
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);
|
||||
|
|
@ -2012,13 +2012,13 @@ int _snd_config_load_with_include(snd_config_t *config, snd_input_t *in,
|
|||
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;
|
||||
}
|
||||
|
|
@ -3565,9 +3565,9 @@ int snd_config_save(snd_config_t *config, snd_output_t *out)
|
|||
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; \
|
||||
|
|
@ -3971,12 +3971,12 @@ static int snd_config_hooks_call(snd_config_t *root, snd_config_t *config, snd_c
|
|||
|
||||
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);
|
||||
|
|
@ -3984,7 +3984,7 @@ static int snd_config_hooks_call(snd_config_t *root, snd_config_t *config, snd_c
|
|||
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;
|
||||
}
|
||||
|
|
@ -3996,7 +3996,7 @@ static int snd_config_hooks_call(snd_config_t *root, snd_config_t *config, snd_c
|
|||
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;
|
||||
|
|
@ -4004,12 +4004,12 @@ static int snd_config_hooks_call(snd_config_t *root, snd_config_t *config, snd_c
|
|||
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) {
|
||||
|
|
@ -4027,10 +4027,10 @@ static int snd_config_hooks_call(snd_config_t *root, snd_config_t *config, snd_c
|
|||
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;
|
||||
}
|
||||
|
|
@ -4041,7 +4041,7 @@ static int snd_config_hooks_call(snd_config_t *root, snd_config_t *config, snd_c
|
|||
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);
|
||||
|
|
@ -4070,7 +4070,7 @@ static int snd_config_hooks(snd_config_t *config, snd_config_t *private_data)
|
|||
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;
|
||||
}
|
||||
|
|
@ -4122,9 +4122,9 @@ static int config_file_open(snd_config_t *root, const char *filename, int merge)
|
|||
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;
|
||||
}
|
||||
|
|
@ -4138,7 +4138,7 @@ static int config_file_load(snd_config_t *root, const char *fn, int errors, int
|
|||
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))
|
||||
|
|
@ -4201,13 +4201,13 @@ static int config_file_load_user_all(snd_config_t *_root, snd_config_t *_file, i
|
|||
|
||||
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);
|
||||
|
|
@ -4279,7 +4279,7 @@ int snd_config_hook_load(snd_config_t *root, snd_config_t *config, snd_config_t
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -4288,15 +4288,15 @@ int snd_config_hook_load(snd_config_t *root, snd_config_t *config, snd_config_t
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -4308,7 +4308,7 @@ int snd_config_hook_load(snd_config_t *root, snd_config_t *config, snd_config_t
|
|||
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;
|
||||
}
|
||||
|
|
@ -4375,18 +4375,18 @@ static int _snd_config_hook_table(snd_config_t *root, snd_config_t *config, snd_
|
|||
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;
|
||||
}
|
||||
|
|
@ -4570,7 +4570,7 @@ int snd_config_update_r(snd_config_t **_top, snd_config_update_t **_update, cons
|
|||
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--;
|
||||
|
|
@ -4630,17 +4630,17 @@ int snd_config_update_r(snd_config_t **_top, snd_config_update_t **_update, cons
|
|||
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;
|
||||
|
|
@ -5127,7 +5127,7 @@ static int _snd_config_evaluate(snd_config_t *src,
|
|||
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);
|
||||
|
|
@ -5135,7 +5135,7 @@ static int _snd_config_evaluate(snd_config_t *src,
|
|||
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;
|
||||
}
|
||||
|
|
@ -5147,7 +5147,7 @@ static int _snd_config_evaluate(snd_config_t *src,
|
|||
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;
|
||||
|
|
@ -5155,12 +5155,12 @@ static int _snd_config_evaluate(snd_config_t *src,
|
|||
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) {
|
||||
|
|
@ -5179,11 +5179,11 @@ static int _snd_config_evaluate(snd_config_t *src,
|
|||
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;
|
||||
|
|
@ -5195,7 +5195,7 @@ static int _snd_config_evaluate(snd_config_t *src,
|
|||
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);
|
||||
|
|
@ -5259,7 +5259,7 @@ static int load_defaults(snd_config_t *subs, snd_config_t *defs)
|
|||
}
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(CORE, "Unknown field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
|
@ -5365,7 +5365,7 @@ static int parse_string(const char **ptr, char **val)
|
|||
int c = **ptr;
|
||||
switch (c) {
|
||||
case '\0':
|
||||
SNDERR("Unterminated string");
|
||||
snd_error(CORE, "Unterminated string");
|
||||
return -EINVAL;
|
||||
case '\\':
|
||||
c = parse_char(ptr);
|
||||
|
|
@ -5502,7 +5502,7 @@ static int parse_args(snd_config_t *subs, const char *str, snd_config_t *defs)
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -5531,11 +5531,11 @@ static int parse_args(snd_config_t *subs, const char *str, snd_config_t *defs)
|
|||
}
|
||||
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;
|
||||
}
|
||||
|
|
@ -5547,7 +5547,7 @@ static int parse_args(snd_config_t *subs, const char *str, snd_config_t *defs)
|
|||
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);
|
||||
|
|
@ -5560,7 +5560,7 @@ static int parse_args(snd_config_t *subs, const char *str, snd_config_t *defs)
|
|||
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);
|
||||
|
|
@ -5573,7 +5573,7 @@ static int parse_args(snd_config_t *subs, const char *str, snd_config_t *defs)
|
|||
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);
|
||||
|
|
@ -5586,7 +5586,7 @@ static int parse_args(snd_config_t *subs, const char *str, snd_config_t *defs)
|
|||
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);
|
||||
|
|
@ -5653,7 +5653,7 @@ int snd_config_expand_custom(snd_config_t *config, snd_config_t *root,
|
|||
|
||||
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;
|
||||
|
|
@ -5685,7 +5685,7 @@ int snd_config_expand(snd_config_t *config, snd_config_t *root, const char *args
|
|||
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);
|
||||
|
|
@ -5697,28 +5697,28 @@ int snd_config_expand(snd_config_t *config, snd_config_t *root, const char *args
|
|||
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;
|
||||
}
|
||||
|
|
@ -5800,7 +5800,7 @@ int snd_config_check_hop(snd_config_t *conf)
|
|||
{
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ int _snd_eval_string(snd_config_t **dst, const char *s,
|
|||
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) {
|
||||
|
|
@ -160,7 +160,7 @@ int _snd_eval_string(snd_config_t **dst, const char *s,
|
|||
case '|':
|
||||
case '&': op = c; break;
|
||||
default:
|
||||
SNDERR("unknown operation '%c'", c);
|
||||
snd_error(CORE, "unknown operation '%c'", c);
|
||||
return -EINVAL;
|
||||
}
|
||||
pos = RIGHT;
|
||||
|
|
@ -225,7 +225,7 @@ int _snd_eval_string(snd_config_t **dst, const char *s,
|
|||
pos = op == LEFT ? OP : END;
|
||||
}
|
||||
if (pos != OP && pos != END) {
|
||||
SNDERR("incomplete expression '%s'", save);
|
||||
snd_error(CORE, "incomplete expression '%s'", save);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -269,7 +269,7 @@ int snd_config_evaluate_string(snd_config_t **dst, const char *s,
|
|||
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);
|
||||
}
|
||||
|
|
|
|||
128
src/confmisc.c
128
src/confmisc.c
|
|
@ -127,14 +127,14 @@ int snd_config_get_bool(const snd_config_t *conf)
|
|||
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);
|
||||
|
|
@ -157,12 +157,12 @@ int snd_config_get_card(const snd_config_t *conf)
|
|||
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;
|
||||
|
|
@ -213,14 +213,14 @@ int snd_config_get_ctl_iface(const snd_config_t *conf)
|
|||
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);
|
||||
|
|
@ -263,27 +263,27 @@ int snd_func_getenv(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
|
|||
|
||||
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 {
|
||||
|
|
@ -295,13 +295,13 @@ int snd_func_getenv(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
|
|||
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;
|
||||
}
|
||||
|
|
@ -309,7 +309,7 @@ int snd_func_getenv(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
|
|||
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;
|
||||
}
|
||||
|
|
@ -414,12 +414,12 @@ int snd_func_concat(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
|
|||
|
||||
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 {
|
||||
|
|
@ -433,7 +433,7 @@ int snd_func_concat(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
|
|||
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;
|
||||
}
|
||||
|
|
@ -441,7 +441,7 @@ int snd_func_concat(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
|
|||
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;
|
||||
}
|
||||
|
|
@ -462,7 +462,7 @@ int snd_func_concat(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
|
|||
}
|
||||
} while (hit);
|
||||
if (res == NULL) {
|
||||
SNDERR("empty string is not accepted");
|
||||
snd_error(CORE, "empty string is not accepted");
|
||||
err = -EINVAL;
|
||||
goto __error;
|
||||
}
|
||||
|
|
@ -493,12 +493,12 @@ static int snd_func_iops(snd_config_t **dst,
|
|||
|
||||
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 {
|
||||
|
|
@ -511,7 +511,7 @@ static int snd_func_iops(snd_config_t **dst,
|
|||
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;
|
||||
}
|
||||
|
|
@ -519,7 +519,7 @@ static int snd_func_iops(snd_config_t **dst,
|
|||
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;
|
||||
}
|
||||
|
|
@ -660,7 +660,7 @@ static int _snd_func_private_data(snd_config_t **dst, snd_config_t *src,
|
|||
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;
|
||||
|
|
@ -695,7 +695,7 @@ int snd_func_private_string(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNU
|
|||
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);
|
||||
|
|
@ -736,7 +736,7 @@ int snd_func_private_integer(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UN
|
|||
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);
|
||||
|
|
@ -759,12 +759,12 @@ int snd_determine_driver(int card, char **driver)
|
|||
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));
|
||||
|
|
@ -808,12 +808,12 @@ int snd_func_private_card_driver(snd_config_t **dst, snd_config_t *root ATTRIBUT
|
|||
|
||||
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)
|
||||
|
|
@ -837,22 +837,22 @@ static int parse_card(snd_config_t *root, snd_config_t *src,
|
|||
|
||||
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;
|
||||
}
|
||||
|
|
@ -959,12 +959,12 @@ int snd_func_card_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
|
|||
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);
|
||||
|
|
@ -1010,12 +1010,12 @@ int snd_func_card_name(snd_config_t **dst, snd_config_t *root,
|
|||
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);
|
||||
|
|
@ -1075,41 +1075,41 @@ int snd_func_pcm_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src, v
|
|||
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);
|
||||
|
|
@ -1158,53 +1158,53 @@ int snd_func_pcm_args_by_class(snd_config_t **dst, snd_config_t *root, snd_confi
|
|||
|
||||
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)
|
||||
|
|
@ -1268,18 +1268,18 @@ int snd_func_private_pcm_subdevice(snd_config_t **dst, snd_config_t *root ATTRIB
|
|||
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);
|
||||
|
|
@ -1326,12 +1326,12 @@ int snd_func_refer(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -1339,25 +1339,25 @@ int snd_func_refer(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
|
|||
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);
|
||||
|
|
@ -1374,7 +1374,7 @@ int snd_func_refer(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
|
|||
} 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);
|
||||
|
|
|
|||
|
|
@ -1367,7 +1367,7 @@ int snd_ctl_wait(snd_ctl_t *ctl, int timeout)
|
|||
|
||||
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);
|
||||
|
|
@ -1375,7 +1375,7 @@ int snd_ctl_wait(snd_ctl_t *ctl, int timeout)
|
|||
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 (;;) {
|
||||
|
|
@ -1458,30 +1458,30 @@ static int snd_ctl_open_conf(snd_ctl_t **ctlp, const char *name,
|
|||
#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;
|
||||
}
|
||||
|
|
@ -1495,7 +1495,7 @@ static int snd_ctl_open_conf(snd_ctl_t **ctlp, const char *name,
|
|||
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;
|
||||
|
|
@ -1503,12 +1503,12 @@ static int snd_ctl_open_conf(snd_ctl_t **ctlp, const char *name,
|
|||
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;
|
||||
}
|
||||
|
|
@ -1572,7 +1572,7 @@ static int snd_ctl_open_noupdate(snd_ctl_t **ctlp, snd_config_t *root,
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -87,11 +87,11 @@ int _snd_ctl_empty_open(snd_ctl_t **handlep, const char *name ATTRIBUTE_UNUSED,
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -560,7 +560,7 @@ SND_CTL_PLUGIN_DEFINE_FUNC(myctl)
|
|||
....
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(CONTROL, "Unknown field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -712,7 +712,7 @@ int snd_ctl_ext_create(snd_ctl_ext_t *ext, const char *name, int mode)
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ static int snd_ctl_hw_nonblock(snd_ctl_t *handle, int nonblock)
|
|||
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)
|
||||
|
|
@ -79,7 +79,7 @@ static int snd_ctl_hw_nonblock(snd_ctl_t *handle, int 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;
|
||||
|
|
@ -92,7 +92,7 @@ static int snd_ctl_hw_async(snd_ctl_t *ctl, int sig, pid_t pid)
|
|||
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)
|
||||
|
|
@ -100,17 +100,17 @@ static int snd_ctl_hw_async(snd_ctl_t *ctl, int sig, pid_t pid)
|
|||
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;
|
||||
|
|
@ -120,7 +120,7 @@ static int snd_ctl_hw_subscribe_events(snd_ctl_t *handle, int subscribe)
|
|||
{
|
||||
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;
|
||||
|
|
@ -130,7 +130,7 @@ static int snd_ctl_hw_card_info(snd_ctl_t *handle, snd_ctl_card_info_t *info)
|
|||
{
|
||||
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;
|
||||
|
|
@ -375,8 +375,9 @@ static int snd_ctl_hw_read(snd_ctl_t *handle, snd_ctl_event_t *event)
|
|||
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;
|
||||
|
|
@ -437,7 +438,7 @@ int snd_ctl_hw_open(snd_ctl_t **handle, const char *name, int card, int mode)
|
|||
*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);
|
||||
|
|
|
|||
|
|
@ -1242,27 +1242,27 @@ static int parse_remap(snd_ctl_remap_t *priv, snd_config_t *conf)
|
|||
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);
|
||||
|
|
@ -1321,7 +1321,7 @@ static int add_chn_to_map(struct snd_ctl_map_ctl *mctl, long idx, long src_idx,
|
|||
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) {
|
||||
|
|
@ -1350,7 +1350,7 @@ static int add_chn_to_map_array(struct snd_ctl_map_ctl *mctl, const char *dst_id
|
|||
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);
|
||||
|
|
@ -1383,7 +1383,7 @@ static int parse_map_vindex(struct snd_ctl_map_ctl *mctl, snd_config_t *conf)
|
|||
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);
|
||||
|
|
@ -1430,7 +1430,7 @@ static int parse_map1(snd_ctl_map_t *map, snd_config_t *conf)
|
|||
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);
|
||||
|
|
@ -1461,7 +1461,7 @@ static int parse_map(snd_ctl_remap_t *priv, snd_config_t *conf)
|
|||
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);
|
||||
|
|
@ -1508,14 +1508,14 @@ static int parse_sync1(snd_ctl_remap_t *priv, unsigned int count, snd_config_t *
|
|||
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++;
|
||||
|
|
@ -1542,12 +1542,12 @@ static int parse_sync_compound(snd_ctl_remap_t *priv, snd_config_t *conf)
|
|||
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;
|
||||
|
|
@ -1555,7 +1555,7 @@ static int parse_sync_compound(snd_ctl_remap_t *priv, snd_config_t *conf)
|
|||
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);
|
||||
|
|
@ -1591,7 +1591,7 @@ static int parse_sync(snd_ctl_remap_t *priv, snd_config_t *conf)
|
|||
} 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);
|
||||
|
|
@ -1817,11 +1817,11 @@ int _snd_ctl_remap_open(snd_ctl_t **handlep, char *name, snd_config_t *root, snd
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ static int snd_ctl_shm_action(snd_ctl_t *ctl)
|
|||
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;
|
||||
|
|
@ -79,7 +79,7 @@ static int snd_ctl_shm_action_fd(snd_ctl_t *ctl, int *fd)
|
|||
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;
|
||||
|
|
@ -448,7 +448,7 @@ int snd_ctl_shm_open(snd_ctl_t **handlep, const char *name, const char *sockname
|
|||
|
||||
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;
|
||||
|
|
@ -463,23 +463,23 @@ int snd_ctl_shm_open(snd_ctl_t **handlep, const char *name, const char *sockname
|
|||
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;
|
||||
}
|
||||
|
|
@ -546,7 +546,7 @@ int _snd_ctl_shm_open(snd_ctl_t **handlep, char *name, snd_config_t *root, snd_c
|
|||
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;
|
||||
|
|
@ -554,29 +554,29 @@ int _snd_ctl_shm_open(snd_ctl_t **handlep, char *name, snd_config_t *root, snd_c
|
|||
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;
|
||||
}
|
||||
|
|
@ -592,7 +592,7 @@ int _snd_ctl_shm_open(snd_ctl_t **handlep, char *name, snd_config_t *root, snd_c
|
|||
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;
|
||||
|
|
@ -600,18 +600,18 @@ int _snd_ctl_shm_open(snd_ctl_t **handlep, char *name, snd_config_t *root, snd_c
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ int __snd_pcm_info_eld_fixup(snd_pcm_info_t * info)
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ int __snd_pcm_info_eld_fixup(snd_pcm_info_t * info)
|
|||
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 */
|
||||
|
|
@ -78,7 +78,7 @@ int __snd_pcm_info_eld_fixup(snd_pcm_info_t * info)
|
|||
/* 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);
|
||||
|
|
|
|||
|
|
@ -680,7 +680,7 @@ int snd_hctl_wait(snd_hctl_t *hctl, int timeout)
|
|||
|
||||
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);
|
||||
|
|
@ -689,7 +689,7 @@ int snd_hctl_wait(snd_hctl_t *hctl, int timeout)
|
|||
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 {
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ static int try_config(snd_config_t *config,
|
|||
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;
|
||||
}
|
||||
|
|
@ -309,7 +309,7 @@ static int try_config(snd_config_t *config,
|
|||
|
||||
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;
|
||||
}
|
||||
|
|
@ -332,7 +332,7 @@ static int try_config(snd_config_t *config,
|
|||
}
|
||||
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;
|
||||
}
|
||||
|
|
@ -341,7 +341,7 @@ static int try_config(snd_config_t *config,
|
|||
}
|
||||
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;
|
||||
}
|
||||
|
|
@ -351,7 +351,7 @@ static int try_config(snd_config_t *config,
|
|||
}
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,13 +93,13 @@ int snd_sctl_install(snd_sctl_t *h)
|
|||
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);
|
||||
|
|
@ -166,7 +166,7 @@ int snd_sctl_install(snd_sctl_t *h)
|
|||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -188,7 +188,7 @@ int snd_sctl_remove(snd_sctl_t *h)
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -205,7 +205,7 @@ int snd_sctl_remove(snd_sctl_t *h)
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -235,7 +235,7 @@ static int snd_config_get_ctl_elem_enumerated(snd_config_t *n, snd_ctl_t *ctl,
|
|||
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)
|
||||
|
|
@ -293,7 +293,7 @@ static int snd_config_get_ctl_elem_value(snd_config_t *conf,
|
|||
case SND_CTL_ELEM_TYPE_IEC958:
|
||||
break;
|
||||
default:
|
||||
SNDERR("Unknown control type: %d", type);
|
||||
snd_error(CONTROL, "Unknown control type: %d", type);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
|
@ -311,7 +311,7 @@ static int snd_config_get_ctl_elem_value(snd_config_t *conf,
|
|||
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) {
|
||||
|
|
@ -340,7 +340,7 @@ static int snd_config_get_ctl_elem_value(snd_config_t *conf,
|
|||
break;
|
||||
}
|
||||
if (snd_config_get_type(conf) != SND_CONFIG_TYPE_COMPOUND) {
|
||||
SNDERR("bad value type");
|
||||
snd_error(CONTROL, "bad value type");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -351,7 +351,7 @@ static int snd_config_get_ctl_elem_value(snd_config_t *conf,
|
|||
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) {
|
||||
|
|
@ -424,11 +424,11 @@ static int add_elem(snd_sctl_t *h, snd_config_t *_conf, snd_config_t *private_da
|
|||
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;
|
||||
|
|
@ -436,28 +436,28 @@ static int add_elem(snd_sctl_t *h, snd_config_t *_conf, snd_config_t *private_da
|
|||
}
|
||||
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;
|
||||
|
|
@ -498,16 +498,16 @@ static int add_elem(snd_sctl_t *h, snd_config_t *_conf, snd_config_t *private_da
|
|||
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;
|
||||
}
|
||||
|
|
@ -544,7 +544,7 @@ static int add_elem(snd_sctl_t *h, snd_config_t *_conf, snd_config_t *private_da
|
|||
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)
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ int snd_tlv_parse_dB_info(unsigned int *tlv,
|
|||
/* 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;
|
||||
}
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ int snd_tlv_parse_dB_info(unsigned int *tlv,
|
|||
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) {
|
||||
|
|
@ -110,11 +110,11 @@ int snd_tlv_parse_dB_info(unsigned int *tlv,
|
|||
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;
|
||||
|
|
|
|||
15
src/dlmisc.c
15
src/dlmisc.c
|
|
@ -223,7 +223,7 @@ static int snd_dlsym_verify(void *handle, const char *name, const char *version)
|
|||
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;
|
||||
|
|
@ -336,17 +336,20 @@ snd_dlobj_cache_get0(const char *lib, const char *name,
|
|||
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));
|
||||
|
|
|
|||
|
|
@ -54,30 +54,30 @@ static int snd_hwdep_open_conf(snd_hwdep_t **hwdep,
|
|||
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;
|
||||
}
|
||||
|
|
@ -91,7 +91,7 @@ static int snd_hwdep_open_conf(snd_hwdep_t **hwdep,
|
|||
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;
|
||||
|
|
@ -99,12 +99,12 @@ static int snd_hwdep_open_conf(snd_hwdep_t **hwdep,
|
|||
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;
|
||||
}
|
||||
|
|
@ -121,10 +121,10 @@ static int snd_hwdep_open_conf(snd_hwdep_t **hwdep,
|
|||
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;
|
||||
}
|
||||
|
|
@ -148,7 +148,7 @@ static int snd_hwdep_open_noupdate(snd_hwdep_t **hwdep, snd_config_t *root, cons
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ int _snd_hwdep_hw_open(snd_hwdep_t **hwdep, char *name,
|
|||
return err;
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unexpected field %s", id);
|
||||
snd_error(HWDEP, "Unexpected field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (card < 0)
|
||||
|
|
|
|||
|
|
@ -82,20 +82,20 @@ static int try_open(snd_mixer_class_t *class, const char *lib)
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -129,20 +129,20 @@ static int try_open_full(snd_mixer_class_t *class, snd_mixer_t *mixer,
|
|||
/* 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;
|
||||
}
|
||||
}
|
||||
|
|
@ -308,13 +308,13 @@ int snd_mixer_simple_basic_register(snd_mixer_t *mixer,
|
|||
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);
|
||||
|
|
@ -324,7 +324,7 @@ int snd_mixer_simple_basic_register(snd_mixer_t *mixer,
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -1552,9 +1552,11 @@ static int simple_add1(snd_mixer_class_t *class, const char *name,
|
|||
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),
|
||||
|
|
|
|||
286
src/pcm/pcm.c
286
src/pcm/pcm.c
|
|
@ -1003,11 +1003,11 @@ int snd_pcm_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
|
|||
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
|
||||
|
|
@ -1016,7 +1016,7 @@ int snd_pcm_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
|
|||
*/
|
||||
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
|
||||
|
|
@ -1110,7 +1110,7 @@ int snd_pcm_hwsync(snd_pcm_t *pcm)
|
|||
|
||||
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);
|
||||
|
|
@ -1155,7 +1155,7 @@ int snd_pcm_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
|
|||
|
||||
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);
|
||||
|
|
@ -1184,7 +1184,7 @@ int snd_pcm_resume(snd_pcm_t *pcm)
|
|||
|
||||
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 */
|
||||
|
|
@ -1213,7 +1213,7 @@ int snd_pcm_htimestamp(snd_pcm_t *pcm, snd_pcm_uframes_t *avail, snd_htimestamp_
|
|||
|
||||
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);
|
||||
|
|
@ -1238,7 +1238,7 @@ int snd_pcm_prepare(snd_pcm_t *pcm)
|
|||
|
||||
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);
|
||||
|
|
@ -1268,7 +1268,7 @@ int snd_pcm_reset(snd_pcm_t *pcm)
|
|||
|
||||
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);
|
||||
|
|
@ -1293,7 +1293,7 @@ int snd_pcm_start(snd_pcm_t *pcm)
|
|||
|
||||
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);
|
||||
|
|
@ -1324,7 +1324,7 @@ int snd_pcm_drop(snd_pcm_t *pcm)
|
|||
|
||||
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) |
|
||||
|
|
@ -1361,7 +1361,7 @@ int snd_pcm_drain(snd_pcm_t *pcm)
|
|||
|
||||
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));
|
||||
|
|
@ -1395,7 +1395,7 @@ int snd_pcm_pause(snd_pcm_t *pcm, int enable)
|
|||
|
||||
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);
|
||||
|
|
@ -1428,7 +1428,7 @@ snd_pcm_sframes_t snd_pcm_rewindable(snd_pcm_t *pcm)
|
|||
|
||||
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);
|
||||
|
|
@ -1459,7 +1459,7 @@ snd_pcm_sframes_t snd_pcm_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
|
|||
|
||||
assert(pcm);
|
||||
if (CHECK_SANITY(! pcm->setup)) {
|
||||
SNDMSG("PCM not set up");
|
||||
snd_check(PCM, "PCM not set up");
|
||||
return -EIO;
|
||||
}
|
||||
if (frames == 0)
|
||||
|
|
@ -1494,7 +1494,7 @@ snd_pcm_sframes_t snd_pcm_forwardable(snd_pcm_t *pcm)
|
|||
|
||||
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);
|
||||
|
|
@ -1529,7 +1529,7 @@ snd_pcm_sframes_t snd_pcm_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
|
|||
|
||||
assert(pcm);
|
||||
if (CHECK_SANITY(! pcm->setup)) {
|
||||
SNDMSG("PCM not set up");
|
||||
snd_check(PCM, "PCM not set up");
|
||||
return -EIO;
|
||||
}
|
||||
if (frames == 0)
|
||||
|
|
@ -1573,11 +1573,11 @@ snd_pcm_sframes_t snd_pcm_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_ufr
|
|||
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);
|
||||
|
|
@ -1612,11 +1612,11 @@ snd_pcm_sframes_t snd_pcm_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t
|
|||
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);
|
||||
|
|
@ -1651,11 +1651,11 @@ snd_pcm_sframes_t snd_pcm_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t
|
|||
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);
|
||||
|
|
@ -1690,11 +1690,11 @@ snd_pcm_sframes_t snd_pcm_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t s
|
|||
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);
|
||||
|
|
@ -1774,7 +1774,7 @@ static int __snd_pcm_poll_descriptors(snd_pcm_t *pcm, struct pollfd *pfds,
|
|||
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) {
|
||||
|
|
@ -2340,7 +2340,7 @@ int snd_pcm_dump_hw_setup(snd_pcm_t *pcm, snd_output_t *out)
|
|||
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));
|
||||
|
|
@ -2370,7 +2370,7 @@ int snd_pcm_dump_sw_setup(snd_pcm_t *pcm, snd_output_t *out)
|
|||
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));
|
||||
|
|
@ -2449,7 +2449,7 @@ snd_pcm_sframes_t snd_pcm_bytes_to_frames(snd_pcm_t *pcm, ssize_t bytes)
|
|||
{
|
||||
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;
|
||||
|
|
@ -2465,7 +2465,7 @@ ssize_t snd_pcm_frames_to_bytes(snd_pcm_t *pcm, snd_pcm_sframes_t frames)
|
|||
{
|
||||
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;
|
||||
|
|
@ -2481,7 +2481,7 @@ long snd_pcm_bytes_to_samples(snd_pcm_t *pcm, ssize_t bytes)
|
|||
{
|
||||
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;
|
||||
|
|
@ -2497,7 +2497,7 @@ ssize_t snd_pcm_samples_to_bytes(snd_pcm_t *pcm, long samples)
|
|||
{
|
||||
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;
|
||||
|
|
@ -2546,7 +2546,7 @@ int snd_async_add_pcm_handler(snd_async_handler_t **handler, snd_pcm_t *pcm,
|
|||
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;
|
||||
|
|
@ -2582,29 +2582,29 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
}
|
||||
|
|
@ -2618,7 +2618,7 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
|
|
@ -2626,12 +2626,12 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
}
|
||||
|
|
@ -2719,7 +2719,7 @@ static int snd_pcm_open_noupdate(snd_pcm_t **pcmp, snd_config_t *root,
|
|||
|
||||
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)
|
||||
|
|
@ -2972,7 +2972,7 @@ int snd_pcm_wait_nocheck(snd_pcm_t *pcm, int timeout)
|
|||
|
||||
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);
|
||||
|
|
@ -2980,7 +2980,7 @@ int snd_pcm_wait_nocheck(snd_pcm_t *pcm, int timeout)
|
|||
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)
|
||||
|
|
@ -2988,7 +2988,7 @@ int snd_pcm_wait_nocheck(snd_pcm_t *pcm, int timeout)
|
|||
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);
|
||||
|
|
@ -3078,7 +3078,7 @@ snd_pcm_sframes_t snd_pcm_avail(snd_pcm_t *pcm)
|
|||
|
||||
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);
|
||||
|
|
@ -3111,7 +3111,7 @@ int snd_pcm_avail_delay(snd_pcm_t *pcm,
|
|||
|
||||
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);
|
||||
|
|
@ -3251,7 +3251,7 @@ int snd_pcm_area_silence(const snd_pcm_channel_area_t *dst_area, snd_pcm_uframes
|
|||
break;
|
||||
}
|
||||
default:
|
||||
SNDMSG("invalid format width %d", width);
|
||||
snd_check(PCM, "invalid format width %d", width);
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -3421,7 +3421,7 @@ int snd_pcm_area_copy(const snd_pcm_channel_area_t *dst_area, snd_pcm_uframes_t
|
|||
break;
|
||||
}
|
||||
default:
|
||||
SNDMSG("invalid format width %d", width);
|
||||
snd_check(PCM, "invalid format width %d", width);
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -3446,11 +3446,11 @@ int snd_pcm_areas_copy(const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_
|
|||
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) {
|
||||
|
|
@ -3589,7 +3589,7 @@ int snd_pcm_hw_params_can_mmap_sample_resolution(const snd_pcm_hw_params_t *para
|
|||
{
|
||||
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);
|
||||
|
|
@ -3609,7 +3609,7 @@ int snd_pcm_hw_params_is_double(const snd_pcm_hw_params_t *params)
|
|||
{
|
||||
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);
|
||||
|
|
@ -3629,7 +3629,7 @@ int snd_pcm_hw_params_is_batch(const snd_pcm_hw_params_t *params)
|
|||
{
|
||||
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);
|
||||
|
|
@ -3649,7 +3649,7 @@ int snd_pcm_hw_params_is_block_transfer(const snd_pcm_hw_params_t *params)
|
|||
{
|
||||
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);
|
||||
|
|
@ -3669,7 +3669,7 @@ int snd_pcm_hw_params_is_monotonic(const snd_pcm_hw_params_t *params)
|
|||
{
|
||||
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);
|
||||
|
|
@ -3689,7 +3689,7 @@ int snd_pcm_hw_params_can_overrange(const snd_pcm_hw_params_t *params)
|
|||
{
|
||||
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);
|
||||
|
|
@ -3709,7 +3709,7 @@ int snd_pcm_hw_params_can_pause(const snd_pcm_hw_params_t *params)
|
|||
{
|
||||
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);
|
||||
|
|
@ -3729,7 +3729,7 @@ int snd_pcm_hw_params_can_resume(const snd_pcm_hw_params_t *params)
|
|||
{
|
||||
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);
|
||||
|
|
@ -3749,7 +3749,7 @@ int snd_pcm_hw_params_is_half_duplex(const snd_pcm_hw_params_t *params)
|
|||
{
|
||||
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);
|
||||
|
|
@ -3769,7 +3769,7 @@ int snd_pcm_hw_params_is_joint_duplex(const snd_pcm_hw_params_t *params)
|
|||
{
|
||||
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);
|
||||
|
|
@ -3789,7 +3789,7 @@ int snd_pcm_hw_params_can_sync_start(const snd_pcm_hw_params_t *params)
|
|||
{
|
||||
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);
|
||||
|
|
@ -3805,7 +3805,7 @@ int snd_pcm_hw_params_can_disable_period_wakeup(const snd_pcm_hw_params_t *param
|
|||
{
|
||||
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);
|
||||
|
|
@ -3828,7 +3828,7 @@ int snd_pcm_hw_params_is_perfect_drain(const snd_pcm_hw_params_t *params)
|
|||
{
|
||||
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);
|
||||
|
|
@ -3866,7 +3866,7 @@ int snd_pcm_hw_params_supports_audio_ts_type(const snd_pcm_hw_params_t *params,
|
|||
{
|
||||
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) {
|
||||
|
|
@ -3903,7 +3903,7 @@ int snd_pcm_hw_params_get_rate_numden(const snd_pcm_hw_params_t *params,
|
|||
{
|
||||
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;
|
||||
|
|
@ -3933,7 +3933,7 @@ int snd_pcm_hw_params_get_sbits(const snd_pcm_hw_params_t *params)
|
|||
{
|
||||
assert(params);
|
||||
if (CHECK_SANITY(params->msbits == 0)) {
|
||||
SNDMSG("invalid msbits value");
|
||||
snd_check(PCM, "invalid msbits value");
|
||||
return -EINVAL;
|
||||
}
|
||||
return params->msbits;
|
||||
|
|
@ -3952,7 +3952,7 @@ int snd_pcm_hw_params_get_fifo_size(const snd_pcm_hw_params_t *params)
|
|||
{
|
||||
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;
|
||||
|
|
@ -6395,7 +6395,7 @@ int snd_pcm_sw_params_current(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
|
|||
{
|
||||
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 */
|
||||
|
|
@ -6498,7 +6498,7 @@ int snd_pcm_sw_params_set_start_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params
|
|||
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;
|
||||
|
|
@ -6546,7 +6546,7 @@ int snd_pcm_sw_params_set_xrun_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params,
|
|||
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;
|
||||
|
|
@ -6587,7 +6587,7 @@ int snd_pcm_sw_params_set_tstamp_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *param
|
|||
{
|
||||
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;
|
||||
|
|
@ -6622,7 +6622,7 @@ int snd_pcm_sw_params_set_tstamp_type(snd_pcm_t *pcm, snd_pcm_sw_params_t *param
|
|||
{
|
||||
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;
|
||||
|
|
@ -6893,8 +6893,9 @@ int snd_pcm_sw_params_set_silence_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t
|
|||
{
|
||||
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;
|
||||
|
|
@ -6951,8 +6952,9 @@ int snd_pcm_sw_params_set_silence_size(snd_pcm_t *pcm, snd_pcm_sw_params_t *para
|
|||
{
|
||||
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;
|
||||
|
|
@ -7566,13 +7568,15 @@ snd_pcm_sframes_t __snd_pcm_mmap_commit(snd_pcm_t *pcm,
|
|||
{
|
||||
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)
|
||||
|
|
@ -7831,13 +7835,13 @@ int snd_pcm_slave_conf(snd_config_t *root, snd_config_t *conf,
|
|||
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;
|
||||
}
|
||||
|
|
@ -7877,7 +7881,7 @@ int snd_pcm_slave_conf(snd_config_t *root, snd_config_t *conf,
|
|||
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) &&
|
||||
|
|
@ -7887,7 +7891,7 @@ int snd_pcm_slave_conf(snd_config_t *root, snd_config_t *conf,
|
|||
}
|
||||
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;
|
||||
}
|
||||
|
|
@ -7914,18 +7918,18 @@ int snd_pcm_slave_conf(snd_config_t *root, snd_config_t *conf,
|
|||
}
|
||||
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;
|
||||
}
|
||||
|
|
@ -8779,10 +8783,10 @@ int snd_pcm_recover(snd_pcm_t *pcm, int err, int silent)
|
|||
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;
|
||||
|
|
@ -8794,7 +8798,7 @@ int snd_pcm_recover(snd_pcm_t *pcm, int err, int silent)
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -8833,36 +8837,41 @@ int snd_pcm_set_params(snd_pcm_t *pcm,
|
|||
/* 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 */
|
||||
|
|
@ -8870,13 +8879,15 @@ int snd_pcm_set_params(snd_pcm_t *pcm,
|
|||
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 */
|
||||
|
|
@ -8891,30 +8902,34 @@ int snd_pcm_set_params(snd_pcm_t *pcm,
|
|||
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 {
|
||||
|
|
@ -8922,15 +8937,17 @@ int snd_pcm_set_params(snd_pcm_t *pcm,
|
|||
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 */
|
||||
|
|
@ -8938,31 +8955,35 @@ int snd_pcm_set_params(snd_pcm_t *pcm,
|
|||
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;
|
||||
}
|
||||
/*
|
||||
|
|
@ -8972,8 +8993,9 @@ int snd_pcm_set_params(snd_pcm_t *pcm,
|
|||
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;
|
||||
}
|
||||
/*
|
||||
|
|
@ -8982,15 +9004,17 @@ int snd_pcm_set_params(snd_pcm_t *pcm,
|
|||
*/
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -650,11 +650,11 @@ int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name,
|
|||
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,
|
||||
|
|
@ -664,7 +664,7 @@ int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name,
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -525,11 +525,11 @@ int _snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name,
|
|||
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,
|
||||
|
|
@ -539,7 +539,7 @@ int _snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name,
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -98,12 +98,13 @@ int _snd_pcm_asym_open(snd_pcm_t **pcmp, const char *name ATTRIBUTE_UNUSED,
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -278,11 +278,11 @@ int _snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name,
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ static int make_local_socket(const char *filename, int server, mode_t ipc_perm,
|
|||
sock = socket(PF_LOCAL, SOCK_STREAM, 0);
|
||||
if (sock < 0) {
|
||||
int result = -errno;
|
||||
SYSERR("socket failed");
|
||||
snd_errornum(PCM, "socket failed");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -225,13 +225,13 @@ static int make_local_socket(const char *filename, int server, mode_t ipc_perm,
|
|||
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;
|
||||
|
|
@ -239,7 +239,7 @@ static int make_local_socket(const char *filename, int server, mode_t ipc_perm,
|
|||
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;
|
||||
|
|
@ -249,7 +249,7 @@ static int make_local_socket(const char *filename, int server, mode_t ipc_perm,
|
|||
} 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;
|
||||
}
|
||||
|
|
@ -585,7 +585,7 @@ int snd_pcm_direct_slave_recover(snd_pcm_direct_t *direct)
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -595,7 +595,7 @@ int snd_pcm_direct_slave_recover(snd_pcm_direct_t *direct)
|
|||
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;
|
||||
|
|
@ -621,11 +621,11 @@ int snd_pcm_direct_slave_recover(snd_pcm_direct_t *direct)
|
|||
|
||||
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;
|
||||
|
|
@ -641,11 +641,11 @@ int snd_pcm_direct_slave_recover(snd_pcm_direct_t *direct)
|
|||
|
||||
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;
|
||||
|
|
@ -653,7 +653,7 @@ int snd_pcm_direct_slave_recover(snd_pcm_direct_t *direct)
|
|||
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;
|
||||
|
|
@ -727,7 +727,7 @@ int snd_pcm_direct_poll_descriptors(snd_pcm_t *pcm, struct pollfd *pfds,
|
|||
unsigned int space)
|
||||
{
|
||||
if (pcm->poll_fd < 0) {
|
||||
SNDMSG("poll_fd < 0");
|
||||
snd_check(PCM, "poll_fd < 0");
|
||||
return -EIO;
|
||||
}
|
||||
if (space >= 1 && pfds) {
|
||||
|
|
@ -845,7 +845,7 @@ static int hw_param_interval_refine_one(snd_pcm_hw_params_t *params,
|
|||
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))
|
||||
|
|
@ -910,7 +910,7 @@ int snd_pcm_direct_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
|||
#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))
|
||||
|
|
@ -918,7 +918,7 @@ int snd_pcm_direct_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
|||
}
|
||||
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),
|
||||
|
|
@ -928,7 +928,7 @@ int snd_pcm_direct_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
|||
//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);
|
||||
|
|
@ -1203,12 +1203,12 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
|
|||
|
||||
__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,
|
||||
|
|
@ -1217,7 +1217,7 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -1254,7 +1254,7 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
|
|||
&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;
|
||||
|
|
@ -1262,13 +1262,13 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1277,14 +1277,14 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
|
|||
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 {
|
||||
|
|
@ -1295,7 +1295,7 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
|
|||
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) {
|
||||
|
|
@ -1303,7 +1303,7 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
|
|||
&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;
|
||||
}
|
||||
}
|
||||
|
|
@ -1313,7 +1313,7 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
|
|||
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) {
|
||||
|
|
@ -1325,14 +1325,14 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1356,18 +1356,18 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1378,7 +1378,7 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1386,7 +1386,7 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -1397,12 +1397,12 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1410,7 +1410,7 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1423,12 +1423,12 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
|
|||
|
||||
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);
|
||||
|
|
@ -1476,7 +1476,7 @@ int snd_pcm_direct_initialize_poll_fd(snd_pcm_direct_t *dmix)
|
|||
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",
|
||||
|
|
@ -1491,13 +1491,13 @@ int snd_pcm_direct_initialize_poll_fd(snd_pcm_direct_t *dmix)
|
|||
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);
|
||||
|
|
@ -1598,7 +1598,7 @@ int snd_pcm_direct_open_secondary_client(snd_pcm_t **spcmp, snd_pcm_direct_t *dm
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1616,7 +1616,7 @@ int snd_pcm_direct_open_secondary_client(snd_pcm_t **spcmp, snd_pcm_direct_t *dm
|
|||
|
||||
ret = snd_pcm_mmap(spcm);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to mmap channels");
|
||||
snd_error(PCM, "unable to mmap channels");
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -1643,7 +1643,7 @@ int snd_pcm_direct_initialize_secondary_slave(snd_pcm_direct_t *dmix,
|
|||
|
||||
ret = snd_pcm_mmap(spcm);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to mmap channels");
|
||||
snd_error(PCM, "unable to mmap channels");
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -1666,7 +1666,7 @@ int snd_pcm_direct_set_timer_params(snd_pcm_direct_t *dmix)
|
|||
}
|
||||
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;
|
||||
|
|
@ -1729,7 +1729,7 @@ int snd_pcm_direct_parse_bindings(snd_pcm_direct_t *dmix,
|
|||
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) {
|
||||
|
|
@ -1740,7 +1740,7 @@ int snd_pcm_direct_parse_bindings(snd_pcm_direct_t *dmix,
|
|||
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)
|
||||
|
|
@ -1749,7 +1749,7 @@ int snd_pcm_direct_parse_bindings(snd_pcm_direct_t *dmix,
|
|||
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));
|
||||
|
|
@ -1765,13 +1765,14 @@ int snd_pcm_direct_parse_bindings(snd_pcm_direct_t *dmix,
|
|||
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;
|
||||
}
|
||||
|
|
@ -1785,7 +1786,7 @@ int snd_pcm_direct_parse_bindings(snd_pcm_direct_t *dmix,
|
|||
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;
|
||||
}
|
||||
|
|
@ -1814,12 +1815,12 @@ static int _snd_pcm_direct_get_slave_ipc_offset(snd_config_t *root,
|
|||
|
||||
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,
|
||||
|
|
@ -1869,11 +1870,11 @@ static int _snd_pcm_direct_get_slave_ipc_offset(snd_config_t *root,
|
|||
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;
|
||||
|
|
@ -1888,7 +1889,7 @@ static int _snd_pcm_direct_get_slave_ipc_offset(snd_config_t *root,
|
|||
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;
|
||||
|
|
@ -1896,7 +1897,7 @@ static int _snd_pcm_direct_get_slave_ipc_offset(snd_config_t *root,
|
|||
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;
|
||||
|
|
@ -1959,7 +1960,7 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
|
|||
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;
|
||||
}
|
||||
|
|
@ -1970,11 +1971,11 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
|
|||
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;
|
||||
|
|
@ -1984,7 +1985,7 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
|
|||
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)
|
||||
|
|
@ -1996,7 +1997,7 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -2006,7 +2007,7 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
|
|||
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)
|
||||
|
|
@ -2018,7 +2019,7 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
|
|||
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;
|
||||
|
|
@ -2028,7 +2029,7 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
|
|||
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) {
|
||||
|
|
@ -2045,7 +2046,7 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
|
|||
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;
|
||||
}
|
||||
|
|
@ -2059,7 +2060,7 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
|
|||
}
|
||||
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;
|
||||
|
|
@ -2102,15 +2103,15 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
|
|||
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)
|
||||
|
|
@ -2175,7 +2176,7 @@ int _snd_pcm_direct_new(snd_pcm_t **pcmp, snd_pcm_direct_t **_dmix, int type,
|
|||
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);
|
||||
|
|
@ -2190,7 +2191,7 @@ int _snd_pcm_direct_new(snd_pcm_t **pcmp, snd_pcm_direct_t **_dmix, int type,
|
|||
|
||||
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 {
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@ static inline int snd_pcm_direct_semaphore_up(snd_pcm_direct_t *dmix, int sem_nu
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -970,7 +970,7 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -997,19 +997,19 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1020,7 +1020,7 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
|
|||
|
||||
ret = snd_pcm_direct_server_create(dmix);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to create server");
|
||||
snd_error(PCM, "unable to create server");
|
||||
goto _err;
|
||||
}
|
||||
}
|
||||
|
|
@ -1032,7 +1032,7 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1054,18 +1054,18 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -1075,13 +1075,13 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1325,7 +1325,7 @@ int _snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -667,7 +667,7 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -698,18 +698,18 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -718,7 +718,7 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -730,7 +730,7 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -753,18 +753,18 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -778,7 +778,7 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
|
|
@ -787,7 +787,7 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -538,7 +538,7 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -564,18 +564,18 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -584,7 +584,7 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -596,7 +596,7 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -619,18 +619,18 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -640,7 +640,7 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -95,11 +95,11 @@ int _snd_pcm_empty_open(snd_pcm_t **pcmp, const char *name ATTRIBUTE_UNUSED,
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -547,12 +547,12 @@ SND_PCM_PLUGIN_DEFINE_FUNC(myplug)
|
|||
....
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -690,8 +690,9 @@ int snd_pcm_extplug_create(snd_pcm_extplug_t *extplug, const char *name,
|
|||
/* 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;
|
||||
}
|
||||
|
||||
|
|
@ -781,7 +782,7 @@ int snd_pcm_extplug_set_slave_param_list(snd_pcm_extplug_t *extplug, int type, u
|
|||
{
|
||||
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);
|
||||
|
|
@ -803,11 +804,11 @@ int snd_pcm_extplug_set_slave_param_minmax(snd_pcm_extplug_t *extplug, int type,
|
|||
{
|
||||
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);
|
||||
|
|
@ -829,7 +830,7 @@ int snd_pcm_extplug_set_param_list(snd_pcm_extplug_t *extplug, int type, unsigne
|
|||
{
|
||||
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);
|
||||
|
|
@ -851,11 +852,11 @@ int snd_pcm_extplug_set_param_minmax(snd_pcm_extplug_t *extplug, int type, unsig
|
|||
{
|
||||
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);
|
||||
|
|
@ -877,7 +878,7 @@ int snd_pcm_extplug_set_param_link(snd_pcm_extplug_t *extplug, int type,
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -239,8 +239,9 @@ static int snd_pcm_file_open_output_file(snd_pcm_file_t *file)
|
|||
/* 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);
|
||||
|
|
@ -274,8 +275,9 @@ static int snd_pcm_file_open_output_file(snd_pcm_file_t *file)
|
|||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
|
@ -303,7 +305,7 @@ static int snd_pcm_file_areas_read_infile(snd_pcm_t *pcm,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -312,7 +314,7 @@ static int snd_pcm_file_areas_read_infile(snd_pcm_t *pcm,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -376,9 +378,9 @@ write_error:
|
|||
* 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));
|
||||
|
||||
|
|
@ -440,7 +442,7 @@ static int snd_pcm_file_write_bytes(snd_pcm_t *pcm, size_t bytes)
|
|||
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;
|
||||
|
|
@ -791,7 +793,7 @@ static int snd_pcm_file_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -914,7 +916,7 @@ int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
|
|||
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));
|
||||
|
|
@ -932,7 +934,7 @@ int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
|
|
@ -1057,7 +1059,7 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
|
|
@ -1067,7 +1069,7 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -1078,7 +1080,7 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -1087,11 +1089,11 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
|
|
@ -1103,7 +1105,7 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
|
|||
trunc = err;
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(PCM, "Unknown field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!format) {
|
||||
|
|
@ -1112,13 +1114,13 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
|
|||
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);
|
||||
|
|
@ -1126,7 +1128,7 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -350,7 +350,7 @@ static int snd_pcm_hook_add_conf(snd_pcm_t *pcm, snd_config_t *root, snd_config_
|
|||
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) {
|
||||
|
|
@ -368,27 +368,27 @@ static int snd_pcm_hook_add_conf(snd_pcm_t *pcm, snd_config_t *root, snd_config_
|
|||
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;
|
||||
}
|
||||
|
|
@ -402,7 +402,7 @@ static int snd_pcm_hook_add_conf(snd_pcm_t *pcm, snd_config_t *root, snd_config_
|
|||
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;
|
||||
|
|
@ -410,12 +410,12 @@ static int snd_pcm_hook_add_conf(snd_pcm_t *pcm, snd_config_t *root, snd_config_
|
|||
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;
|
||||
}
|
||||
|
|
@ -428,12 +428,14 @@ static int snd_pcm_hook_add_conf(snd_pcm_t *pcm, snd_config_t *root, snd_config_
|
|||
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;
|
||||
}
|
||||
|
|
@ -446,7 +448,7 @@ static int snd_pcm_hook_add_conf(snd_pcm_t *pcm, snd_config_t *root, snd_config_
|
|||
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);
|
||||
|
|
@ -499,17 +501,17 @@ int _snd_pcm_hooks_open(snd_pcm_t **pcmp, const char *name,
|
|||
}
|
||||
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);
|
||||
|
|
@ -532,7 +534,7 @@ int _snd_pcm_hooks_open(snd_pcm_t **pcmp, const char *name,
|
|||
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);
|
||||
|
|
@ -681,13 +683,13 @@ int _snd_pcm_hook_ctl_elems_install(snd_pcm_t *pcm, snd_config_t *conf)
|
|||
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);
|
||||
|
|
|
|||
150
src/pcm/pcm_hw.c
150
src/pcm/pcm_hw.c
|
|
@ -145,7 +145,7 @@ static int sync_ptr1(snd_pcm_hw_t *hw, unsigned int flags)
|
|||
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;
|
||||
|
|
@ -268,7 +268,7 @@ static int snd_pcm_hw_nonblock(snd_pcm_t *pcm, int nonblock)
|
|||
|
||||
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)
|
||||
|
|
@ -277,7 +277,7 @@ static int snd_pcm_hw_nonblock(snd_pcm_t *pcm, int 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;
|
||||
|
|
@ -291,7 +291,7 @@ static int snd_pcm_hw_async(snd_pcm_t *pcm, int sig, pid_t pid)
|
|||
|
||||
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)
|
||||
|
|
@ -300,19 +300,19 @@ static int snd_pcm_hw_async(snd_pcm_t *pcm, int sig, pid_t pid)
|
|||
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;
|
||||
|
|
@ -324,7 +324,7 @@ static int snd_pcm_hw_info(snd_pcm_t *pcm, snd_pcm_info_t * info)
|
|||
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) */
|
||||
|
|
@ -409,7 +409,7 @@ static int snd_pcm_hw_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
|
|||
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;
|
||||
|
|
@ -515,7 +515,7 @@ static int snd_pcm_hw_hw_free(snd_pcm_t *pcm)
|
|||
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;
|
||||
|
|
@ -541,19 +541,19 @@ static int snd_pcm_hw_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params)
|
|||
}
|
||||
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;
|
||||
|
|
@ -563,7 +563,7 @@ static int snd_pcm_hw_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params)
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -589,7 +589,7 @@ static int snd_pcm_hw_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t * info
|
|||
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;
|
||||
|
|
@ -609,13 +609,13 @@ static int snd_pcm_hw_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -642,7 +642,7 @@ static int snd_pcm_hw_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
|
|||
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;
|
||||
|
|
@ -660,7 +660,7 @@ static int snd_pcm_hw_hwsync(snd_pcm_t *pcm)
|
|||
} 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;
|
||||
}
|
||||
}
|
||||
|
|
@ -690,14 +690,14 @@ static int snd_pcm_hw_prepare(snd_pcm_t *pcm)
|
|||
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);
|
||||
|
|
@ -709,7 +709,7 @@ static int snd_pcm_hw_reset(snd_pcm_t *pcm)
|
|||
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);
|
||||
|
|
@ -726,10 +726,10 @@ static int snd_pcm_hw_start(snd_pcm_t *pcm)
|
|||
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;
|
||||
}
|
||||
|
|
@ -742,7 +742,7 @@ static int snd_pcm_hw_drop(snd_pcm_t *pcm)
|
|||
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 {
|
||||
}
|
||||
|
|
@ -792,7 +792,7 @@ __manual_silence:
|
|||
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;
|
||||
|
|
@ -800,7 +800,7 @@ __manual_silence:
|
|||
__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;
|
||||
|
|
@ -812,7 +812,7 @@ static int snd_pcm_hw_pause(snd_pcm_t *pcm, int enable)
|
|||
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;
|
||||
|
|
@ -829,7 +829,7 @@ static snd_pcm_sframes_t snd_pcm_hw_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t fra
|
|||
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);
|
||||
|
|
@ -850,7 +850,7 @@ static snd_pcm_sframes_t snd_pcm_hw_forward(snd_pcm_t *pcm, snd_pcm_uframes_t fr
|
|||
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);
|
||||
|
|
@ -887,7 +887,7 @@ static int snd_pcm_hw_resume(snd_pcm_t *pcm)
|
|||
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;
|
||||
|
|
@ -898,7 +898,7 @@ static int hw_link(snd_pcm_t *pcm1, snd_pcm_t *pcm2)
|
|||
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;
|
||||
|
|
@ -907,7 +907,7 @@ static int hw_link(snd_pcm_t *pcm1, snd_pcm_t *pcm2)
|
|||
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);
|
||||
|
|
@ -928,7 +928,7 @@ static int snd_pcm_hw_unlink(snd_pcm_t *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;
|
||||
|
|
@ -1128,7 +1128,7 @@ static void unmap_status_data(snd_pcm_hw_t *hw)
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1137,7 +1137,7 @@ static void unmap_control_data(snd_pcm_hw_t *hw)
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1172,7 +1172,7 @@ static int snd_pcm_hw_close(snd_pcm_t *pcm)
|
|||
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);
|
||||
|
|
@ -1295,7 +1295,7 @@ snd_pcm_query_chmaps_from_hw(int card, int dev, int subdev,
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1303,7 +1303,7 @@ snd_pcm_query_chmaps_from_hw(int card, int dev, int subdev,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1317,7 +1317,7 @@ snd_pcm_query_chmaps_from_hw(int card, int dev, int subdev,
|
|||
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;
|
||||
|
|
@ -1330,7 +1330,7 @@ snd_pcm_query_chmaps_from_hw(int card, int dev, int subdev,
|
|||
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++;
|
||||
|
|
@ -1421,8 +1421,9 @@ static snd_pcm_chmap_t *snd_pcm_hw_get_chmap(snd_pcm_t *pcm)
|
|||
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));
|
||||
|
|
@ -1432,7 +1433,7 @@ static snd_pcm_chmap_t *snd_pcm_hw_get_chmap(snd_pcm_t *pcm)
|
|||
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;
|
||||
}
|
||||
|
|
@ -1442,7 +1443,7 @@ static snd_pcm_chmap_t *snd_pcm_hw_get_chmap(snd_pcm_t *pcm)
|
|||
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;
|
||||
}
|
||||
|
|
@ -1468,17 +1469,18 @@ static int snd_pcm_hw_set_chmap(snd_pcm_t *pcm, const snd_pcm_chmap_t *map)
|
|||
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;
|
||||
}
|
||||
|
|
@ -1496,7 +1498,7 @@ static int snd_pcm_hw_set_chmap(snd_pcm_t *pcm, const snd_pcm_chmap_t *map)
|
|||
ret = -ENXIO;
|
||||
}
|
||||
if (ret < 0)
|
||||
SYSMSG("Cannot write Channel Map ctl");
|
||||
snd_checknum(PCM, "Cannot write Channel Map ctl");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -1506,7 +1508,7 @@ static void snd_pcm_hw_dump(snd_pcm_t *pcm, snd_output_t *out)
|
|||
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",
|
||||
|
|
@ -1627,7 +1629,7 @@ int snd_pcm_hw_open_fd(snd_pcm_t **pcmp, const char *name, int fd,
|
|||
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;
|
||||
|
||||
|
|
@ -1648,7 +1650,7 @@ int snd_pcm_hw_open_fd(snd_pcm_t **pcmp, const char *name, int fd,
|
|||
|
||||
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;
|
||||
}
|
||||
|
|
@ -1660,7 +1662,7 @@ int snd_pcm_hw_open_fd(snd_pcm_t **pcmp, const char *name, int fd,
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -1673,7 +1675,7 @@ int snd_pcm_hw_open_fd(snd_pcm_t **pcmp, const char *name, int fd,
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -1685,7 +1687,7 @@ int snd_pcm_hw_open_fd(snd_pcm_t **pcmp, const char *name, int fd,
|
|||
int on = 1;
|
||||
if (ioctl(fd, SNDRV_PCM_IOCTL_TSTAMP, &on) < 0) {
|
||||
ret = -errno;
|
||||
SNDMSG("TSTAMP failed");
|
||||
snd_check(PCM, "TSTAMP failed");
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
@ -1777,7 +1779,7 @@ int snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
|
|||
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);
|
||||
|
|
@ -1800,14 +1802,14 @@ int snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
|
|||
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) {
|
||||
|
|
@ -1915,7 +1917,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
|
|
@ -1923,7 +1925,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
|
|
@ -1949,12 +1951,12 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
|
|
@ -1962,7 +1964,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
|
|
@ -1970,7 +1972,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
|
|||
} 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;
|
||||
|
|
@ -1981,7 +1983,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
|
|
@ -1991,7 +1993,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
|
|
@ -2000,7 +2002,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
|
|||
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);
|
||||
|
|
@ -2010,7 +2012,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
|
|
@ -2020,7 +2022,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
}
|
||||
|
|
@ -2030,23 +2032,23 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -712,7 +712,7 @@ int _snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name,
|
|||
}
|
||||
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;
|
||||
|
|
@ -720,7 +720,7 @@ int _snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name,
|
|||
}
|
||||
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;
|
||||
|
|
@ -733,7 +733,7 @@ int _snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name,
|
|||
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));
|
||||
|
|
@ -744,12 +744,12 @@ int _snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
|
|
@ -775,19 +775,19 @@ int _snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name,
|
|||
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,
|
||||
|
|
@ -798,7 +798,7 @@ int _snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name,
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -1086,8 +1086,9 @@ int snd_pcm_ioplug_create(snd_pcm_ioplug_t *ioplug, const char *name,
|
|||
/* 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;
|
||||
}
|
||||
|
||||
|
|
@ -1156,7 +1157,7 @@ int snd_pcm_ioplug_set_param_list(snd_pcm_ioplug_t *ioplug, int type, unsigned i
|
|||
{
|
||||
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)
|
||||
|
|
@ -1180,11 +1181,11 @@ int snd_pcm_ioplug_set_param_minmax(snd_pcm_ioplug_t *ioplug, int type, unsigned
|
|||
{
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -420,7 +420,7 @@ static int snd_pcm_ladspa_connect_plugin1(snd_pcm_ladspa_plugin_t *plugin,
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -428,12 +428,12 @@ static int snd_pcm_ladspa_connect_plugin1(snd_pcm_ladspa_plugin_t *plugin,
|
|||
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++;
|
||||
|
|
@ -469,18 +469,18 @@ static int snd_pcm_ladspa_connect_plugin_duplicate1(snd_pcm_ladspa_plugin_t *plu
|
|||
} 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;
|
||||
|
|
@ -596,13 +596,13 @@ static int snd_pcm_ladspa_check_connect(snd_pcm_ladspa_plugin_t *plugin,
|
|||
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;
|
||||
|
|
@ -640,7 +640,7 @@ static int snd_pcm_ladspa_allocate_instances(snd_pcm_t *pcm, snd_pcm_ladspa_t *l
|
|||
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;
|
||||
}
|
||||
|
|
@ -648,13 +648,13 @@ static int snd_pcm_ladspa_allocate_instances(snd_pcm_t *pcm, snd_pcm_ladspa_t *l
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -1256,7 +1256,7 @@ static int snd_pcm_ladspa_parse_controls(snd_pcm_ladspa_plugin_t *lplug,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1275,16 +1275,16 @@ static int snd_pcm_ladspa_parse_controls(snd_pcm_ladspa_plugin_t *lplug,
|
|||
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;
|
||||
|
|
@ -1304,7 +1304,7 @@ static int snd_pcm_ladspa_parse_bindings(snd_pcm_ladspa_plugin_t *lplug,
|
|||
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) {
|
||||
|
|
@ -1315,11 +1315,11 @@ static int snd_pcm_ladspa_parse_bindings(snd_pcm_ladspa_plugin_t *lplug,
|
|||
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))
|
||||
|
|
@ -1347,19 +1347,19 @@ static int snd_pcm_ladspa_parse_bindings(snd_pcm_ladspa_plugin_t *lplug,
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -1379,7 +1379,7 @@ static int snd_pcm_ladspa_parse_ioconfig(snd_pcm_ladspa_plugin_t *lplug,
|
|||
/* 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;
|
||||
}
|
||||
|
||||
|
|
@ -1388,7 +1388,7 @@ static int snd_pcm_ladspa_parse_ioconfig(snd_pcm_ladspa_plugin_t *lplug,
|
|||
}
|
||||
|
||||
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) {
|
||||
|
|
@ -1471,7 +1471,7 @@ static int snd_pcm_ladspa_add_plugin(struct list_head *list,
|
|||
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)
|
||||
|
|
@ -1479,14 +1479,14 @@ static int snd_pcm_ladspa_add_plugin(struct list_head *list,
|
|||
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));
|
||||
|
|
@ -1499,14 +1499,14 @@ static int snd_pcm_ladspa_add_plugin(struct list_head *list,
|
|||
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;
|
||||
}
|
||||
|
|
@ -1536,7 +1536,7 @@ static int snd_pcm_ladspa_build_plugins(struct list_head *list,
|
|||
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 {
|
||||
|
|
@ -1549,7 +1549,7 @@ static int snd_pcm_ladspa_build_plugins(struct list_head *list,
|
|||
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) {
|
||||
|
|
@ -1562,7 +1562,7 @@ static int snd_pcm_ladspa_build_plugins(struct list_head *list,
|
|||
}
|
||||
} 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;
|
||||
|
|
@ -1776,16 +1776,16 @@ int _snd_pcm_ladspa_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -483,11 +483,11 @@ int _snd_pcm_lfloat_open(snd_pcm_t **pcmp, const char *name,
|
|||
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,
|
||||
|
|
@ -497,7 +497,7 @@ int _snd_pcm_lfloat_open(snd_pcm_t **pcmp, const char *name,
|
|||
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);
|
||||
|
|
@ -521,7 +521,7 @@ int snd_pcm_lfloat_open(snd_pcm_t **pcmp ATTRIBUTE_UNUSED,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -532,7 +532,7 @@ int _snd_pcm_lfloat_open(snd_pcm_t **pcmp ATTRIBUTE_UNUSED,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -526,11 +526,11 @@ int _snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name,
|
|||
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,
|
||||
|
|
@ -539,7 +539,7 @@ int _snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name,
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -621,23 +621,23 @@ static int snd_pcm_meter_add_scope_conf(snd_pcm_t *pcm, const char *name,
|
|||
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);
|
||||
|
|
@ -652,7 +652,7 @@ static int snd_pcm_meter_add_scope_conf(snd_pcm_t *pcm, const char *name,
|
|||
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;
|
||||
|
|
@ -660,12 +660,12 @@ static int snd_pcm_meter_add_scope_conf(snd_pcm_t *pcm, const char *name,
|
|||
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;
|
||||
}
|
||||
|
|
@ -678,10 +678,10 @@ static int snd_pcm_meter_add_scope_conf(snd_pcm_t *pcm, const char *name,
|
|||
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;
|
||||
}
|
||||
|
|
@ -779,24 +779,24 @@ int _snd_pcm_meter_open(snd_pcm_t **pcmp, const char *name,
|
|||
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);
|
||||
|
|
@ -821,7 +821,7 @@ int _snd_pcm_meter_open(snd_pcm_t **pcmp, const char *name,
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -803,11 +803,11 @@ int snd_pcm_parse_control_id(snd_config_t *conf, snd_ctl_elem_id_t *ctl_id, int
|
|||
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;
|
||||
|
|
@ -815,28 +815,28 @@ int snd_pcm_parse_control_id(snd_config_t *conf, snd_ctl_elem_id_t *ctl_id, int
|
|||
}
|
||||
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;
|
||||
|
|
@ -844,11 +844,11 @@ int snd_pcm_parse_control_id(snd_config_t *conf, snd_ctl_elem_id_t *ctl_id, int
|
|||
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;
|
||||
|
|
@ -856,17 +856,17 @@ int snd_pcm_parse_control_id(snd_config_t *conf, snd_ctl_elem_id_t *ctl_id, int
|
|||
}
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ static snd_pcm_sframes_t snd_pcm_mmap_write_areas(snd_pcm_t *pcm,
|
|||
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) {
|
||||
|
|
@ -106,7 +106,7 @@ static snd_pcm_sframes_t snd_pcm_mmap_read_areas(snd_pcm_t *pcm,
|
|||
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) {
|
||||
|
|
@ -244,7 +244,7 @@ int snd_pcm_channel_info_shm(snd_pcm_t *pcm, snd_pcm_channel_info_t *info, int s
|
|||
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;
|
||||
|
|
@ -263,11 +263,11 @@ int snd_pcm_mmap(snd_pcm_t *pcm)
|
|||
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)
|
||||
|
|
@ -342,7 +342,7 @@ int snd_pcm_mmap(snd_pcm_t *pcm)
|
|||
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;
|
||||
|
|
@ -354,23 +354,23 @@ int snd_pcm_mmap(snd_pcm_t *pcm)
|
|||
/* 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 ||
|
||||
|
|
@ -387,20 +387,20 @@ int snd_pcm_mmap(snd_pcm_t *pcm)
|
|||
} 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;
|
||||
|
|
@ -445,7 +445,7 @@ int snd_pcm_munmap(snd_pcm_t *pcm)
|
|||
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) {
|
||||
|
|
@ -476,7 +476,7 @@ int snd_pcm_munmap(snd_pcm_t *pcm)
|
|||
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;
|
||||
|
|
@ -500,7 +500,7 @@ int snd_pcm_munmap(snd_pcm_t *pcm)
|
|||
}
|
||||
break;
|
||||
#else
|
||||
SYSERR("shm support not available");
|
||||
snd_errornum(PCM, "shm support not available");
|
||||
return -ENOSYS;
|
||||
#endif
|
||||
case SND_PCM_AREA_LOCAL:
|
||||
|
|
@ -567,7 +567,7 @@ snd_pcm_sframes_t snd_pcm_write_mmap(snd_pcm_t *pcm, snd_pcm_uframes_t offset,
|
|||
break;
|
||||
}
|
||||
default:
|
||||
SNDMSG("invalid access type %d", pcm->access);
|
||||
snd_check(PCM, "invalid access type %d", pcm->access);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (err < 0)
|
||||
|
|
@ -623,7 +623,7 @@ snd_pcm_sframes_t snd_pcm_read_mmap(snd_pcm_t *pcm, snd_pcm_uframes_t offset,
|
|||
break;
|
||||
}
|
||||
default:
|
||||
SNDMSG("invalid access type %d", pcm->access);
|
||||
snd_check(PCM, "invalid access type %d", pcm->access);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (err < 0)
|
||||
|
|
|
|||
|
|
@ -489,11 +489,11 @@ int _snd_pcm_mmap_emul_open(snd_pcm_t **pcmp, const char *name,
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -538,11 +538,11 @@ int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name,
|
|||
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,
|
||||
|
|
@ -552,7 +552,7 @@ int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name,
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -266,7 +266,7 @@ static int snd_pcm_multi_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -1267,7 +1267,7 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
|
|
@ -1275,7 +1275,7 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
|
|||
}
|
||||
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;
|
||||
|
|
@ -1283,27 +1283,27 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
|
|||
}
|
||||
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) {
|
||||
|
|
@ -1314,14 +1314,14 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
|
|||
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));
|
||||
|
|
@ -1365,7 +1365,7 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
}
|
||||
|
|
@ -1383,7 +1383,7 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
|
|||
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);
|
||||
|
|
@ -1398,23 +1398,23 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -386,13 +386,13 @@ int snd_pcm_null_open(snd_pcm_t **pcmp, const char *name, snd_pcm_stream_t strea
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -481,12 +481,12 @@ int _snd_pcm_null_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2232,7 +2232,7 @@ int snd_pcm_hw_refine_slave(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
|
|||
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
|
||||
|
|
|
|||
|
|
@ -480,7 +480,7 @@ static int snd_pcm_plug_change_channels(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm
|
|||
ttable[c * tt_ssize + c] = SND_PCM_PLUGIN_ROUTE_FULL;
|
||||
break;
|
||||
default:
|
||||
SNDERR("Invalid route policy");
|
||||
snd_error(PCM, "Invalid route policy");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -861,16 +861,16 @@ static int snd_pcm_plug_hw_refine_schange(snd_pcm_t *pcm, snd_pcm_hw_params_t *p
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
@ -883,8 +883,9 @@ static int snd_pcm_plug_hw_refine_schange(snd_pcm_t *pcm, snd_pcm_hw_params_t *p
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -950,16 +951,16 @@ static int snd_pcm_plug_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
@ -1293,7 +1294,7 @@ int _snd_pcm_plug_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
|
|
@ -1302,11 +1303,11 @@ int _snd_pcm_plug_open(snd_pcm_t **pcmp, const char *name,
|
|||
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"))
|
||||
|
|
@ -1324,11 +1325,11 @@ int _snd_pcm_plug_open(snd_pcm_t **pcmp, const char *name,
|
|||
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,
|
||||
|
|
|
|||
|
|
@ -257,8 +257,9 @@ static snd_pcm_sframes_t snd_pcm_plugin_write_areas(snd_pcm_t *pcm,
|
|||
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;
|
||||
}
|
||||
|
|
@ -314,8 +315,9 @@ static snd_pcm_sframes_t snd_pcm_plugin_read_areas(snd_pcm_t *pcm,
|
|||
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;
|
||||
}
|
||||
|
|
@ -447,7 +449,7 @@ snd_pcm_plugin_mmap_commit(snd_pcm_t *pcm,
|
|||
xfer += frames;
|
||||
}
|
||||
if (CHECK_SANITY(size)) {
|
||||
SNDMSG("short commit: %ld", size);
|
||||
snd_check(PCM, "short commit: %ld", size);
|
||||
return -EPIPE;
|
||||
}
|
||||
return xfer;
|
||||
|
|
|
|||
|
|
@ -396,7 +396,7 @@ static int snd_pcm_rate_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -412,7 +412,7 @@ static int snd_pcm_rate_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
|
|||
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;
|
||||
}
|
||||
|
|
@ -854,7 +854,7 @@ static int snd_pcm_rate_commit_area(snd_pcm_t *pcm, snd_pcm_rate_t *rate,
|
|||
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
|
||||
|
|
@ -953,7 +953,7 @@ static int snd_pcm_rate_grab_next_period(snd_pcm_t *pcm, snd_pcm_uframes_t hw_of
|
|||
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
|
||||
|
|
@ -1565,20 +1565,20 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
|
|
@ -1596,7 +1596,7 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
|
|||
|
||||
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;
|
||||
|
|
@ -1698,11 +1698,11 @@ int _snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1714,7 +1714,7 @@ int _snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ static void linear_shrink(struct rate_linear *rate,
|
|||
dst += dst_step;
|
||||
dst_frames1++;
|
||||
if (CHECK_SANITY(dst_frames1 > dst_frames)) {
|
||||
SNDERR("dst_frames overflow");
|
||||
snd_error(PCM, "dst_frames overflow");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -298,7 +298,7 @@ static void linear_shrink_s16(struct rate_linear *rate,
|
|||
dst += dst_step;
|
||||
dst_frames1++;
|
||||
if (CHECK_SANITY(dst_frames1 > dst_frames)) {
|
||||
SNDERR("dst_frames overflow");
|
||||
snd_error(PCM, "dst_frames overflow");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -375,8 +375,9 @@ static int linear_adjust_pitch(void *obj, snd_pcm_rate_info_t *info)
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -810,7 +810,7 @@ static int determine_chmap(snd_config_t *tt, snd_pcm_chmap_t **tt_chmap)
|
|||
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;
|
||||
|
|
@ -875,7 +875,7 @@ static int find_matching_chmap(snd_pcm_chmap_query_t **chmaps,
|
|||
}
|
||||
|
||||
if (*found_chmap == NULL) {
|
||||
SNDERR("Found no matching channel map");
|
||||
snd_error(PCM, "Found no matching channel map");
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -1085,7 +1085,7 @@ static int _snd_pcm_route_determine_ttable(snd_config_t *tt,
|
|||
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)
|
||||
|
|
@ -1100,7 +1100,7 @@ static int _snd_pcm_route_determine_ttable(snd_config_t *tt,
|
|||
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)
|
||||
|
|
@ -1108,7 +1108,7 @@ static int _snd_pcm_route_determine_ttable(snd_config_t *tt,
|
|||
}
|
||||
}
|
||||
if (csize == 0 || ssize == 0) {
|
||||
SNDERR("Invalid null ttable configuration");
|
||||
snd_error(PCM, "Invalid null ttable configuration");
|
||||
return -EINVAL;
|
||||
}
|
||||
*tt_csize = csize;
|
||||
|
|
@ -1168,7 +1168,7 @@ static int _snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_ent
|
|||
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)
|
||||
|
|
@ -1183,13 +1183,13 @@ static int _snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_ent
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1197,7 +1197,7 @@ static int _snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_ent
|
|||
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;
|
||||
|
|
@ -1315,7 +1315,7 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
|
|||
}
|
||||
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;
|
||||
}
|
||||
|
|
@ -1325,21 +1325,21 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
}
|
||||
|
|
@ -1353,7 +1353,7 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -238,11 +238,11 @@ static snd_pcm_uframes_t _snd_pcm_share_missing(snd_pcm_t *pcm)
|
|||
}
|
||||
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)
|
||||
|
|
@ -282,7 +282,7 @@ static snd_pcm_uframes_t _snd_pcm_share_missing(snd_pcm_t *pcm)
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -370,13 +370,13 @@ static void *snd_pcm_share_thread(void *data)
|
|||
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;
|
||||
}
|
||||
|
|
@ -403,7 +403,7 @@ static void *snd_pcm_share_thread(void *data)
|
|||
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;
|
||||
}
|
||||
|
|
@ -457,7 +457,7 @@ static void _snd_pcm_share_update(snd_pcm_t *pcm)
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -648,7 +648,7 @@ static int snd_pcm_share_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
|||
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;
|
||||
}
|
||||
|
|
@ -852,11 +852,11 @@ static snd_pcm_sframes_t _snd_pcm_share_mmap_commit(snd_pcm_t *pcm,
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -1399,11 +1399,11 @@ int snd_pcm_share_open(snd_pcm_t **pcmp, const char *name, const char *sname,
|
|||
|
||||
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;
|
||||
|
|
@ -1516,7 +1516,7 @@ int snd_pcm_share_open(snd_pcm_t **pcmp, const char *name, const char *sname,
|
|||
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]);
|
||||
|
|
@ -1638,17 +1638,17 @@ int _snd_pcm_share_open(snd_pcm_t **pcmp, const char *name,
|
|||
}
|
||||
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,
|
||||
|
|
@ -1665,12 +1665,12 @@ int _snd_pcm_share_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
}
|
||||
|
|
@ -1682,7 +1682,7 @@ int _snd_pcm_share_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
}
|
||||
|
|
@ -1690,7 +1690,7 @@ int _snd_pcm_share_open(snd_pcm_t **pcmp, const char *name,
|
|||
channels = cchannel + 1;
|
||||
}
|
||||
if (channels == 0) {
|
||||
SNDERR("No bindings defined");
|
||||
snd_error(PCM, "No bindings defined");
|
||||
err = -EINVAL;
|
||||
goto _free;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ static long snd_pcm_shm_action_fd0(snd_pcm_t *pcm, int *fd)
|
|||
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;
|
||||
|
|
@ -99,7 +99,7 @@ static int snd_pcm_shm_new_rbptr(snd_pcm_t *pcm, snd_pcm_shm_t *shm,
|
|||
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)
|
||||
|
|
@ -126,7 +126,7 @@ static long snd_pcm_shm_action(snd_pcm_t *pcm)
|
|||
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;
|
||||
|
|
@ -161,7 +161,7 @@ static long snd_pcm_shm_action_fd(snd_pcm_t *pcm, int *fd)
|
|||
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) {
|
||||
|
|
@ -354,7 +354,7 @@ static int snd_pcm_shm_munmap(snd_pcm_t *pcm)
|
|||
}
|
||||
err = close(i->u.mmap.fd);
|
||||
if (err < 0) {
|
||||
SYSERR("close failed");
|
||||
snd_errornum(PCM, "close failed");
|
||||
return -errno;
|
||||
}
|
||||
}
|
||||
|
|
@ -641,7 +641,7 @@ static int make_local_socket(const char *filename)
|
|||
|
||||
sock = socket(PF_LOCAL, SOCK_STREAM, 0);
|
||||
if (sock < 0) {
|
||||
SYSERR("socket failed");
|
||||
snd_errornum(PCM, "socket failed");
|
||||
return -errno;
|
||||
}
|
||||
|
||||
|
|
@ -649,7 +649,7 @@ static int make_local_socket(const char *filename)
|
|||
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;
|
||||
|
|
@ -687,7 +687,7 @@ int snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name,
|
|||
|
||||
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;
|
||||
|
|
@ -702,23 +702,23 @@ int snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
}
|
||||
|
|
@ -728,7 +728,7 @@ int snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name,
|
|||
|
||||
ctrl = shmat(ans.cookie, 0, 0);
|
||||
if (!ctrl) {
|
||||
SYSERR("shmat error");
|
||||
snd_errornum(PCM, "shmat error");
|
||||
result = -errno;
|
||||
goto _err;
|
||||
}
|
||||
|
|
@ -830,7 +830,7 @@ int _snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
|
|
@ -838,29 +838,29 @@ int _snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name,
|
|||
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) {
|
||||
|
|
@ -875,7 +875,7 @@ int _snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
|
|
@ -883,19 +883,19 @@ int _snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name,
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -632,8 +632,9 @@ static int snd_pcm_softvol_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * param
|
|||
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;
|
||||
|
|
@ -772,14 +773,14 @@ static int softvol_load_control(snd_pcm_t *pcm, snd_pcm_softvol_t *svol,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -798,12 +799,12 @@ static int softvol_load_control(snd_pcm_t *pcm, snd_pcm_softvol_t *svol,
|
|||
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 {
|
||||
|
|
@ -822,14 +823,14 @@ static int softvol_load_control(snd_pcm_t *pcm, snd_pcm_softvol_t *svol,
|
|||
(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) {
|
||||
|
|
@ -852,7 +853,7 @@ static int softvol_load_control(snd_pcm_t *pcm, snd_pcm_softvol_t *svol,
|
|||
#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;
|
||||
|
|
@ -868,7 +869,7 @@ static int softvol_load_control(snd_pcm_t *pcm, snd_pcm_softvol_t *svol,
|
|||
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
|
||||
}
|
||||
|
|
@ -1020,28 +1021,28 @@ static int _snd_pcm_parse_control_id(snd_config_t *conf, snd_ctl_elem_id_t *ctl_
|
|||
}
|
||||
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;
|
||||
|
|
@ -1049,21 +1050,21 @@ static int _snd_pcm_parse_control_id(snd_config_t *conf, snd_ctl_elem_id_t *ctl_
|
|||
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;
|
||||
}
|
||||
|
|
@ -1182,7 +1183,7 @@ int _snd_pcm_softvol_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
|
|
@ -1191,7 +1192,7 @@ int _snd_pcm_softvol_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
|
|
@ -1199,33 +1200,34 @@ int _snd_pcm_softvol_open(snd_pcm_t **pcmp, const char *name,
|
|||
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) {
|
||||
|
|
@ -1247,7 +1249,7 @@ int _snd_pcm_softvol_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ int _snd_pcm_scope_level_open(snd_pcm_t *pcm, const char *name,
|
|||
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;
|
||||
|
|
@ -244,7 +244,7 @@ int _snd_pcm_scope_level_open(snd_pcm_t *pcm, const char *name,
|
|||
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;
|
||||
|
|
@ -252,12 +252,12 @@ int _snd_pcm_scope_level_open(snd_pcm_t *pcm, const char *name,
|
|||
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)
|
||||
|
|
|
|||
|
|
@ -188,30 +188,30 @@ static int snd_rawmidi_open_conf(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp
|
|||
#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;
|
||||
}
|
||||
|
|
@ -225,7 +225,7 @@ static int snd_rawmidi_open_conf(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp
|
|||
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;
|
||||
|
|
@ -233,12 +233,12 @@ static int snd_rawmidi_open_conf(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp
|
|||
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;
|
||||
}
|
||||
|
|
@ -290,7 +290,7 @@ static int snd_rawmidi_open_noupdate(snd_rawmidi_t **inputp, snd_rawmidi_t **out
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ static int snd_rawmidi_hw_close(snd_rawmidi_t *rmidi)
|
|||
return 0;
|
||||
if (close(hw->fd)) {
|
||||
err = -errno;
|
||||
SYSMSG("close failed");
|
||||
snd_checknum(RAWMIDI, "close failed");
|
||||
}
|
||||
free(hw->buf);
|
||||
free(hw);
|
||||
|
|
@ -82,7 +82,7 @@ static int snd_rawmidi_hw_nonblock(snd_rawmidi_t *rmidi, int nonblock)
|
|||
long flags;
|
||||
|
||||
if ((flags = fcntl(hw->fd, F_GETFL)) < 0) {
|
||||
SYSMSG("F_GETFL failed");
|
||||
snd_checknum(RAWMIDI, "F_GETFL failed");
|
||||
return -errno;
|
||||
}
|
||||
if (nonblock)
|
||||
|
|
@ -90,7 +90,7 @@ static int snd_rawmidi_hw_nonblock(snd_rawmidi_t *rmidi, int 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;
|
||||
|
|
@ -101,7 +101,7 @@ static int snd_rawmidi_hw_info(snd_rawmidi_t *rmidi, snd_rawmidi_info_t * info)
|
|||
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;
|
||||
|
|
@ -113,7 +113,7 @@ static int snd_rawmidi_hw_params(snd_rawmidi_t *rmidi, snd_rawmidi_params_t * pa
|
|||
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);
|
||||
|
|
@ -145,7 +145,7 @@ static int snd_rawmidi_hw_status(snd_rawmidi_t *rmidi, snd_rawmidi_status_t * st
|
|||
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;
|
||||
|
|
@ -156,7 +156,7 @@ static int snd_rawmidi_hw_drop(snd_rawmidi_t *rmidi)
|
|||
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);
|
||||
|
|
@ -168,7 +168,7 @@ static int snd_rawmidi_hw_drain(snd_rawmidi_t *rmidi)
|
|||
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;
|
||||
|
|
@ -382,13 +382,13 @@ int snd_rawmidi_hw_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
|
|||
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;
|
||||
|
|
@ -407,7 +407,7 @@ int snd_rawmidi_hw_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -914,30 +914,30 @@ static int snd_seq_open_conf(snd_seq_t **seqp, const char *name,
|
|||
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) {
|
||||
|
|
@ -950,7 +950,7 @@ static int snd_seq_open_conf(snd_seq_t **seqp, const char *name,
|
|||
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;
|
||||
|
|
@ -958,12 +958,12 @@ static int snd_seq_open_conf(snd_seq_t **seqp, const char *name,
|
|||
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;
|
||||
}
|
||||
|
|
@ -980,10 +980,10 @@ static int snd_seq_open_conf(snd_seq_t **seqp, const char *name,
|
|||
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;
|
||||
}
|
||||
|
|
@ -1008,7 +1008,7 @@ static int snd_seq_open_noupdate(snd_seq_t **seqp, snd_config_t *root,
|
|||
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);
|
||||
|
|
@ -4594,7 +4594,7 @@ static int snd_seq_event_input_feed(snd_seq_t *seq, int timeout)
|
|||
pfd.events = POLLIN;
|
||||
err = poll(&pfd, 1, timeout);
|
||||
if (err < 0) {
|
||||
SYSERR("poll");
|
||||
snd_errornum(SEQUENCER, "poll");
|
||||
return -errno;
|
||||
}
|
||||
if (pfd.revents & POLLIN)
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ static int snd_seq_hw_close(snd_seq_t *seq)
|
|||
|
||||
if (close(hw->fd)) {
|
||||
err = -errno;
|
||||
SYSERR("close failed\n");
|
||||
snd_errornum(SEQUENCER, "close failed\n");
|
||||
}
|
||||
free(hw);
|
||||
return err;
|
||||
|
|
@ -58,7 +58,7 @@ static int snd_seq_hw_nonblock(snd_seq_t *seq, int nonblock)
|
|||
long flags;
|
||||
|
||||
if ((flags = fcntl(hw->fd, F_GETFL)) < 0) {
|
||||
SYSERR("F_GETFL failed");
|
||||
snd_errornum(SEQUENCER, "F_GETFL failed");
|
||||
return -errno;
|
||||
}
|
||||
if (nonblock)
|
||||
|
|
@ -66,7 +66,7 @@ static int snd_seq_hw_nonblock(snd_seq_t *seq, int 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;
|
||||
|
|
@ -77,7 +77,7 @@ static int snd_seq_hw_client_id(snd_seq_t *seq)
|
|||
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;
|
||||
|
|
@ -87,7 +87,7 @@ static int snd_seq_hw_system_info(snd_seq_t *seq, snd_seq_system_info_t * info)
|
|||
{
|
||||
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;
|
||||
|
|
@ -537,11 +537,11 @@ int snd_seq_hw_open(snd_seq_t **handle, const char *name, int streams, int mode)
|
|||
}
|
||||
#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;
|
||||
|
|
|
|||
|
|
@ -525,7 +525,7 @@ int snd_seq_create_ump_endpoint(snd_seq_t *seq,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -534,13 +534,13 @@ int snd_seq_create_ump_endpoint(snd_seq_t *seq,
|
|||
} 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;
|
||||
}
|
||||
|
||||
|
|
@ -560,7 +560,7 @@ int snd_seq_create_ump_endpoint(snd_seq_t *seq,
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -586,7 +586,7 @@ int snd_seq_create_ump_endpoint(snd_seq_t *seq,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -601,7 +601,7 @@ int snd_seq_create_ump_endpoint(snd_seq_t *seq,
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -725,7 +725,7 @@ int snd_seq_create_ump_block(snd_seq_t *seq, int blkid,
|
|||
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ int snd_send_fd(int sock, void *data, size_t len, int fd)
|
|||
|
||||
ret = sendmsg(sock, &msghdr, 0 );
|
||||
if (ret < 0) {
|
||||
SYSERR("sendmsg failed");
|
||||
snd_errornum(CORE, "sendmsg failed");
|
||||
return -errno;
|
||||
}
|
||||
return ret;
|
||||
|
|
@ -100,7 +100,7 @@ int snd_receive_fd(int sock, void *data, size_t len, int *fd)
|
|||
|
||||
ret = recvmsg(sock, &msghdr, 0);
|
||||
if (ret < 0) {
|
||||
SYSERR("recvmsg failed");
|
||||
snd_errornum(CORE, "recvmsg failed");
|
||||
return -errno;
|
||||
}
|
||||
*fd = *fds;
|
||||
|
|
|
|||
|
|
@ -89,30 +89,30 @@ static int snd_timer_open_conf(snd_timer_t **timer,
|
|||
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) {
|
||||
|
|
@ -125,7 +125,7 @@ static int snd_timer_open_conf(snd_timer_t **timer,
|
|||
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;
|
||||
|
|
@ -133,12 +133,12 @@ static int snd_timer_open_conf(snd_timer_t **timer,
|
|||
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;
|
||||
}
|
||||
|
|
@ -155,10 +155,10 @@ static int snd_timer_open_conf(snd_timer_t **timer,
|
|||
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;
|
||||
}
|
||||
|
|
@ -181,7 +181,7 @@ static int snd_timer_open_noupdate(snd_timer_t **timer, snd_config_t *root, cons
|
|||
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);
|
||||
|
|
@ -331,7 +331,7 @@ int snd_async_add_timer_handler(snd_async_handler_t **handler, snd_timer_t *time
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ static int snd_timer_hw_async(snd_timer_t *timer, int sig, pid_t pid)
|
|||
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)
|
||||
|
|
@ -80,19 +80,19 @@ static int snd_timer_hw_async(snd_timer_t *timer, int sig, pid_t pid)
|
|||
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;
|
||||
|
|
@ -250,7 +250,7 @@ int snd_timer_hw_open(snd_timer_t **handle, const char *name, int dev_class, int
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -327,7 +327,7 @@ int _snd_timer_hw_open(snd_timer_t **timer, char *name,
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -46,30 +46,30 @@ static int snd_timer_query_open_conf(snd_timer_query_t **timer,
|
|||
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;
|
||||
}
|
||||
|
|
@ -83,7 +83,7 @@ static int snd_timer_query_open_conf(snd_timer_query_t **timer,
|
|||
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;
|
||||
|
|
@ -91,12 +91,12 @@ static int snd_timer_query_open_conf(snd_timer_query_t **timer,
|
|||
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;
|
||||
}
|
||||
|
|
@ -113,10 +113,10 @@ static int snd_timer_query_open_conf(snd_timer_query_t **timer,
|
|||
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;
|
||||
}
|
||||
|
|
@ -139,7 +139,7 @@ static int snd_timer_query_open_noupdate(snd_timer_query_t **timer, snd_config_t
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ int _snd_timer_query_hw_open(snd_timer_query_t **timer, char *name,
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -50,11 +50,15 @@ static ssize_t write_block_header(snd_tplg_t *tplg, unsigned int type,
|
|||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
|
|
@ -95,8 +99,9 @@ static int write_elem_block(snd_tplg_t *tplg,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -137,8 +142,9 @@ static int write_elem_block(snd_tplg_t *tplg,
|
|||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
|
|
@ -210,7 +216,7 @@ static ssize_t write_manifest_data(snd_tplg_t *tplg)
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -258,7 +264,7 @@ int tplg_write_data(snd_tplg_t *tplg)
|
|||
/* 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;
|
||||
}
|
||||
|
||||
|
|
@ -279,8 +285,9 @@ int tplg_write_data(snd_tplg_t *tplg)
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -289,8 +296,9 @@ int tplg_write_data(snd_tplg_t *tplg)
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ int tplg_parse_channel(snd_tplg_t *tplg, snd_config_t *cfg,
|
|||
|
||||
channel_id = lookup_channel(id);
|
||||
if (channel_id < 0) {
|
||||
SNDERR("invalid channel %s", id);
|
||||
snd_error(TOPOLOGY, "invalid channel %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ int parse_access(snd_config_t *cfg,
|
|||
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;
|
||||
|
|
@ -187,8 +187,9 @@ static int tplg_build_mixer_control(snd_tplg_t *tplg,
|
|||
}
|
||||
|
||||
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;
|
||||
|
|
@ -236,8 +237,9 @@ static int tplg_build_enum_control(snd_tplg_t *tplg,
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -358,7 +360,7 @@ static int tplg_parse_tlv_dbscale(snd_config_t *cfg, struct tplg_elem *elem)
|
|||
else if (strcmp(id, "mute") == 0)
|
||||
scale->mute = val;
|
||||
else
|
||||
SNDERR("unknown id '%s'", id);
|
||||
snd_error(TOPOLOGY, "unknown id '%s'", id);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
@ -387,7 +389,7 @@ int tplg_parse_tlv(snd_tplg_t *tplg, snd_config_t *cfg,
|
|||
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;
|
||||
|
|
@ -407,7 +409,7 @@ int tplg_save_tlv(snd_tplg_t *tplg ATTRIBUTE_UNUSED,
|
|||
int err;
|
||||
|
||||
if (tlv->type != SNDRV_CTL_TLVT_DB_SCALE) {
|
||||
SNDERR("unknown TLV type");
|
||||
snd_error(TOPOLOGY, "unknown TLV type");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -650,7 +652,7 @@ int tplg_parse_control_enum(snd_tplg_t *tplg, snd_config_t *cfg,
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -778,7 +780,7 @@ int tplg_parse_control_mixer(snd_tplg_t *tplg,
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -936,7 +938,7 @@ static int init_ctl_hdr(snd_tplg_t *tplg,
|
|||
struct snd_soc_tplg_tlv_dbscale *scale;
|
||||
|
||||
if (!tlvt) {
|
||||
SNDERR("missing TLV data");
|
||||
snd_error(TOPOLOGY, "missing TLV data");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -966,7 +968,7 @@ static int init_ctl_hdr(snd_tplg_t *tplg,
|
|||
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
|
|
@ -985,7 +987,7 @@ int tplg_add_mixer(snd_tplg_t *tplg, struct snd_tplg_mixer_template *mixer,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1049,7 +1051,7 @@ int tplg_add_enum(snd_tplg_t *tplg, struct snd_tplg_enum_template *enum_ctl,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1140,7 +1142,7 @@ int tplg_add_bytes(snd_tplg_t *tplg, struct snd_tplg_bytes_template *bytes_ctl,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1177,8 +1179,9 @@ int tplg_add_bytes(snd_tplg_t *tplg, struct snd_tplg_bytes_template *bytes_ctl,
|
|||
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;
|
||||
}
|
||||
|
|
@ -1221,14 +1224,14 @@ int tplg_decode_control_mixer1(snd_tplg_t *tplg,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1258,8 +1261,9 @@ int tplg_decode_control_mixer1(snd_tplg_t *tplg,
|
|||
/* 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));
|
||||
|
|
@ -1273,7 +1277,7 @@ int tplg_decode_control_mixer1(snd_tplg_t *tplg,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1301,15 +1305,16 @@ int tplg_decode_control_mixer(snd_tplg_t *tplg,
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1342,11 +1347,11 @@ int tplg_decode_control_enum1(snd_tplg_t *tplg,
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1404,15 +1409,16 @@ int tplg_decode_control_enum(snd_tplg_t *tplg,
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1446,14 +1452,14 @@ int tplg_decode_control_bytes1(snd_tplg_t *tplg,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1495,14 +1501,15 @@ int tplg_decode_control_bytes(snd_tplg_t *tplg,
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -154,8 +154,9 @@ static int tplg_build_widget(snd_tplg_t *tplg, struct tplg_elem *elem)
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -178,7 +179,7 @@ int tplg_build_widgets(snd_tplg_t *tplg)
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -205,7 +206,7 @@ int tplg_build_routes(snd_tplg_t *tplg)
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -215,13 +216,13 @@ int tplg_build_routes(snd_tplg_t *tplg)
|
|||
|
||||
/* 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 */
|
||||
|
|
@ -230,21 +231,23 @@ int tplg_build_routes(snd_tplg_t *tplg)
|
|||
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 */
|
||||
|
|
@ -296,7 +299,7 @@ static int tplg_parse_line(const char *text,
|
|||
|
||||
len = strlen(buf);
|
||||
if (len <= 2) {
|
||||
SNDERR("invalid route \"%s\"", buf);
|
||||
snd_error(TOPOLOGY, "invalid route \"%s\"", buf);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -305,7 +308,7 @@ static int tplg_parse_line(const char *text,
|
|||
if (buf[i] == ',')
|
||||
goto second;
|
||||
}
|
||||
SNDERR("invalid route \"%s\"", buf);
|
||||
snd_error(TOPOLOGY, "invalid route \"%s\"", buf);
|
||||
return -EINVAL;
|
||||
|
||||
second:
|
||||
|
|
@ -319,7 +322,7 @@ second:
|
|||
goto done;
|
||||
}
|
||||
|
||||
SNDERR("invalid route \"%s\"", buf);
|
||||
snd_error(TOPOLOGY, "invalid route \"%s\"", buf);
|
||||
return -EINVAL;
|
||||
|
||||
done:
|
||||
|
|
@ -374,7 +377,7 @@ int tplg_parse_dapm_graph(snd_tplg_t *tplg, snd_config_t *cfg,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -397,14 +400,16 @@ int tplg_parse_dapm_graph(snd_tplg_t *tplg, snd_config_t *cfg,
|
|||
|
||||
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;
|
||||
|
|
@ -545,8 +550,9 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg,
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -847,8 +853,9 @@ int tplg_add_widget_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t)
|
|||
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;
|
||||
}
|
||||
|
|
@ -898,17 +905,19 @@ next:
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -934,8 +943,9 @@ next:
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -962,8 +972,9 @@ next:
|
|||
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;
|
||||
}
|
||||
|
|
@ -982,8 +993,9 @@ next:
|
|||
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;
|
||||
}
|
||||
|
|
@ -1001,8 +1013,9 @@ next:
|
|||
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;
|
||||
}
|
||||
|
|
@ -1010,8 +1023,9 @@ next:
|
|||
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;
|
||||
}
|
||||
|
|
@ -1059,7 +1073,7 @@ int tplg_decode_dapm_graph(snd_tplg_t *tplg,
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -60,8 +60,9 @@ struct snd_soc_tplg_private *get_priv_data(struct tplg_elem *elem)
|
|||
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;
|
||||
|
|
@ -94,7 +95,7 @@ int tplg_parse_refs(snd_config_t *cfg, struct tplg_elem *elem,
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -183,7 +184,7 @@ static int tplg_parse_data_file(snd_config_t *cfg, struct tplg_elem *elem)
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -191,12 +192,12 @@ static int tplg_parse_data_file(snd_config_t *cfg, struct tplg_elem *elem)
|
|||
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;
|
||||
}
|
||||
|
|
@ -218,7 +219,7 @@ static int tplg_parse_data_file(snd_config_t *cfg, struct tplg_elem *elem)
|
|||
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;
|
||||
|
|
@ -359,7 +360,7 @@ static int get_uuid(const char *str, unsigned char *uuid_le)
|
|||
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;
|
||||
}
|
||||
|
|
@ -383,7 +384,7 @@ data2:
|
|||
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;
|
||||
}
|
||||
|
|
@ -398,7 +399,7 @@ data2:
|
|||
}
|
||||
|
||||
if (values < 16) {
|
||||
SNDERR("less than 16 integers for uuid");
|
||||
snd_error(TOPOLOGY, "less than 16 integers for uuid");
|
||||
ret = -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -475,7 +476,7 @@ static int tplg_parse_data_hex(snd_config_t *cfg, struct tplg_elem *elem,
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -483,7 +484,7 @@ static int tplg_parse_data_hex(snd_config_t *cfg, struct tplg_elem *elem,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -521,7 +522,7 @@ static int get_token_value(const char *token_id,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -609,7 +610,7 @@ static int copy_tuples(struct tplg_elem *elem,
|
|||
* 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;
|
||||
}
|
||||
|
||||
|
|
@ -693,13 +694,13 @@ static int build_tuples(snd_tplg_t *tplg, struct tplg_elem *elem)
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -795,7 +796,7 @@ static int parse_tuple_set(snd_config_t *cfg,
|
|||
|
||||
type = get_tuple_type(id);
|
||||
if (type < 0) {
|
||||
SNDERR("invalid tuple type '%s'", id);
|
||||
snd_error(TOPOLOGY, "invalid tuple type '%s'", id);
|
||||
return type;
|
||||
}
|
||||
|
||||
|
|
@ -852,7 +853,7 @@ static int parse_tuple_set(snd_config_t *cfg,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -862,7 +863,7 @@ static int parse_tuple_set(snd_config_t *cfg,
|
|||
&& 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;
|
||||
}
|
||||
|
||||
|
|
@ -976,7 +977,7 @@ static int parse_tuple_sets(snd_config_t *cfg,
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -994,8 +995,9 @@ static int parse_tuple_sets(snd_config_t *cfg,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1204,7 +1206,7 @@ int tplg_parse_manifest_data(snd_tplg_t *tplg, snd_config_t *cfg,
|
|||
int err;
|
||||
|
||||
if (!list_empty(&tplg->manifest_list)) {
|
||||
SNDERR("already has manifest data");
|
||||
snd_error(TOPOLOGY, "already has manifest data");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -1364,7 +1366,7 @@ int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg,
|
|||
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;
|
||||
|
|
@ -1373,7 +1375,7 @@ int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg,
|
|||
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;
|
||||
|
|
@ -1382,7 +1384,7 @@ int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg,
|
|||
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;
|
||||
|
|
@ -1391,7 +1393,7 @@ int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg,
|
|||
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;
|
||||
|
|
@ -1508,8 +1510,9 @@ int tplg_copy_data(snd_tplg_t *tplg, struct tplg_elem *elem,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1579,24 +1582,25 @@ int tplg_decode_manifest_data(snd_tplg_t *tplg,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1718,7 +1722,7 @@ static int tplg_decode_tuple_set(snd_tplg_t *tplg,
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1731,20 +1735,21 @@ static int tplg_decode_tuple_set(snd_tplg_t *tplg,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1841,19 +1846,19 @@ static int tplg_decode_tuples(snd_tplg_t *tplg,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1893,7 +1898,7 @@ int tplg_add_data(snd_tplg_t *tplg,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1997,6 +2002,6 @@ int tplg_decode_data(snd_tplg_t *tplg ATTRIBUTE_UNUSED,
|
|||
void *bin ATTRIBUTE_UNUSED,
|
||||
size_t size ATTRIBUTE_UNUSED)
|
||||
{
|
||||
SNDERR("data type not expected");
|
||||
snd_error(TOPOLOGY, "data type not expected");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,40 +61,40 @@ int snd_tplg_decode(snd_tplg_t *tplg, void *bin, size_t size, int dflags)
|
|||
}
|
||||
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);
|
||||
|
|
@ -109,7 +109,7 @@ int snd_tplg_decode(snd_tplg_t *tplg, void *bin, size_t size, int dflags)
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ int tplg_get_type(int asoc_type)
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ static int lookup_ops(const char *c)
|
|||
/* 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ int tplg_parse_compound(snd_tplg_t *tplg, snd_config_t *cfg,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -129,8 +129,9 @@ int tplg_parse_compound(snd_tplg_t *tplg, snd_config_t *cfg,
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -153,7 +154,7 @@ static int tplg_parse_config(snd_tplg_t *tplg, snd_config_t *cfg)
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -178,7 +179,7 @@ static int tplg_parse_config(snd_tplg_t *tplg, snd_config_t *cfg)
|
|||
}
|
||||
|
||||
if (parser == NULL) {
|
||||
SNDERR("unknown section %s", id);
|
||||
snd_error(TOPOLOGY, "unknown section %s", id);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -200,7 +201,7 @@ static int tplg_load_config(snd_tplg_t *tplg, snd_input_t *in)
|
|||
|
||||
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;
|
||||
}
|
||||
|
|
@ -208,7 +209,7 @@ static int tplg_load_config(snd_tplg_t *tplg, snd_input_t *in)
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -265,7 +266,7 @@ int snd_tplg_load(snd_tplg_t *tplg, const char *buf, size_t size)
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -280,13 +281,13 @@ static int tplg_build(snd_tplg_t *tplg)
|
|||
|
||||
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;
|
||||
|
|
@ -302,14 +303,14 @@ int snd_tplg_build_file(snd_tplg_t *tplg,
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -343,7 +344,7 @@ int snd_tplg_add_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t)
|
|||
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;
|
||||
};
|
||||
}
|
||||
|
|
@ -359,18 +360,18 @@ int snd_tplg_build(snd_tplg_t *tplg, const char *outfile)
|
|||
|
||||
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;
|
||||
|
|
@ -436,7 +437,7 @@ snd_tplg_t *snd_tplg_create(int flags)
|
|||
snd_tplg_t *tplg;
|
||||
|
||||
if (!is_little_endian()) {
|
||||
SNDERR("cannot support big-endian machines");
|
||||
snd_error(TOPOLOGY, "cannot support big-endian machines");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -115,8 +115,9 @@ static int build_pcm(snd_tplg_t *tplg, struct tplg_elem *elem)
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -136,7 +137,7 @@ int tplg_build_pcms(snd_tplg_t *tplg, unsigned int type)
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -195,7 +196,7 @@ int tplg_build_dais(snd_tplg_t *tplg, unsigned int type)
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -250,9 +251,10 @@ static int build_link(snd_tplg_t *tplg, struct tplg_elem *elem)
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -320,7 +322,7 @@ static int split_format(struct snd_soc_tplg_stream_caps *caps, char *str)
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -363,7 +365,7 @@ static int split_rate(struct snd_soc_tplg_stream_caps *caps, char *str)
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -762,7 +764,7 @@ static int tplg_parse_fe_dai(snd_tplg_t *tplg ATTRIBUTE_UNUSED,
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1413,7 +1415,7 @@ static int get_audio_hw_format(const char *val)
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1480,7 +1482,7 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg,
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1494,17 +1496,17 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg,
|
|||
/* 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")) {
|
||||
|
|
@ -1532,7 +1534,7 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg,
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1546,17 +1548,17 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg,
|
|||
/* 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")) {
|
||||
|
|
@ -1598,7 +1600,7 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg,
|
|||
/* 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")) {
|
||||
|
|
@ -2016,20 +2018,21 @@ next:
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -2054,8 +2057,9 @@ next:
|
|||
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;
|
||||
|
|
@ -2075,8 +2079,9 @@ next:
|
|||
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;
|
||||
|
|
@ -2123,7 +2128,7 @@ int tplg_decode_dai(snd_tplg_t *tplg ATTRIBUTE_UNUSED,
|
|||
void *bin ATTRIBUTE_UNUSED,
|
||||
size_t size ATTRIBUTE_UNUSED)
|
||||
{
|
||||
SNDERR("not implemented");
|
||||
snd_error(TOPOLOGY, "not implemented");
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
|
|
@ -2134,7 +2139,7 @@ int tplg_decode_cc(snd_tplg_t *tplg ATTRIBUTE_UNUSED,
|
|||
void *bin ATTRIBUTE_UNUSED,
|
||||
size_t size ATTRIBUTE_UNUSED)
|
||||
{
|
||||
SNDERR("not implemented");
|
||||
snd_error(TOPOLOGY, "not implemented");
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
|
|
@ -2165,24 +2170,25 @@ next:
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -2204,8 +2210,9 @@ next:
|
|||
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;
|
||||
|
|
@ -2222,8 +2229,9 @@ next:
|
|||
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;
|
||||
|
|
@ -2243,14 +2251,14 @@ next:
|
|||
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++)
|
||||
|
|
|
|||
|
|
@ -446,8 +446,9 @@ static int tplg_save(snd_tplg_t *tplg, struct tplg_buf *dst,
|
|||
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;
|
||||
}
|
||||
|
|
@ -482,8 +483,9 @@ static int tplg_save(snd_tplg_t *tplg, struct tplg_buf *dst,
|
|||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -607,7 +609,7 @@ int snd_tplg_save(snd_tplg_t *tplg, char **dst, int flags)
|
|||
/* 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;
|
||||
}
|
||||
|
||||
|
|
@ -620,7 +622,7 @@ int snd_tplg_save(snd_tplg_t *tplg, char **dst, int flags)
|
|||
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;
|
||||
}
|
||||
|
|
@ -628,7 +630,7 @@ int snd_tplg_save(snd_tplg_t *tplg, char **dst, int flags)
|
|||
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;
|
||||
|
|
@ -641,7 +643,7 @@ int snd_tplg_save(snd_tplg_t *tplg, char **dst, int flags)
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ int tplg_parse_text(snd_tplg_t *tplg, snd_config_t *cfg,
|
|||
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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue