]> sigrok.org Git - libsigrok.git/blobdiff - hardware/cem-dt-885x/api.c
Add struct sr_session parameter to all session source backends.
[libsigrok.git] / hardware / cem-dt-885x / api.c
index e1e4b2e4895abb295fdabebc6d787ca857220f2f..9aed547362c59bd5933c45e56cff2e24a7fb43f8 100644 (file)
@@ -79,7 +79,7 @@ static GSList *scan(GSList *options)
        struct sr_config *src;
        struct sr_serial_dev_inst *serial;
        struct sr_dev_inst *sdi;
-       struct sr_probe *probe;
+       struct sr_channel *ch;
        GSList *l, *devices;
        gint64 start;
        const char *conn;
@@ -126,9 +126,9 @@ static GSList *scan(GSList *options)
                        sdi->inst_type = SR_INST_SERIAL;
                        sdi->priv = devc;
                        sdi->driver = di;
-                       if (!(probe = sr_probe_new(0, SR_PROBE_ANALOG, TRUE, "SPL")))
+                       if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "SPL")))
                                return NULL;
-                       sdi->probes = g_slist_append(sdi->probes, probe);
+                       sdi->channels = g_slist_append(sdi->channels, ch);
                        drvc->instances = g_slist_append(drvc->instances, sdi);
                        devices = g_slist_append(devices, sdi);
                        break;
@@ -147,11 +147,6 @@ static GSList *dev_list(void)
        return ((struct drv_context *)(di->priv))->instances;
 }
 
-static int dev_clear(void)
-{
-       return std_dev_clear(di, NULL);
-}
-
 static int dev_open(struct sr_dev_inst *sdi)
 {
        struct sr_serial_dev_inst *serial;
@@ -167,18 +162,18 @@ static int dev_open(struct sr_dev_inst *sdi)
 
 static int cleanup(void)
 {
-       return dev_clear();
+       return std_dev_clear(di, NULL);
 }
 
 static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
-               const struct sr_probe_group *probe_group)
+               const struct sr_channel_group *cg)
 {
        struct dev_context *devc;
        GVariant *range[2];
        uint64_t low, high;
        int tmp, ret;
 
-       (void)probe_group;
+       (void)cg;
 
        if (!sdi)
                return SR_ERR_ARG;
@@ -243,7 +238,7 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
 }
 
 static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
-               const struct sr_probe_group *probe_group)
+               const struct sr_channel_group *cg)
 {
        struct dev_context *devc;
        uint64_t tmp_u64, low, high;
@@ -251,7 +246,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
        int tmp, ret;
        const char *tmp_str;
 
-       (void)probe_group;
+       (void)cg;
 
        if (sdi->status != SR_ST_ACTIVE)
                return SR_ERR_DEV_CLOSED;
@@ -333,7 +328,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
 }
 
 static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
-               const struct sr_probe_group *probe_group)
+               const struct sr_channel_group *cg)
 {
        GVariant *tuple, *range[2];
        GVariantBuilder gvb;
@@ -341,7 +336,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
        int ret;
 
        (void)sdi;
-       (void)probe_group;
+       (void)cg;
 
        ret = SR_OK;
        switch (key) {
@@ -402,16 +397,14 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
 
        /* Poll every 100ms, or whenever some data comes in. */
        serial = sdi->conn;
-       serial_source_add(serial, G_IO_IN, 150, cem_dt_885x_receive_data,
-                       (void *)sdi);
+       serial_source_add(sdi->session, serial, G_IO_IN, 150,
+                       cem_dt_885x_receive_data, (void *)sdi);
 
        return SR_OK;
 }
 
 static int dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
 {
-       (void)cb_data;
-
        if (sdi->status != SR_ST_ACTIVE)
                return SR_ERR_DEV_CLOSED;
 
@@ -427,7 +420,7 @@ SR_PRIV struct sr_dev_driver cem_dt_885x_driver_info = {
        .cleanup = cleanup,
        .scan = scan,
        .dev_list = dev_list,
-       .dev_clear = dev_clear,
+       .dev_clear = NULL,
        .config_get = config_get,
        .config_set = config_set,
        .config_list = config_list,