srvname = argv[optind];
err = snd_config_searchv(snd_config, &conf, "server", srvname, 0);
if (err < 0) {
- ERROR("unknown server %s", srvname);
+ ERROR("Missing definition for server %s", srvname);
return 1;
}
snd_config_foreach(i, conf) {
if (strcmp(n->id, "host") == 0) {
err = snd_config_string_get(n, &host);
if (err < 0) {
- ERROR("Invalid type for host");
+ ERROR("Invalid type for %s", n->id);
return 1;
}
continue;
if (strcmp(n->id, "socket") == 0) {
err = snd_config_string_get(n, &socket);
if (err < 0) {
- ERROR("Invalid type for socket");
+ ERROR("Invalid type for %s", n->id);
return 1;
}
continue;
if (strcmp(n->id, "port") == 0) {
err = snd_config_integer_get(n, &port);
if (err < 0) {
- ERROR("Invalid type for port");
+ ERROR("Invalid type for %s", n->id);
return 1;
}
continue;
}
- ERROR("Unknown field: %s", n->id);
+ ERROR("Unknown field %s", n->id);
return 1;
}
if (!host) {
if (strcmp(n->id, "server") == 0) {
err = snd_config_string_get(n, &server);
if (err < 0) {
- ERR("Invalid type for server");
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
}
continue;
if (strcmp(n->id, "sname") == 0) {
err = snd_config_string_get(n, &sname);
if (err < 0) {
- ERR("Invalid type for sname");
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
}
continue;
}
- ERR("Unknown field: %s", n->id);
+ ERR("Unknown field %s", n->id);
return -EINVAL;
}
if (!sname) {
if (strcmp(n->id, "host") == 0) {
err = snd_config_string_get(n, &host);
if (err < 0) {
- ERR("Invalid type for host");
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
}
continue;
if (strcmp(n->id, "socket") == 0) {
err = snd_config_string_get(n, &socket);
if (err < 0) {
- ERR("Invalid type for socket");
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
}
continue;
if (strcmp(n->id, "port") == 0) {
err = snd_config_integer_get(n, &port);
if (err < 0) {
- ERR("Invalid type for port");
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
}
continue;
}
- ERR("Unknown field: %s", n->id);
+ ERR("Unknown field %s", n->id);
return -EINVAL;
}
return -ENOENT;
}
if (snd_config_type(pcm_conf) != SND_CONFIG_TYPE_COMPOUND) {
- ERR("Invalid type for PCM definition");
+ ERR("Invalid type for PCM %s definition", name);
return -EINVAL;
}
err = snd_config_search(pcm_conf, "stream", &conf);
if (err >= 0) {
err = snd_config_string_get(conf, &str);
if (err < 0) {
- ERR("Invalid type for stream");
+ ERR("Invalid type for %s", conf->id);
return err;
}
if (strcmp(str, "playback") == 0) {
if (stream != SND_PCM_STREAM_CAPTURE)
return -EINVAL;
} else {
- ERR("Invalid value for stream");
+ ERR("Invalid value for %s", conf->id);
return -EINVAL;
}
}
}
err = snd_config_string_get(conf, &str);
if (err < 0) {
- ERR("Invalid type for type");
+ ERR("Invalid type for %s", conf->id);
return err;
}
err = snd_config_searchv(snd_config, &type_conf, "pcmtype", str, 0);
if (strcmp(n->id, "lib") == 0) {
err = snd_config_string_get(n, &lib);
if (err < 0) {
- ERR("Invalid type for lib");
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
}
continue;
if (strcmp(n->id, "open") == 0) {
err = snd_config_string_get(n, &open);
if (err < 0) {
- ERR("Invalid type for open");
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
}
continue;
- ERR("Unknown field: %s", n->id);
+ ERR("Unknown field %s", n->id);
return -EINVAL;
}
}
params->fail_mask = snd_pcm_hw_info_fail_mask(&info);
return err;
}
+ params->fail_mask = 0;
if ((err = pcm->ops->hw_params(pcm->op_arg, params)) < 0)
return err;
continue;
if (strcmp(n->id, "sname") == 0) {
err = snd_config_string_get(n, &sname);
- if (err < 0)
+ if (err < 0) {
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
+ }
continue;
}
if (strcmp(n->id, "sformat") == 0) {
char *f;
err = snd_config_string_get(n, &f);
- if (err < 0)
+ if (err < 0) {
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
+ }
sformat = snd_pcm_format_value(f);
- if (sformat < 0)
+ if (sformat < 0) {
+ ERR("Unknown sformat");
return -EINVAL;
+ }
if (snd_pcm_format_linear(sformat) != 1 &&
- sformat != SND_PCM_FORMAT_IMA_ADPCM)
+ sformat != SND_PCM_FORMAT_IMA_ADPCM) {
+ ERR("Invalid sformat");
return -EINVAL;
+ }
continue;
}
+ ERR("Unknown field %s", n->id);
return -EINVAL;
}
- if (!sname || !sformat)
+ if (!sname) {
+ ERR("sname is not defined");
return -EINVAL;
+ }
+ if (sformat < 0) {
+ ERR("sformat is not defined");
+ return -EINVAL;
+ }
/* This is needed cause snd_config_update may destroy config */
sname = strdup(sname);
if (!sname)
continue;
if (strcmp(n->id, "sname") == 0) {
err = snd_config_string_get(n, &sname);
- if (err < 0)
+ if (err < 0) {
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
+ }
continue;
}
if (strcmp(n->id, "sformat") == 0) {
char *f;
err = snd_config_string_get(n, &f);
- if (err < 0)
+ if (err < 0) {
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
+ }
sformat = snd_pcm_format_value(f);
- if (sformat < 0)
+ if (sformat < 0) {
+ ERR("Unknown sformat");
return -EINVAL;
+ }
if (snd_pcm_format_linear(sformat) != 1 &&
- sformat != SND_PCM_FORMAT_A_LAW)
+ sformat != SND_PCM_FORMAT_A_LAW) {
+ ERR("Invalid sformat");
return -EINVAL;
+ }
continue;
}
+ ERR("Unknown field %s", n->id);
return -EINVAL;
}
- if (!sname || !sformat)
+ if (!sname) {
+ ERR("sname is not defined");
return -EINVAL;
+ }
+ if (sformat < 0) {
+ ERR("sformat is not defined");
+ return -EINVAL;
+ }
/* This is needed cause snd_config_update may destroy config */
sname = strdup(sname);
if (!sname)
continue;
if (strcmp(n->id, "sname") == 0) {
err = snd_config_string_get(n, &sname);
- if (err < 0)
+ if (err < 0) {
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
+ }
continue;
}
if (strcmp(n->id, "format") == 0) {
err = snd_config_string_get(n, &format);
- if (err < 0)
+ if (err < 0) {
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
+ }
continue;
}
if (strcmp(n->id, "file") == 0) {
err = snd_config_string_get(n, &fname);
if (err < 0) {
err = snd_config_integer_get(n, &fd);
- if (err < 0)
+ if (err < 0) {
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
+ }
}
continue;
}
+ ERR("Unknown field %s", n->id);
return -EINVAL;
}
- if (!sname || (!fname && fd < 0))
+ if (!sname) {
+ ERR("sname is not defined");
return -EINVAL;
+ }
+ if (!fname && fd < 0) {
+ ERR("file is not defined");
+ return -EINVAL;
+ }
if (fname) {
fname = strdup(fname);
if (!fname)
err = snd_config_integer_get(n, &card);
if (err < 0) {
err = snd_config_string_get(n, &str);
- if (err < 0)
+ if (err < 0) {
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
+ }
card = snd_card_get_index(str);
- if (card < 0)
+ if (card < 0) {
+ ERR("Invalid value for %s", n->id);
return card;
+ }
}
continue;
}
if (strcmp(n->id, "device") == 0) {
err = snd_config_integer_get(n, &device);
- if (err < 0)
+ if (err < 0) {
+ ERR("Invalid type for %s", n->id);
return err;
+ }
continue;
}
if (strcmp(n->id, "subdevice") == 0) {
err = snd_config_integer_get(n, &subdevice);
- if (err < 0)
+ if (err < 0) {
+ ERR("Invalid type for %s", n->id);
return err;
+ }
continue;
}
+ ERR("Unknown field %s", n->id);
return -EINVAL;
}
- if (card < 0)
+ if (card < 0) {
+ ERR("card is not defined");
return -EINVAL;
+ }
return snd_pcm_hw_open(pcmp, name, card, device, subdevice, stream, mode);
}
continue;
if (strcmp(n->id, "sname") == 0) {
err = snd_config_string_get(n, &sname);
- if (err < 0)
+ if (err < 0) {
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
+ }
continue;
}
if (strcmp(n->id, "sformat") == 0) {
char *f;
err = snd_config_string_get(n, &f);
- if (err < 0)
+ if (err < 0) {
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
+ }
sformat = snd_pcm_format_value(f);
- if (sformat < 0)
+ if (sformat < 0) {
+ ERR("Unknown sformat");
return -EINVAL;
- if (snd_pcm_format_linear(sformat) != 1)
+ }
+ if (snd_pcm_format_linear(sformat) != 1) {
+ ERR("sformat is not linear");
return -EINVAL;
+ }
continue;
}
+ ERR("Unknown field %s", n->id);
return -EINVAL;
}
- if (!sname || !sformat)
+ if (!sname) {
+ ERR("sname is not defined");
return -EINVAL;
+ }
+ if (sformat < 0) {
+ ERR("sformat is not defined");
+ return -EINVAL;
+ }
/* This is needed cause snd_config_update may destroy config */
sname = strdup(sname);
if (!sname)
continue;
if (strcmp(n->id, "sname") == 0) {
err = snd_config_string_get(n, &sname);
- if (err < 0)
+ if (err < 0) {
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
+ }
continue;
}
if (strcmp(n->id, "sformat") == 0) {
char *f;
err = snd_config_string_get(n, &f);
- if (err < 0)
+ if (err < 0) {
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
+ }
sformat = snd_pcm_format_value(f);
- if (sformat < 0)
+ if (sformat < 0) {
+ ERR("Unknown sformat");
return -EINVAL;
+ }
if (snd_pcm_format_linear(sformat) != 1 &&
- sformat != SND_PCM_FORMAT_MU_LAW)
+ sformat != SND_PCM_FORMAT_MU_LAW) {
+ ERR("Invalid sformat");
return -EINVAL;
+ }
continue;
}
+ ERR("Unknown field %s", n->id);
return -EINVAL;
}
- if (!sname || !sformat)
+ if (!sname) {
+ ERR("sname is not defined");
return -EINVAL;
+ }
+ if (sformat < 0) {
+ ERR("sformat is not defined");
+ return -EINVAL;
+ }
/* This is needed cause snd_config_update may destroy config */
sname = strdup(sname);
if (!sname)
if (strcmp(n->id, "stream") == 0)
continue;
if (strcmp(n->id, "slave") == 0) {
- if (snd_config_type(n) != SND_CONFIG_TYPE_COMPOUND)
+ if (snd_config_type(n) != SND_CONFIG_TYPE_COMPOUND) {
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
+ }
slave = n;
continue;
}
if (strcmp(n->id, "binding") == 0) {
- if (snd_config_type(n) != SND_CONFIG_TYPE_COMPOUND)
+ if (snd_config_type(n) != SND_CONFIG_TYPE_COMPOUND) {
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
+ }
binding = n;
continue;
}
+ ERR("Unknown field %s", n->id);
+ return -EINVAL;
+ }
+ if (!slave) {
+ ERR("slave is not defined");
return -EINVAL;
}
- if (!slave || !binding)
+ if (!binding) {
+ ERR("binding is not defined");
return -EINVAL;
+ }
snd_config_foreach(i, slave) {
++slaves_count;
}
snd_config_t *m = snd_config_entry(i);
errno = 0;
cchannel = strtol(m->id, &p, 10);
- if (errno || *p || cchannel < 0)
+ if (errno || *p || cchannel < 0) {
+ ERR("Invalid channel number: %s", m->id);
return -EINVAL;
+ }
if ((unsigned)cchannel >= channels_count)
channels_count = cchannel + 1;
}
- if (channels_count == 0)
+ if (channels_count == 0) {
+ ERR("No cannels defined");
return -EINVAL;
+ }
slaves_id = calloc(slaves_count, sizeof(*slaves_id));
slaves_name = calloc(slaves_count, sizeof(*slaves_name));
slaves_pcm = calloc(slaves_count, sizeof(*slaves_pcm));
idx = 0;
for (idx = 0; idx < channels_count; ++idx)
channels_sidx[idx] = -1;
+ idx = 0;
snd_config_foreach(i, slave) {
snd_config_t *m = snd_config_entry(i);
char *name = NULL;
long channels = -1;
- slaves_id[idx] = snd_config_id(m);
+ slaves_id[idx] = m->id;
snd_config_foreach(j, m) {
snd_config_t *n = snd_config_entry(j);
if (strcmp(n->id, "comment") == 0)
continue;
if (strcmp(n->id, "name") == 0) {
err = snd_config_string_get(n, &name);
- if (err < 0)
+ if (err < 0) {
+ ERR("Invalid type for %s", n->id);
goto _free;
+ }
continue;
}
if (strcmp(n->id, "channels") == 0) {
err = snd_config_integer_get(n, &channels);
- if (err < 0)
+ if (err < 0) {
+ ERR("Invalid type for %s", n->id);
goto _free;
+ }
continue;
}
+ ERR("Unknown field %s", n->id);
err = -EINVAL;
goto _free;
}
- if (!name || channels < 0) {
+ if (!name) {
+ ERR("name is not defined");
+ err = -EINVAL;
+ goto _free;
+ }
+ if (channels < 0) {
+ ERR("channels is not defined");
err = -EINVAL;
goto _free;
}
long val;
char *str;
cchannel = strtol(m->id, 0, 10);
+ if (cchannel < 0) {
+ ERR("Invalid channel number: %s", m->id);
+ err = -EINVAL;
+ goto _free;
+ }
snd_config_foreach(j, m) {
snd_config_t *n = snd_config_entry(j);
if (strcmp(n->id, "comment") == 0)
err = snd_config_string_get(n, &str);
if (err < 0) {
err = snd_config_integer_get(n, &val);
- if (err < 0)
+ if (err < 0) {
+ ERR("Invalid value for %s", n->id);
goto _free;
+ }
sprintf(buf, "%ld", val);
str = buf;
}
}
if (strcmp(n->id, "schannel") == 0) {
err = snd_config_integer_get(n, &schannel);
- if (err < 0)
+ if (err < 0) {
+ ERR("Invalid type for %s", n->id);
goto _free;
+ }
continue;
}
+ ERR("Unknown field %s", n->id);
err = -EINVAL;
goto _free;
}
- if (cchannel < 0 || slave < 0 || schannel < 0) {
- err = -EINVAL;
- goto _free;
- }
- if ((size_t)slave >= slaves_count) {
+ if (slave < 0 || (size_t)slave >= slaves_count) {
+ ERR("Invalid or missing sidx");
err = -EINVAL;
goto _free;
}
- if ((unsigned int) schannel >= slaves_channels[slave]) {
+ if (schannel < 0 ||
+ (unsigned int) schannel >= slaves_channels[slave]) {
+ ERR("Invalid or missing schannel");
err = -EINVAL;
goto _free;
}
continue;
if (strcmp(n->id, "stream") == 0)
continue;
+ ERR("Unknown field %s", n->id);
return -EINVAL;
}
return snd_pcm_null_open(pcmp, name, stream, mode);
sinfo.buffer_size_min = muldiv_down(info->buffer_size_min, sinfo.rate_min, info->rate_max);
sinfo.buffer_size_max = muldiv_up(info->buffer_size_max, sinfo.rate_max, info->rate_min);
- err = snd_pcm_hw_info(slave, &sinfo);
+ /* FIXME: tricky here. This is not the right way to cope with this */
+ if (info->rate_min == info->rate_max) {
+ snd_pcm_hw_info_t i1 = sinfo;
+ snd_pcm_hw_info_t i2 = sinfo;
+ int err1, err2;
+ unsigned int rate = info->rate_min;
+ i1.rate_max = rate;
+ err1 = snd_pcm_hw_info(slave, &i1);
+ if (err1 < 0 || rate - i1.rate_max > 1) {
+ i2.rate_min = rate + 1;
+ err2 = snd_pcm_hw_info(slave, &i2);
+ } else
+ err2 = -EINVAL;
+ if (err1 < 0) {
+ sinfo = i2;
+ if (err2 >= 0)
+ sinfo.rate_max = sinfo.rate_min;
+ err = err2;
+ } else {
+ if (err2 < 0 ||
+ rate - i1.rate_max <= i2.rate_min - rate) {
+ sinfo = i1;
+ sinfo.rate_min = sinfo.rate_max;
+ err = err1;
+ } else {
+ sinfo = i2;
+ sinfo.rate_max = sinfo.rate_min;
+ err = err2;
+ }
+ }
+ } else
+ err = snd_pcm_hw_info(slave, &sinfo);
info->subformat_mask = sinfo.subformat_mask;
info->fragments_min = sinfo.fragments_min;
info->fragments_max = sinfo.fragments_max;
size = muldiv_up(sinfo.fragment_size_max, info->rate_max, sinfo.rate_min);
if (info->fragment_size_max > size)
info->fragment_size_max = size;
+ if (info->fragment_size_min > info->fragment_size_max)
+ return -EINVAL;
size = muldiv_down(sinfo.buffer_size_min, info->rate_min, sinfo.rate_max);
if (info->buffer_size_min < size)
size = muldiv_up(sinfo.buffer_size_max, info->rate_max, sinfo.rate_min);
if (info->buffer_size_max > size)
info->buffer_size_max = size;
+ if (info->buffer_size_min > info->buffer_size_max)
+ return -EINVAL;
n = info->buffer_size_min / info->fragment_size_max;
if (info->fragments_min < n)
n = info->buffer_size_max / info->fragment_size_min;
if (info->fragments_max > n)
info->fragments_max = n;
+ if (info->fragments_min > info->fragments_max)
+ return -EINVAL;
if (err < 0)
return err;
unsigned int nformats;
int err;
- params->fail_mask = 0;
-
sparams = *params;
snd_pcm_hw_params_to_info(&sparams, &sinfo);
sinfo.access_mask = SND_PCM_ACCBIT_MMAP;
continue;
if (strcmp(n->id, "sname") == 0) {
err = snd_config_string_get(n, &sname);
- if (err < 0)
+ if (err < 0) {
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
+ }
continue;
}
if (strcmp(n->id, "ttable") == 0) {
- if (snd_config_type(n) != SND_CONFIG_TYPE_COMPOUND)
+ if (snd_config_type(n) != SND_CONFIG_TYPE_COMPOUND) {
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
+ }
tt = n;
continue;
}
+ ERR("Unknown field %s", n->id);
return -EINVAL;
}
- if (!sname)
+ if (!sname) {
+ ERR("sname is not defined");
return -EINVAL;
+ }
if (tt) {
ttable = malloc(MAX_CHANNELS * MAX_CHANNELS * sizeof(*ttable));
err = snd_pcm_route_load_ttable(tt, ttable, MAX_CHANNELS, MAX_CHANNELS,
continue;
if (strcmp(n->id, "stream") == 0)
continue;
- if (strcmp(n->id, "sname") == 0) {
+ if (strcmp(n->id, "sname") == 0) {
err = snd_config_string_get(n, &sname);
- if (err < 0)
+ if (err < 0) {
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
+ }
continue;
}
if (strcmp(n->id, "sformat") == 0) {
char *f;
err = snd_config_string_get(n, &f);
- if (err < 0)
+ if (err < 0) {
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
+ }
sformat = snd_pcm_format_value(f);
- if (sformat < 0)
+ if (sformat < 0) {
+ ERR("Unknown sformat");
return -EINVAL;
- if (snd_pcm_format_linear(sformat) != 1)
+ }
+ if (snd_pcm_format_linear(sformat) != 1) {
+ ERR("sformat is not linear");
return -EINVAL;
+ }
continue;
}
if (strcmp(n->id, "srate") == 0) {
err = snd_config_integer_get(n, &srate);
- if (err < 0)
+ if (err < 0) {
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
+ }
continue;
}
+ ERR("Unknown field %s", n->id);
return -EINVAL;
}
- if (!sname || !srate)
+ if (!sname) {
+ ERR("sname is not defined");
return -EINVAL;
+ }
+ if (srate < 0) {
+ ERR("srate is not defined");
+ return -EINVAL;
+ }
/* This is needed cause snd_config_update may destroy config */
sname = strdup(sname);
if (!sname)
errno = 0;
cchannel = strtol(in->id, &p, 10);
if (errno || *p ||
- cchannel < 0 || (unsigned int) cchannel > tt_csize)
+ cchannel < 0 || (unsigned int) cchannel > tt_csize) {
+ ERR("Invalid client channel: %s", in->id);
return -EINVAL;
+ }
if (snd_config_type(in) != SND_CONFIG_TYPE_COMPOUND)
return -EINVAL;
snd_config_foreach(j, in) {
schannel = strtol(jn->id, &p, 10);
if (errno || *p ||
schannel < 0 || (unsigned int) schannel > tt_ssize ||
- (schannels > 0 && schannel >= schannels))
+ (schannels > 0 && schannel >= schannels)) {
+ ERR("Invalid slave channel: %s", jn->id);
return -EINVAL;
+ }
err = snd_config_real_get(jn, &value);
if (err < 0) {
long v;
err = snd_config_integer_get(jn, &v);
- if (err < 0)
+ if (err < 0) {
+ ERR("Invalid type for %s", jn->id);
return -EINVAL;
+ }
value = v;
}
ttable[cchannel * tt_ssize + schannel] = value;
continue;
if (strcmp(n->id, "sname") == 0) {
err = snd_config_string_get(n, &sname);
- if (err < 0)
+ if (err < 0) {
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
+ }
continue;
}
if (strcmp(n->id, "sformat") == 0) {
char *f;
err = snd_config_string_get(n, &f);
- if (err < 0)
+ if (err < 0) {
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
+ }
sformat = snd_pcm_format_value(f);
- if (sformat < 0)
+ if (sformat < 0) {
+ ERR("Unknown sformat");
return -EINVAL;
- if (snd_pcm_format_linear(sformat) != 1)
+ }
+ if (snd_pcm_format_linear(sformat) != 1) {
+ ERR("sformat is not linear");
return -EINVAL;
+ }
continue;
}
if (strcmp(n->id, "schannels") == 0) {
err = snd_config_integer_get(n, &schannels);
- if (err < 0)
+ if (err < 0) {
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
+ }
continue;
}
if (strcmp(n->id, "ttable") == 0) {
- if (snd_config_type(n) != SND_CONFIG_TYPE_COMPOUND)
+ if (snd_config_type(n) != SND_CONFIG_TYPE_COMPOUND) {
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
+ }
tt = n;
continue;
}
+ ERR("Unknown field %s", n->id);
return -EINVAL;
}
- if (!sname || !tt)
+ if (!sname) {
+ ERR("sname is not defined");
return -EINVAL;
+ }
+ if (!tt) {
+ ERR("ttable is not defined");
+ return -EINVAL;
+ }
err = snd_pcm_route_load_ttable(tt, ttable, MAX_CHANNELS, MAX_CHANNELS,
&cused, &sused, schannels);
Pthread_mutex_lock(&slave->mutex);
if (slave->setup_count > 1 ||
(slave->setup_count == 1 && !pcm->setup)) {
- params->fail_mask = 0;
if (params->format != spcm->format)
params->fail_mask |= SND_PCM_HW_PARBIT_FORMAT;
if (params->subformat != spcm->subformat)
if (strcmp(n->id, "sname") == 0) {
err = snd_config_string_get(n, &sname);
if (err < 0) {
- ERR("Invalid type for sname");
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
}
continue;
char *f;
err = snd_config_string_get(n, &f);
if (err < 0) {
- ERR("Invalid type for sformat");
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
}
sformat = snd_pcm_format_value(f);
if (strcmp(n->id, "schannels") == 0) {
err = snd_config_integer_get(n, &schannels_count);
if (err < 0) {
- ERR("Invalid type for schannels");
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
}
continue;
if (strcmp(n->id, "srate") == 0) {
err = snd_config_integer_get(n, &srate);
if (err < 0) {
- ERR("Invalid type for srate");
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
}
continue;
}
if (strcmp(n->id, "binding") == 0) {
if (snd_config_type(n) != SND_CONFIG_TYPE_COMPOUND) {
- ERR("Invalid type for binding");
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
}
binding = n;
continue;
}
- ERR("Unknown field: %s", n->id);
+ ERR("Unknown field %s", n->id);
return -EINVAL;
}
if (!sname) {
if (strcmp(n->id, "server") == 0) {
err = snd_config_string_get(n, &server);
if (err < 0) {
- ERR("Invalid type for server");
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
}
continue;
if (strcmp(n->id, "sname") == 0) {
err = snd_config_string_get(n, &sname);
if (err < 0) {
- ERR("Invalid type for sname");
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
}
continue;
}
- ERR("Unknown field: %s", n->id);
+ ERR("Unknown field %s", n->id);
return -EINVAL;
}
if (!sname) {
if (strcmp(n->id, "host") == 0) {
err = snd_config_string_get(n, &host);
if (err < 0) {
- ERR("Invalid type for host");
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
}
continue;
if (strcmp(n->id, "socket") == 0) {
err = snd_config_string_get(n, &socket);
if (err < 0) {
- ERR("Invalid type for socket");
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
}
continue;
if (strcmp(n->id, "port") == 0) {
err = snd_config_integer_get(n, &port);
if (err < 0) {
- ERR("Invalid type for port");
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
}
continue;
}
- ERR("Unknown field: %s", n->id);
+ ERR("Unknown field %s", n->id);
return -EINVAL;
}
return -ENOENT;
}
if (snd_config_type(rawmidi_conf) != SND_CONFIG_TYPE_COMPOUND) {
- ERR("Invalid type for RAWMIDI definition");
+ ERR("Invalid type for RAWMIDI %s definition", name);
return -EINVAL;
}
err = snd_config_search(rawmidi_conf, "streams", &conf);
if (err >= 0) {
err = snd_config_string_get(conf, &str);
if (err < 0) {
- ERR("Invalid type for streams");
+ ERR("Invalid type for %s", conf->id);
return err;
}
if (strcmp(str, "output") == 0) {
if (streams != SND_RAWMIDI_OPEN_DUPLEX)
return -EINVAL;
} else {
- ERR("Invalid value for streams");
+ ERR("Invalid value for %s", conf->id);
return -EINVAL;
}
}
}
err = snd_config_string_get(conf, &str);
if (err < 0) {
- ERR("Invalid type for type");
+ ERR("Invalid type for %s", conf->id);
return err;
}
err = snd_config_searchv(snd_config, &type_conf, "rawmiditype", str, 0);
if (strcmp(n->id, "lib") == 0) {
err = snd_config_string_get(n, &lib);
if (err < 0) {
- ERR("Invalid type for lib");
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
}
continue;
if (strcmp(n->id, "open") == 0) {
err = snd_config_string_get(n, &open);
if (err < 0) {
- ERR("Invalid type for open");
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
}
continue;
- ERR("Unknown field: %s", n->id);
+ ERR("Unknown field %s", n->id);
return -EINVAL;
}
}
return -ENOENT;
}
if (snd_config_type(seq_conf) != SND_CONFIG_TYPE_COMPOUND) {
- ERR("Invalid type for SEQ definition");
+ ERR("Invalid type for SEQ %s definition", name);
return -EINVAL;
}
err = snd_config_search(seq_conf, "streams", &conf);
if (err >= 0) {
err = snd_config_string_get(conf, &str);
if (err < 0) {
- ERR("Invalid type for streams");
+ ERR("Invalid type for %s", conf->id);
return err;
}
if (strcmp(str, "output") == 0) {
if (streams != SND_SEQ_OPEN_DUPLEX)
return -EINVAL;
} else {
- ERR("Invalid value for streams");
+ ERR("Invalid value for %s", conf->id);
return -EINVAL;
}
}
}
err = snd_config_string_get(conf, &str);
if (err < 0) {
- ERR("Invalid type for type");
+ ERR("Invalid type for %s", conf->id);
return err;
}
err = snd_config_searchv(snd_config, &type_conf, "seqtype", str, 0);
if (strcmp(n->id, "lib") == 0) {
err = snd_config_string_get(n, &lib);
if (err < 0) {
- ERR("Invalid type for lib");
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
}
continue;
if (strcmp(n->id, "open") == 0) {
err = snd_config_string_get(n, &open);
if (err < 0) {
- ERR("Invalid type for open");
+ ERR("Invalid type for %s", n->id);
return -EINVAL;
}
continue;
- ERR("Unknown field: %s", n->id);
+ ERR("Unknown field %s", n->id);
return -EINVAL;
}
}