]> sigrok.org Git - libsigrok.git/blobdiff - hardware/hantek-dso/api.c
allow for intermediate stage in stopping acquisition
[libsigrok.git] / hardware / hantek-dso / api.c
index e35dacbdd310193c8b786a62c4a8521aac925611..0847da558aabbacb361a4b6db3538514a199aecf 100644 (file)
@@ -145,8 +145,7 @@ static const char *coupling[] = {
 
 SR_PRIV struct sr_dev_driver hantek_dso_driver_info;
 static struct sr_dev_driver *hdi = &hantek_dso_driver_info;
-static int hw_dev_acquisition_stop(const struct sr_dev_inst *sdi,
-               void *cb_data);
+static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data);
 
 static struct sr_dev_inst *dso_dev_new(int index, const struct dso_profile *prof)
 {
@@ -258,7 +257,7 @@ static int hw_init(void)
 
        if (!(drvc = g_try_malloc0(sizeof(struct drv_context)))) {
                sr_err("hantek-dso: driver context malloc failed.");
-               return SR_ERR;
+               return SR_ERR_MALLOC;
        }
 
        if (libusb_init(NULL) != 0) {
@@ -602,6 +601,7 @@ static void send_chunk(struct dev_context *devc, unsigned char *buf,
        analog.num_samples = num_samples;
        analog.mq = SR_MQ_VOLTAGE;
        analog.unit = SR_UNIT_VOLT;
+       /* TODO: Check malloc return value. */
        analog.data = g_try_malloc(analog.num_samples * sizeof(float) * num_probes);
        data_offset = 0;
        for (i = 0; i < analog.num_samples; i++) {
@@ -804,6 +804,7 @@ static int handle_event(int fd, int revents, void *cb_data)
                devc->trigger_offset = trigger_offset;
 
                num_probes = (devc->ch1_enabled && devc->ch2_enabled) ? 2 : 1;
+               /* TODO: Check malloc return value. */
                devc->framebuf = g_try_malloc(devc->framesize * num_probes * 2);
                devc->samp_buffered = devc->samp_received = 0;
 
@@ -884,8 +885,7 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
        return SR_OK;
 }
 
-static int hw_dev_acquisition_stop(const struct sr_dev_inst *sdi,
-               void *cb_data)
+static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
 {
        struct dev_context *devc;