]> sigrok.org Git - libsigrok.git/blobdiff - hardware/hantek-dso/api.c
sr: remove obsolete SR_DI_INST
[libsigrok.git] / hardware / hantek-dso / api.c
index 72f7079365b627dda049cb796d750047d141ce9f..addc29032c27a99527d572f2293824a118a744cc 100644 (file)
@@ -151,7 +151,9 @@ static struct sr_dev_driver *hdi = &hantek_dso_driver_info;
 static struct sr_dev_inst *dso_dev_new(int index, const struct dso_profile *prof)
 {
        struct sr_dev_inst *sdi;
+       struct sr_probe *probe;
        struct context *ctx;
+       int i;
 
        sdi = sr_dev_inst_new(index, SR_ST_INITIALIZING,
                prof->vendor, prof->model, NULL);
@@ -159,6 +161,16 @@ static struct sr_dev_inst *dso_dev_new(int index, const struct dso_profile *prof
                return NULL;
        sdi->driver = hdi;
 
+       /* Add only the real probes -- EXT isn't a source of data, only
+        * a trigger source internal to the device.
+        */
+       for (i = 0; probe_names[i]; i++) {
+               if (!(probe = sr_probe_new(i, SR_PROBE_ANALOG, TRUE,
+                               probe_names[i])))
+                       return NULL;
+               sdi->probes = g_slist_append(sdi->probes, probe);
+       }
+
        if (!(ctx = g_try_malloc0(sizeof(struct context)))) {
                sr_err("hantek-dso: ctx malloc failed");
                return NULL;
@@ -193,9 +205,9 @@ static int configure_probes(struct context *ctx, const GSList *probes)
        ctx->ch1_enabled = ctx->ch2_enabled = FALSE;
        for (l = probes; l; l = l->next) {
                probe = (struct sr_probe *)l->data;
-               if (probe->index == 1)
+               if (probe->index == 0)
                        ctx->ch1_enabled = probe->enabled;
-               else if (probe->index == 2)
+               else if (probe->index == 1)
                        ctx->ch2_enabled = probe->enabled;
        }
 
@@ -385,10 +397,9 @@ static int hw_info_get(int info_id, const void **data,
 {
        uint64_t tmp;
 
+       (void)sdi;
+
        switch (info_id) {
-       case SR_DI_INST:
-               *data = sdi;
-               break;
        case SR_DI_HWCAPS:
                *data = hwcaps;
                break;