]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/hantek-dso/api.c
Simplify channel creation.
[libsigrok.git] / src / hardware / hantek-dso / api.c
index 7bf0c5293b7927d0b042ba617316e0ba97c47c3d..e2d091424ac8821c520f20d23b34f1091c3c6048 100644 (file)
@@ -57,7 +57,7 @@ static const uint32_t devopts[] = {
        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_TIMEBASE | SR_CONF_GET,
+       SR_CONF_NUM_HDIV | SR_CONF_GET,
        SR_CONF_NUM_VDIV | SR_CONF_GET,
 };
 
@@ -172,7 +172,7 @@ static struct sr_dev_inst *dso_dev_new(const struct dso_profile *prof)
        struct dev_context *devc;
        int i;
 
-       sdi = sr_dev_inst_new();
+       sdi = g_malloc0(sizeof(struct sr_dev_inst));
        sdi->status = SR_ST_INITIALIZING;
        sdi->vendor = g_strdup(prof->vendor);
        sdi->model = g_strdup(prof->model);
@@ -183,8 +183,7 @@ static struct sr_dev_inst *dso_dev_new(const struct dso_profile *prof)
         * a trigger source internal to the device.
         */
        for (i = 0; channel_names[i]; i++) {
-               ch = sr_channel_new(i, SR_CHANNEL_ANALOG, TRUE, channel_names[i]);
-               sdi->channels = g_slist_append(sdi->channels, ch);
+               ch = sr_channel_new(sdi, i, SR_CHANNEL_ANALOG, TRUE, channel_names[i]);
                cg = g_malloc0(sizeof(struct sr_channel_group));
                cg->name = g_strdup(channel_names[i]);
                cg->channels = g_slist_append(cg->channels, ch);
@@ -439,7 +438,7 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s
        (void)cg;
 
        switch (key) {
-       case SR_CONF_NUM_TIMEBASE:
+       case SR_CONF_NUM_HDIV:
                *data = g_variant_new_int32(NUM_TIMEBASE);
                break;
        case SR_CONF_NUM_VDIV: