X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=output%2Fgnuplot.c;h=32369610a958064b4a3721acc00c2d9c7faab24c;hb=c09f0b578c0e9c03590cb814f66004bb3f6815ff;hp=cfb5d7ec4ab3bf319bd84f325150c3f83bb07453;hpb=133a37bfba1a7e1423716b2b872d3bb82a2e64d9;p=libsigrok.git diff --git a/output/gnuplot.c b/output/gnuplot.c index cfb5d7ec..32369610 100644 --- a/output/gnuplot.c +++ b/output/gnuplot.c @@ -66,13 +66,13 @@ static int init(struct sr_output *o) return SR_ERR_ARG; } - if (!o->device) { - sr_err("gnuplot out: %s: o->device was NULL", __func__); + if (!o->dev) { + sr_err("gnuplot out: %s: o->dev was NULL", __func__); return SR_ERR_ARG; } - if (!o->device->plugin) { - sr_err("gnuplot out: %s: o->device->plugin was NULL", __func__); + if (!o->dev->driver) { + sr_err("gnuplot out: %s: o->dev->driver was NULL", __func__); return SR_ERR_ARG; } @@ -89,7 +89,7 @@ static int init(struct sr_output *o) o->internal = ctx; ctx->num_enabled_probes = 0; - for (l = o->device->probes; l; l = l->next) { + for (l = o->dev->probes; l; l = l->next) { probe = l->data; /* TODO: Error checks. */ if (!probe->enabled) continue; @@ -98,11 +98,11 @@ static int init(struct sr_output *o) ctx->probelist[ctx->num_enabled_probes] = 0; ctx->unitsize = (ctx->num_enabled_probes + 7) / 8; - num_probes = g_slist_length(o->device->probes); + num_probes = g_slist_length(o->dev->probes); comment[0] = '\0'; - if (sr_device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) { - samplerate = *((uint64_t *) o->device->plugin->get_device_info( - o->device->plugin_index, SR_DI_CUR_SAMPLERATE)); + if (sr_dev_has_hwcap(o->dev, SR_HWCAP_SAMPLERATE)) { + samplerate = *((uint64_t *) o->dev->driver->dev_info_get( + o->dev->driver_index, SR_DI_CUR_SAMPLERATE)); if (!(frequency_s = sr_samplerate_string(samplerate))) { sr_err("gnuplot out: %s: sr_samplerate_string failed", __func__); @@ -148,8 +148,6 @@ static int init(struct sr_output *o) static int event(struct sr_output *o, int event_type, char **data_out, uint64_t *length_out) { - struct context *ctx; - if (!o) { sr_err("gnuplot out: %s: o was NULL", __func__); return SR_ERR_ARG; @@ -165,8 +163,6 @@ static int event(struct sr_output *o, int event_type, char **data_out, return SR_ERR_ARG; } - ctx = o->internal; - switch (event_type) { case SR_DF_TRIGGER: /* TODO: Can a trigger mark be in a gnuplot data file? */ @@ -311,7 +307,7 @@ static int analog_init(struct sr_output *o) o->internal = ctx; ctx->num_enabled_probes = 0; - for (l = o->device->probes; l; l = l->next) { + for (l = o->dev->probes; l; l = l->next) { probe = l->data; if (!probe->enabled) continue; @@ -322,11 +318,11 @@ static int analog_init(struct sr_output *o) ctx->unitsize = sizeof(struct sr_analog_sample) + (ctx->num_enabled_probes * sizeof(struct sr_analog_probe)); - num_probes = g_slist_length(o->device->probes); + num_probes = g_slist_length(o->dev->probes); comment[0] = '\0'; - if (o->device->plugin && sr_device_has_hwcap(o->device, SR_HWCAP_SAMPLERATE)) { - samplerate = *((uint64_t *) o->device->plugin->get_device_info( - o->device->plugin_index, SR_DI_CUR_SAMPLERATE)); + if (o->dev->driver && sr_dev_has_hwcap(o->dev, SR_HWCAP_SAMPLERATE)) { + samplerate = *((uint64_t *) o->dev->driver->dev_info_get( + o->dev->driver_index, SR_DI_CUR_SAMPLERATE)); if (!(frequency_s = sr_samplerate_string(samplerate))) { g_free(ctx->header); g_free(ctx);