]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/scpi-pps/api.c
scpi-pps: Add support for OWON SPE6103
[libsigrok.git] / src / hardware / scpi-pps / api.c
index ed9fbd9db20661a0c7b472e2741c39a89f17f560..bd11f082ae78709fe1b36b8cec1545a28fbadfe5 100644 (file)
@@ -145,8 +145,7 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi,
 
        for (i = 0; i < num_channel_groups; i++) {
                cgs = &channel_groups[i];
-               cg = g_malloc0(sizeof(struct sr_channel_group));
-               cg->name = g_strdup(cgs->name);
+               cg = sr_channel_group_new(sdi, cgs->name, NULL);
                for (j = 0, mask = 1; j < 64; j++, mask <<= 1) {
                        if (cgs->channel_index_mask & mask) {
                                for (l = sdi->channels; l; l = l->next) {
@@ -167,7 +166,6 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi,
                pcg = g_malloc0(sizeof(struct pps_channel_group));
                pcg->features = cgs->features;
                cg->priv = pcg;
-               sdi->channel_groups = g_slist_append(sdi->channel_groups, cg);
        }
 
        sr_scpi_hw_info_free(hw_info);
@@ -254,6 +252,17 @@ static GSList *scan_scpi_pps(struct sr_dev_driver *di, GSList *options)
 
 static GSList *scan_hpib_pps(struct sr_dev_driver *di, GSList *options)
 {
+       const char *conn;
+
+       /*
+        * Only scan for HP-IB devices when conn= was specified, to not
+        * break SCPI devices' operation.
+        */
+       conn = NULL;
+       (void)sr_serial_extract_options(options, &conn, NULL);
+       if (!conn)
+               return NULL;
+
        return sr_scpi_scan(di->context, options, probe_hpib_pps_device);
 }