]> sigrok.org Git - libsigrok.git/blobdiff - hardware/chronovu-la8/api.c
sr/drivers: obsolete SR_HWCAP_PROBECONFIG
[libsigrok.git] / hardware / chronovu-la8 / api.c
index aa438ff91fbc4ea9637d04b6e6be152fe83e58dc..a7fff10856c6c6c16f0fe3e859f0961dc25eb413 100644 (file)
@@ -60,7 +60,6 @@ static void clear_instances(void)
                if (sdi->priv) {
                        devc = sdi->priv;
                        ftdi_free(devc->ftdic);
-                       g_free(devc);
                }
                sr_dev_inst_free(sdi);
        }
@@ -253,7 +252,6 @@ static int hw_dev_close(struct sr_dev_inst *sdi)
 
        if (sdi->status == SR_ST_ACTIVE) {
                sr_dbg("la8: Status ACTIVE, closing device.");
-               /* TODO: Really ignore errors here, or return SR_ERR? */
                (void) la8_close_usb_reset_sequencer(devc); /* Ignore errors. */
        } else {
                sr_spew("la8: Status not ACTIVE, nothing to do.");
@@ -270,6 +268,9 @@ static int hw_dev_close(struct sr_dev_inst *sdi)
 static int hw_cleanup(void)
 {
 
+       if (!cdi->priv)
+               return SR_OK;
+
        clear_instances();
 
        return SR_OK;
@@ -337,12 +338,6 @@ static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
                }
                sr_dbg("la8: SAMPLERATE = %" PRIu64, devc->cur_samplerate);
                break;
-       case SR_HWCAP_PROBECONFIG:
-               if (configure_probes(devc, (const GSList *)value) != SR_OK) {
-                       sr_err("la8: %s: probe config failed.", __func__);
-                       return SR_ERR;
-               }
-               break;
        case SR_HWCAP_LIMIT_MSEC:
                if (*(const uint64_t *)value == 0) {
                        sr_err("la8: %s: LIMIT_MSEC can't be 0.", __func__);
@@ -415,7 +410,6 @@ static int receive_data(int fd, int revents, void *cb_data)
 
        hw_dev_acquisition_stop(sdi, sdi);
 
-       // return FALSE; /* FIXME? */
        return TRUE;
 }
 
@@ -445,6 +439,11 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
                return SR_ERR;
        }
 
+       if (configure_probes(sdi) != SR_OK) {
+               sr_err("chronovu-la8: failed to configured probes");
+               return SR_ERR;
+       }
+
        sr_dbg("la8: Starting acquisition.");
 
        /* Fill acquisition parameters into buf[]. */
@@ -461,7 +460,7 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
                return SR_ERR;
        } else if (bytes_written != 4) {
                sr_err("la8: Acquisition failed to start.");
-               return SR_ERR; /* TODO: Other error and return code? */
+               return SR_ERR;
        }
 
        sr_dbg("la8: Acquisition started successfully.");
@@ -498,15 +497,12 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
 static int hw_dev_acquisition_stop(const struct sr_dev_inst *sdi,
                void *cb_data)
 {
-       struct dev_context *devc;
        struct sr_datafeed_packet packet;
 
-       sr_dbg("la8: Stopping acquisition.");
+       (void)sdi;
 
-       if (!(devc = sdi->priv)) {
-               sr_err("la8: %s: sdi->priv was NULL", __func__);
-               return SR_ERR_BUG;
-       }
+       sr_dbg("la8: Stopping acquisition.");
+       sr_source_remove(-1);
 
        /* Send end packet to the session bus. */
        sr_dbg("la8: Sending SR_DF_END.");