]> sigrok.org Git - libsigrok.git/blobdiff - hardware/chronovu-la8/api.c
sr/drivers: add API calls sr_dev_inst_list() and sr_dev_inst_clear()
[libsigrok.git] / hardware / chronovu-la8 / api.c
index 7c99ceb59a4d81d30732b7b42b6af7c248f7feda..012ad6f1e3e8773fb8621b5701a33459ebfa8e04 100644 (file)
@@ -41,7 +41,7 @@ static const uint16_t usb_pids[] = {
 static int hw_dev_acquisition_stop(const struct sr_dev_inst *sdi,
                void *cb_data);
 
-static void clear_instances(void)
+static int clear_instances(void)
 {
        GSList *l;
        struct sr_dev_inst *sdi;
@@ -66,6 +66,7 @@ static void clear_instances(void)
        g_slist_free(drvc->instances);
        drvc->instances = NULL;
 
+       return SR_OK;
 }
 
 static int hw_init(void)
@@ -186,6 +187,15 @@ err_free_nothing:
        return NULL;
 }
 
+static GSList *hw_dev_list(void)
+{
+       struct drv_context *drvc;
+
+       drvc = cdi->priv;
+
+       return drvc->instances;
+}
+
 static int hw_dev_open(struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
@@ -338,12 +348,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__);
@@ -445,6 +449,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[]. */
@@ -520,6 +529,8 @@ SR_PRIV struct sr_dev_driver chronovu_la8_driver_info = {
        .init = hw_init,
        .cleanup = hw_cleanup,
        .scan = hw_scan,
+       .dev_list = hw_dev_list,
+       .dev_clear = clear_instances,
        .dev_open = hw_dev_open,
        .dev_close = hw_dev_close,
        .info_get = hw_info_get,