]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/hantek-dso/api.c
dev_clear(): Consistently name callback 'clear_helper()'.
[libsigrok.git] / src / hardware / hantek-dso / api.c
index c94fbc5c848c3c04d42b2ebd93fcba02192f1278..ea07b546fd57547514d2f310bb38c5123609b619 100644 (file)
@@ -54,21 +54,21 @@ static const uint32_t drvopts[] = {
 
 static const uint32_t devopts[] = {
        SR_CONF_CONTINUOUS,
-       SR_CONF_LIMIT_FRAMES | SR_CONF_SET,
        SR_CONF_CONN | SR_CONF_GET,
+       SR_CONF_LIMIT_FRAMES | SR_CONF_SET,
        SR_CONF_TIMEBASE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
-       SR_CONF_BUFFERSIZE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
+       SR_CONF_NUM_HDIV | SR_CONF_GET,
+       SR_CONF_HORIZ_TRIGGERPOS | SR_CONF_GET | SR_CONF_SET,
        SR_CONF_TRIGGER_SOURCE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
        SR_CONF_TRIGGER_SLOPE | SR_CONF_GET | SR_CONF_SET,
-       SR_CONF_HORIZ_TRIGGERPOS | SR_CONF_GET | SR_CONF_SET,
-       SR_CONF_NUM_HDIV | SR_CONF_GET,
+       SR_CONF_BUFFERSIZE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
        SR_CONF_NUM_VDIV | SR_CONF_GET,
 };
 
 static const uint32_t devopts_cg[] = {
-       SR_CONF_FILTER | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
        SR_CONF_VDIV | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
        SR_CONF_COUPLING | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
+       SR_CONF_FILTER | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
 };
 
 static const char *channel_names[] = {
@@ -161,8 +161,6 @@ static const char *coupling[] = {
        "GND",
 };
 
-static int dev_acquisition_stop(struct sr_dev_inst *sdi);
-
 static struct sr_dev_inst *dso_dev_new(const struct dso_profile *prof)
 {
        struct sr_dev_inst *sdi;
@@ -234,19 +232,18 @@ static int configure_channels(const struct sr_dev_inst *sdi)
        return SR_OK;
 }
 
-static void clear_dev_context(void *priv)
+static void clear_helper(void *priv)
 {
        struct dev_context *devc;
 
        devc = priv;
        g_free(devc->triggersource);
        g_slist_free(devc->enabled_channels);
-
 }
 
 static int dev_clear(const struct sr_dev_driver *di)
 {
-       return std_dev_clear(di, clear_dev_context);
+       return std_dev_clear_with_callback(di, clear_helper);
 }
 
 static GSList *scan(struct sr_dev_driver *di, GSList *options)
@@ -493,9 +490,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
        unsigned int i;
        const char *tmp_str;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        ret = SR_OK;
        devc = sdi->priv;
        if (!cg) {
@@ -956,9 +950,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        struct sr_dev_driver *di = sdi->driver;
        struct drv_context *drvc = di->context;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        devc = sdi->priv;
 
        if (configure_channels(sdi) != SR_OK) {
@@ -984,9 +975,6 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR;
-
        devc = sdi->priv;
        devc->dev_state = STOPPING;