X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fdemo%2Fdemo.c;h=920c1e4d6c93b33d79b0a1021d6e3d64373d8c98;hb=6c7d80afcaf043eb8128a3102519032850fec1af;hp=b6a561afbc71843cfe6398dc7c0f02db99e8143e;hpb=e2b99f04d8edd268b220ad7369f3029da34f3ac4;p=libsigrok.git diff --git a/src/hardware/demo/demo.c b/src/hardware/demo/demo.c index b6a561af..920c1e4d 100644 --- a/src/hardware/demo/demo.c +++ b/src/hardware/demo/demo.c @@ -278,7 +278,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) int num_logic_channels, num_analog_channels, pattern, i; char channel_name[16]; - drvc = di->priv; + drvc = di->context; num_logic_channels = DEFAULT_NUM_LOGIC_CHANNELS; num_analog_channels = DEFAULT_NUM_ANALOG_CHANNELS; @@ -370,7 +370,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) static GSList *dev_list(const struct sr_dev_driver *di) { - return ((struct drv_context *)(di->priv))->instances; + return ((struct drv_context *)(di->context))->instances; } static int dev_open(struct sr_dev_inst *sdi) @@ -777,9 +777,9 @@ static int prepare_data(int fd, int revents, void *cb_data) expected_samplenum = MIN(expected_samplenum, devc->limit_samples); /* Of those, how many do we still have to send? */ - if (devc->num_logic_channels) + if (devc->num_logic_channels && (devc->logic_counter < devc->limit_samples)) logic_todo = expected_samplenum - devc->logic_counter; - if (devc->num_analog_channels) + if (devc->num_analog_channels && (devc->analog_counter < devc->limit_samples)) analog_todo = expected_samplenum - devc->analog_counter; while (logic_todo || analog_todo) { @@ -901,6 +901,8 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data) g_io_channel_shutdown(devc->channel, FALSE, NULL); g_io_channel_unref(devc->channel); devc->channel = NULL; + close(devc->pipe_fds[0]); + close(devc->pipe_fds[1]); /* Send last packet. */ packet.type = SR_DF_END; @@ -925,5 +927,5 @@ SR_PRIV struct sr_dev_driver demo_driver_info = { .dev_close = dev_close, .dev_acquisition_start = dev_acquisition_start, .dev_acquisition_stop = dev_acquisition_stop, - .priv = NULL, + .context = NULL, };