return SR_ERR_ARG;
}
- if (!o->sdi->driver) {
- sr_warn("%s: o->sdi->driver was NULL", __func__);
- return SR_ERR_ARG;
- }
-
if (!(ctx = g_try_malloc0(sizeof(struct context)))) {
sr_warn("%s: ctx malloc failed", __func__);
return SR_ERR_MALLOC;
}
ctx->unitsize = (ctx->num_enabled_probes + 7) / 8;
- if (sr_dev_has_option(o->sdi, SR_CONF_SAMPLERATE)) {
- o->sdi->driver->config_get(SR_CONF_SAMPLERATE, &gvar, o->sdi);
+ if (sr_config_get(o->sdi->driver, SR_CONF_SAMPLERATE, &gvar,
+ o->sdi) == SR_OK) {
ctx->samplerate = g_variant_get_uint64(gvar);
g_variant_unref(gvar);
} else
return SR_ERR_ARG;
}
- if (!o->sdi->driver) {
- sr_err("%s: o->sdi->driver was NULL", __func__);
- return SR_ERR_ARG;
- }
-
if (!(ctx = g_try_malloc0(sizeof(struct context)))) {
sr_err("%s: ctx malloc failed", __func__);
return SR_ERR_MALLOC;
num_probes = g_slist_length(o->sdi->probes);
- if (sr_dev_has_option(o->sdi, SR_CONF_SAMPLERATE)) {
- o->sdi->driver->config_get(SR_CONF_SAMPLERATE, &gvar, o->sdi);
+ if (sr_config_get(o->sdi->driver, SR_CONF_SAMPLERATE, &gvar,
+ o->sdi) == SR_OK) {
ctx->samplerate = g_variant_get_uint64(gvar);
g_variant_unref(gvar);
} else
return SR_ERR_ARG;
}
- if (!o->sdi->driver) {
- sr_err("%s: o->sdi->driver was NULL", __func__);
- return SR_ERR_ARG;
- }
-
if (!(ctx = g_try_malloc0(sizeof(struct context)))) {
sr_err("%s: ctx malloc failed", __func__);
return SR_ERR_MALLOC;
num_probes = g_slist_length(o->sdi->probes);
comment[0] = '\0';
samplerate = 0;
- if (sr_dev_has_option(o->sdi, SR_CONF_SAMPLERATE)) {
- o->sdi->driver->config_get(SR_CONF_SAMPLERATE, &gvar, o->sdi);
+ if (sr_config_get(o->sdi->driver, SR_CONF_SAMPLERATE, &gvar,
+ o->sdi) == SR_OK) {
samplerate = g_variant_get_uint64(gvar);
+ g_variant_unref(gvar);
if (!(frequency_s = sr_samplerate_string(samplerate))) {
sr_err("%s: sr_samplerate_string failed", __func__);
g_free(ctx);
- g_variant_unref(gvar);
return SR_ERR;
}
snprintf(comment, 127, gnuplot_header_comment,
ctx->num_enabled_probes, num_probes, frequency_s);
g_free(frequency_s);
- g_variant_unref(gvar);
}
/* Columns / channels */
snprintf(ctx->header, 511, "%s\n", PACKAGE_STRING);
num_probes = g_slist_length(o->sdi->probes);
- if (o->sdi->driver || sr_dev_has_option(o->sdi, SR_CONF_SAMPLERATE)) {
- if ((ret = o->sdi->driver->config_get(SR_CONF_SAMPLERATE, &gvar,
- o->sdi)) != SR_OK)
- goto err;
+ if (sr_config_get(o->sdi->driver, SR_CONF_SAMPLERATE, &gvar,
+ o->sdi) == SR_OK) {
samplerate = g_variant_get_uint64(gvar);
+ g_variant_unref(gvar);
if (!(samplerate_s = sr_samplerate_string(samplerate))) {
ret = SR_ERR;
- g_variant_unref(gvar);
goto err;
}
snprintf(ctx->header + strlen(ctx->header),
"Acquisition with %d/%d probes at %s\n",
ctx->num_enabled_probes, num_probes, samplerate_s);
g_free(samplerate_s);
- g_variant_unref(gvar);
}
ctx->linebuf_len = ctx->samples_per_line * 2 + 4;
g_string_append_printf(ctx->header, "$version %s %s $end\n",
PACKAGE, PACKAGE_VERSION);
- if (o->sdi->driver && sr_dev_has_option(o->sdi, SR_CONF_SAMPLERATE)) {
- o->sdi->driver->config_get(SR_CONF_SAMPLERATE, &gvar, o->sdi);
+ if (sr_config_get(o->sdi->driver, SR_CONF_SAMPLERATE, &gvar,
+ o->sdi) == SR_OK) {
ctx->samplerate = g_variant_get_uint64(gvar);
+ g_variant_unref(gvar);
if (!((samplerate_s = sr_samplerate_string(ctx->samplerate)))) {
g_string_free(ctx->header, TRUE);
g_free(ctx);
- g_variant_unref(gvar);
return SR_ERR;
}
g_string_append_printf(ctx->header, vcd_header_comment,
ctx->num_enabled_probes, num_probes, samplerate_s);
g_free(samplerate_s);
- g_variant_unref(gvar);
}
/* timescale */