]> sigrok.org Git - libsigrok.git/blobdiff - hardware/rigol-ds1xx2/api.c
Drop link-mso19/nexus-osciprime in preparation for release.
[libsigrok.git] / hardware / rigol-ds1xx2 / api.c
index bffc6ab951d0958b05f8edd9936e2ba8ef49379c..34081f3db8cf4fe67de51f54d62b610cf56e1901 100644 (file)
@@ -194,7 +194,7 @@ static int set_cfg(const struct sr_dev_inst *sdi, const char *format, ...)
 
 static int hw_init(struct sr_context *sr_ctx)
 {
-       return std_hw_init(sr_ctx, di, DRIVER_LOG_DOMAIN);
+       return std_hw_init(sr_ctx, di, LOG_PREFIX);
 }
 
 static int probe_port(const char *port, GSList **devices)
@@ -210,7 +210,7 @@ static int probe_port(const char *port, GSList **devices)
        char buf[256];
        gchar **tokens, *channel_name;
 
-    *devices = NULL;
+       *devices = NULL;
        if (!(serial = sr_serial_dev_inst_new(port, NULL)))
                return SR_ERR_MALLOC;
 
@@ -246,7 +246,7 @@ static int probe_port(const char *port, GSList **devices)
                return SR_ERR_NA;
        }
 
-    matched = has_digital = FALSE;
+       matched = has_digital = FALSE;
        for (i = 0; i < ARRAY_SIZE(supported_models); i++) {
                if (!strcmp(model, supported_models[i])) {
                        matched = TRUE;
@@ -317,7 +317,7 @@ static GSList *hw_scan(GSList *options)
                }
        }
 
-    devices = NULL;
+       devices = NULL;
        if (port) {
                if (probe_port(port, &devices) == SR_ERR_MALLOC)
                        return NULL;
@@ -338,9 +338,9 @@ static GSList *hw_scan(GSList *options)
                g_dir_close(dir);
        }
 
-    /* Tack a copy of the newly found devices onto the driver list. */
-    l = g_slist_copy(devices);
-    drvc->instances = g_slist_concat(drvc->instances, l);
+       /* Tack a copy of the newly found devices onto the driver list. */
+       l = g_slist_copy(devices);
+       drvc->instances = g_slist_concat(drvc->instances, l);
 
        return devices;
 }
@@ -359,7 +359,7 @@ static int hw_dev_open(struct sr_dev_inst *sdi)
        if (rigol_ds1xx2_get_dev_cfg(sdi) != SR_OK)
                return SR_ERR;
 
-    sdi->status = SR_ST_ACTIVE;
+       sdi->status = SR_ST_ACTIVE;
 
        return SR_OK;
 }
@@ -414,10 +414,8 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
 
        devc = sdi->priv;
 
-       if (sdi->status != SR_ST_ACTIVE) {
-               sr_err("Device inactive, can't set config options.");
-               return SR_ERR;
-       }
+       if (sdi->status != SR_ST_ACTIVE)
+               return SR_ERR_DEV_CLOSED;
 
        ret = SR_OK;
        switch (id) {
@@ -575,7 +573,8 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
        GSList *l;
        char cmd[256];
 
-       (void)cb_data;
+       if (sdi->status != SR_ST_ACTIVE)
+               return SR_ERR_DEV_CLOSED;
 
        serial = sdi->conn;
        devc = sdi->priv;
@@ -613,7 +612,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
        sr_source_add(serial->fd, G_IO_IN, 50, rigol_ds1xx2_receive, (void *)sdi);
 
        /* Send header packet to the session bus. */
-       std_session_send_df_header(cb_data, DRIVER_LOG_DOMAIN);
+       std_session_send_df_header(cb_data, LOG_PREFIX);
 
        /* Fetch the first frame. */
        if (devc->enabled_analog_probes) {